ScratchRun

dev.scratchrun由 scratchrun.dev 發布v0.1.1更新於 Oct 24, 2026

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

概覽

AI 產生的概覽

在一次性隔離的 MicroVM 中執行簡短的 Python、Node 或 Bash 程式碼片段,並回傳標準輸出、標準錯誤、結束碼與輸出檔案。

可以做什麼
ScratchRun 提供一個工具 scratchrun_exec,在全新的硬體隔離 MicroVM 中執行程式碼,並回傳標準輸出、標準錯誤、結束碼以及所要求的輸出檔案。呼叫端可選擇執行環境(python3.12、python3.11、node20 或 bash),設定逾時與記憶體上限,傳入環境變數,在執行前寫入輸入檔案,並在執行後以 base64 取回檔案。圖片輸出會以 MCP 圖片內容區塊回傳。每次呼叫後虛擬機器即被銷毀,因此各次執行之間不保留任何狀態。
適用情境
適合助理需要真正執行程式碼的情境,例如快速計算、資料轉換、產生圖表或測試程式碼片段,而不必動到使用者自己的機器,也不會留下狀態。它面向一次性的無狀態執行,不適合長時間工作或需要在多次呼叫間保留檔案的作業。
執行需求
需要本機 Node.js 執行環境,透過 npx 執行 npm 套件 @scratchrun/mcp-server,並提供 ScratchRun API 金鑰,放在環境變數 SCRATCHRUN_API_KEY 中。需要能連線至 ScratchRun 服務的網路。僅支援桌面用戶端,不支援網頁端執行。
安裝前請注意
此伺服器需要祕密 SCRATCHRUN_API_KEY,該金鑰會傳送給第三方服務;傳給 scratchrun_exec 的程式碼與檔案會離開使用者機器在遠端執行。傳給該工具的環境變數用於存放祕密,因此不要把憑證寫進程式碼字串。執行由服務商計費或受配額限制;沙箱會封鎖私有網段與雲端中介資料位址,因此需要存取內網的程式碼會失敗。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 ScratchRun,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@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:

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:

json
{  "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

來源:README.md,提交 2d8ebee

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。