Sandboxes for your agent
npx -y sandboxrouting mcp starts an MCP server over stdio. Your agent gets 17 tools to create sandboxes, run commands, move files and run jobs that survive a box dying, routed free tiers first across 108 providers. It shares one ledger with the CLI and the REST server, so they agree on what is live and what is spent.
Add sandboxes to your agent
What your agent will call the tools' server.
In a terminal
claude mcp add sandboxes -- npx -y sandboxrouting mcpEvery client
The router reads provider keys from the environment it starts in, so put them in the client’s env block, or export them before starting a terminal client. A provider without its key is skipped.
Claude Code
In a terminal
claude mcp add sandboxes -- npx -y sandboxrouting mcpCursor
~/.cursor/mcp.json, or .cursor/mcp.json in a project
{
"mcpServers": {
"sandboxes": {
"command": "npx",
"args": [
"-y",
"sandboxrouting",
"mcp"
],
"env": {
"MODAL_TOKEN_ID": "…",
"MODAL_TOKEN_SECRET": "…",
"E2B_API_KEY": "…"
}
}
}
}Claude Desktop
Settings, Developer, Edit Config (claude_desktop_config.json)
{
"mcpServers": {
"sandboxes": {
"command": "npx",
"args": [
"-y",
"sandboxrouting",
"mcp"
],
"env": {
"MODAL_TOKEN_ID": "…",
"MODAL_TOKEN_SECRET": "…",
"E2B_API_KEY": "…"
}
}
}
}VS Code
.vscode/mcp.json in the workspace
{
"servers": {
"sandboxes": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"sandboxrouting",
"mcp"
],
"env": {
"MODAL_TOKEN_ID": "…",
"MODAL_TOKEN_SECRET": "…",
"E2B_API_KEY": "…"
}
}
}
}Windsurf
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"sandboxes": {
"command": "npx",
"args": [
"-y",
"sandboxrouting",
"mcp"
],
"env": {
"MODAL_TOKEN_ID": "…",
"MODAL_TOKEN_SECRET": "…",
"E2B_API_KEY": "…"
}
}
}
}Codex CLI
~/.codex/config.toml
[mcp_servers.sandboxes]
command = "npx"
args = ["-y", "sandboxrouting", "mcp"]
[mcp_servers.sandboxes.env]
E2B_API_KEY = "…"Gemini CLI
~/.gemini/settings.json
{
"mcpServers": {
"sandboxes": {
"command": "npx",
"args": [
"-y",
"sandboxrouting",
"mcp"
],
"env": {
"MODAL_TOKEN_ID": "…",
"MODAL_TOKEN_SECRET": "…",
"E2B_API_KEY": "…"
}
}
}
}The tools it serves
Read from the server itself when this site was built.
list_providers- List sandbox providers with their free-tier status (remaining credit, resets), availability and capabilities.
list_strategies- List the routing strategies (how the router orders providers) and which one is configured. Pass a name as `strategy` to create_sandbox or run_job.
create_sandbox- Create a cloud sandbox. The router picks the provider, using free tiers first, and fails over if one refuses. Returns its id and the routing decision.
run_command- Run a shell command in a sandbox and return stdout, stderr and the exit code.
read_file- Read a text file from a sandbox.
write_file- Write a text file in a sandbox (parent directories are created).
list_files- List a directory in a sandbox.
get_url- Public URL for a port inside a sandbox.
set_timeout- Keep a sandbox alive for timeoutSec more seconds from now.
list_sandboxes- List sandboxes the router created (live ones, or all with all=true), with provider and cost so far.
kill_sandbox- Stop and delete a sandbox.
move_sandbox- Move a running sandbox to a new box: its workdir is copied over, then the old box is killed. Returns the new sandbox (a new id).
run_job- Run shell steps in a sandbox. The workdir is saved after each step; when the box dies, its provider refuses, or it runs out of time or free credit, the job continues on another box from the last saved step. Waits up to waitSec for the end, then returns the state, where it ran, how often it moved, and the output of the last step that succeeded and of the step that failed it, if one did. A job still running then goes on: poll job_status with its id.
list_jobs- List jobs (unfinished ones, or all with all=true): state, steps done, current provider and moves.
job_status- Where a job stands: state, steps done, its boxes and why each ended, recent history, and the output of the last step that succeeded and of the step that failed it, if one did.
resume_job- Take over a queued or orphaned job (its runner died) and drive it on from where it was recorded. Waits up to waitSec like run_job. A job that already ended is returned as it ended.
cancel_job- Cancel a job and kill its box. A job that already ended is returned as it ended.