Skip to content
sandboxrouting

The four surfaces

From README.md, rendered when the site was built.

All four share one ledger (~/.sandboxrouting/ledger.json; SBR_HOME moves it). It is locked for every update and written whole, so the CLI, the REST server and an MCP server running at once agree on what is live and what is spent.

SDK: create, connect(id), list, kill, status, plan, sweep, move(id), strategies(), registerStrategy(s), and jobs (run, submit, resume, get, list, cancel, workspace, sweep). A sandbox has:

  • commands.run(cmd, {cwd, env, timeoutSec, onStdout, onStderr})
  • files.read, files.readBytes, files.write, files.list
  • getUrl(port), setTimeout(sec), pause(), resume(), kill()

connect("e2b:abc123") adopts a sandbox created outside the router.

CLI: sbr --help.

sbr providers                 # free-tier status, health and circuit of every provider
sbr check                     # live create/exec/files/kill on every configured free provider
sbr route --needs ports       # where a sandbox would go, and why the others were skipped
sbr route --compare           # the same request under every strategy
sbr strategies                # the strategies, and which one is active
sbr run -- python3 -c 'print(42)'          # create, run, kill; exit code passes through
id=$(sbr create --image node:22 --timeout 900 --strategy fastest)
sbr exec "$id" -- npm test
sbr move "$id"                # copy its workdir to a new box, kill the old one
sbr kill "$id"
sbr job run --step "make" --step "make test"   # steps that survive losing a box
sbr job status <job-id>       # where it ran, why it moved, how each step ended
sbr job download <job-id>     # the final workdir, as a .tgz

REST API: sbr serve --port 8787. Set serverToken in config (or SBR_SERVER_TOKEN) to require Authorization: Bearer …. The endpoints are listed at the top of src/server/http.ts: POST /v1/sandboxes, POST /v1/sandboxes/{id}/exec, GET|PUT /v1/sandboxes/{id}/files?path=, GET /v1/providers, POST /v1/route[?compare=1], GET /v1/strategies, POST /v1/sandboxes/{id}/move, and the jobs: POST /v1/jobs (202 with the job's id; ?wait=1 to wait for the end), GET /v1/jobs[/{id}], POST /v1/jobs/{id}/resume|cancel, GET /v1/jobs/{id}/workspace. Every 5 minutes the server reconciles with the providers, reaps boxes left behind by finished jobs, and resumes orphaned jobs. POST /v1/sweep does it on demand and returns { sandboxes, jobs }.

MCP server: sbr mcp (stdio). Its tools are list_providers, list_strategies, create_sandbox, run_command, read_file, write_file, list_files, get_url, set_timeout, move_sandbox, list_sandboxes, kill_sandbox, and for jobs run_job, job_status, list_jobs, resume_job and cancel_job. run_job waits up to waitSec, then returns the job's id to poll with job_status. For Claude Code:

claude mcp add sandboxes -- npx -y sandboxrouting mcp

Other clients take the same command (npx -y sandboxrouting mcp) in their MCP config, with your provider keys in its env. From a clone, node /path/to/sandboxrouting/dist/cli.js mcp runs the local build instead. The server is listed in the MCP Registry as com.sandboxrouting/sandboxrouting.