ScratchRun MCP Server
@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.
Related MCP server: Code Executor MCP Server
Tool: scratchrun_exec
Executes code in an ephemeral sandbox and returns stdout, stderr, exit code, and any output files.
Parameters:
Parameter | Type | Required | Description |
|
| yes | Runtime to use |
| string | yes | Code to execute |
| integer | no | Timeout in ms (default 10000, max 30000) |
| integer | no | Memory limit in MB (default 256, max 512) |
| object | no | Environment variables — use for secrets, not code strings |
| object | no | Files to write before execution (path → content) |
| string[] | no | File 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)
TerminateMicroVMcalled unconditionally after every run — VM destroyed, never reusedRFC 1918 + cloud metadata (
169.254.x.x) always blocked at the network layerRead-only system filesystem via OverlayFS;
/tmpis RAM-backed and gone with the VM
Latency
~400ms median (warm pool). 2–8s cold start if the pool is empty.
License
MIT
Available Tools
1 toolscratchrun_execA
Execute code in an ephemeral, MicroVM-isolated sandbox. The VM is hard-purged after execution — no state, no files, nothing persists between calls. Full internet egress (RFC 1918 + cloud metadata always blocked). Use return_files to capture output artifacts (charts, CSVs, data files) as base64. Keep secrets out of code strings — pass them via env instead.
Inputs: code (required), runtime (required), env, files, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
Only one tool exists, so there is no possibility of confusion between tools. The tool's purpose is clearly described as sandboxed code execution, making it unambiguous.
The single tool name 'scratchrun_exec' follows a clear snake_case pattern with a descriptive prefix and verb. Consistency is trivially maintained when there is only one tool.
The server is focused entirely on one function: executing code in an ephemeral sandbox. One tool is exactly the right size for this narrow, well-defined purpose, and the parameter space covers execution, environment variables, and file output.
For the server's stated purpose (sandboxed code execution), the tool fully covers the lifecycle: execute code, pass environment variables, and retrieve output files. No obvious missing operations exist within the domain.
Related MCP Connectors
Execution platform for AI agents on Firecracker microVMs in the EU. Interactive Linux sandboxes with root, templates for Python, Node.js, Go, Rust and a headless browser, public HTTPS URLs. Background jobs that outlive the connection, batches of up to 1,000 jobs with dependencies, hard cost caps reserved up front, execution receipts with SHA-256, log digests that fit the context. IPv4, dual-stack or IPv6-only with its own public address, allowlists or no network. WASI runtime for small tasks. Idle sandboxes sleep and keep their files. Also REST API, Python SDK and LangChain.
Cloud Linux VMs for your agent: run code, Docker, files and HTTPS previews in a Sandboxer microVM.
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Sealed microVM sandboxes for AI agents: run untrusted code locally or in kosa8 Cloud.
Related MCP Servers
FlicenseNot gradedqualityDmaintenanceEnables AI assistants to execute Python, JavaScript, Bash, and Go code in blazing-fast (~0.1ms startup), isolated cloud containers with secure, ephemeral environments that auto-destroy after use.128-- AlicenseNot gradedqualityCmaintenanceProvides sandboxed code execution for AI agents with support for Python, JavaScript, and shell commands. Includes comprehensive safety features like destructive pattern blocking, timeout protection, and restricted file access for secure production use.37 npm37 PyPIMIT
- AlicenseNot gradedqualityDmaintenanceProvides isolated sandbox environments for AI agents to execute code securely, generating signed receipts for every execution to ensure auditability and trust.11 npm4MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to safely execute Python, JavaScript, and Bash code in an isolated Docker sandbox with strict security constraints.1-