ScratchRun

السجل الرسمي أدوات المطورين

Ephemeral MicroVM-isolated code execution for AI agents. Fresh VM per call, hard-purged after.

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

NPM package @scratchrun/mcp-server
Claude Code
claude mcp add scratchrun -e 'SCRATCHRUN_API_KEY=<your scratchrun_api_key>' -- npx -y @scratchrun/mcp-server@0.1.1
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "scratchrun": {
            "command": "npx",
            "args": [
                "-y",
                "@scratchrun/mcp-server@0.1.1"
            ],
            "env": {
                "SCRATCHRUN_API_KEY": "<your scratchrun_api_key>"
            }
        }
    }
}

متغيرات البيئة

  • SCRATCHRUN_API_KEY إلزامي سري ScratchRun API key — get one at https://scratchrun.dev

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. @scratchrun/mcp-server
  2. Install
  3. Tool: scratchrun_exec
  4. Isolation
  5. Latency
  6. License

@scratchrun/mcp-server

MCP server for ScratchRun — ephemeral, MicroVM-isolated code execution for AI agents.

Each call runs in a fresh hardware-isolated MicroVM. The VM is hard-purged after execution. No state, no files, nothing persists between calls.

Install

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "scratchrun": {
      "command": "npx",
      "args": ["-y", "@scratchrun/mcp-server"],
      "env": {
        "SCRATCHRUN_API_KEY": "sr_live_your_key_here"
      }
    }
  }
}

Get an API key at scratchrun.dev.

Tool: scratchrun_exec

Executes code in an ephemeral sandbox and returns stdout, stderr, exit code, and any output files.

Parameters:

ParameterTypeRequiredDescription
runtimepython3.12 \python3.11 \node20 \bashyesRuntime to use
codestringyesCode to execute
timeout_msintegernoTimeout in ms (default 10000, max 30000)
memory_mbintegernoMemory limit in MB (default 256, max 512)
envobjectnoEnvironment variables — use for secrets, not code strings
filesobjectnoFiles to write before execution (path → content)
return_filesstring[]noFile paths to capture after execution (returned as base64)

Example — run Python and return a chart:

{
  "runtime": "python3.12",
  "code": "import matplotlib.pyplot as plt\nimport numpy as np\nx = np.linspace(0, 10, 100)\nplt.plot(x, np.sin(x))\nplt.savefig('/tmp/plot.png')",
  "return_files": ["/tmp/plot.png"]
}

Output files are returned as base64. Image files (PNG, JPG, SVG) are returned as MCP image content blocks and render inline in Claude.

Isolation

  • Hardware-virtualized MicroVM per execution (own kernel, not a shared-kernel container)
  • TerminateMicroVM called unconditionally after every run — VM destroyed, never reused
  • RFC 1918 + cloud metadata (169.254.x.x) always blocked at the network layer
  • Read-only system filesystem via OverlayFS; /tmp is RAM-backed and gone with the VM

Latency

~400ms median (warm pool). 2–8s cold start if the pool is empty.

License

MIT

الأسئلة الشائعة

ما هو ScratchRun؟

Ephemeral MicroVM-isolated code execution for AI agents. Fresh VM per call, hard-purged after.

كيف أثبّت ScratchRun؟

يعمل على جهازك. في Claude Code: claude mcp add scratchrun -e 'SCRATCHRUN_API_KEY=<your scratchrun_api_key>' -- npx -y @scratchrun/mcp-server@0.1.1. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج ScratchRun إلى مفتاح API؟

نعم. يتطلب SCRATCHRUN_API_KEY، وتضبطها في إعداداته.

هل ScratchRun مفتوح المصدر؟

شيفرته علنية على GitHub، لكن المستودع لا يعلن ترخيصًا قياسيًا.

من يصون ScratchRun؟

ينشره ar-blues. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.