Local or Hosted MCP for Cursor, Claude Code and Codex?
Updated November 11, 2026 .md
Short answer: Use the hosted server at https://sandboxer.com/mcp if you want nothing to install, browser sign-in, or web clients like claude.ai and ChatGPT. Use the local stdio server (sbx mcp or npx -y sandboxer-mcp) if you want default sizes and auto-stop for every sandbox, or the handoff_session tool. Both create the same cloud microVMs.
The decision#
Both servers call the same Sandboxer API, so the sandboxes are the same: Ubuntu microVMs that run in Sandboxer's cloud, never on your laptop. The difference is where the MCP process runs and how it signs in.
Hosted (https://sandboxer.com/mcp) |
Local stdio (sbx mcp / npx -y sandboxer-mcp) |
|
|---|---|---|
| Transport | Streamable HTTP | stdio (the client starts it as a subprocess) |
| Install | Nothing | The sbx CLI, or Node for npx |
| Auth | Browser sign-in (OAuth), or Authorization: Bearer <key> |
sbx login, or SANDBOXER_API_KEY in the server's environment |
| Works in claude.ai and ChatGPT | Yes | No (web clients can't start a local process) |
| Tools | 20 | 21: the same 20 plus handoff_session |
| Version | Always the current release | The sbx you run; an old one adds an "out of date" note to every tool result |
| Defaults for new sandboxes | Set by the agent per call | --type and --ttl flags apply to every create |
| Connect (in our test, 2026-11-11) | initialize 92–99 ms |
sbx mcp: 3 ms. npx: 300–330 ms warm, 5.8 s on the first run (it downloads sbx) |
| Each tool call (in our test, 2026-11-11) | list_sandboxes 29–30 ms |
First call 95–99 ms, then 28–29 ms |
Pick hosted when you switch between machines, use a web client, or don't want a binary on your PATH. Pick local when the CLI is already installed and signed in, when you want sbx mcp --type small --ttl 1800 to cap what the agent creates, or when you want the agent to move its own Claude Code or Codex session into a sandbox with handoff_session.
What we measured#
We drove both servers with raw JSON-RPC (initialize, then tools/list, then tool calls) from a Linux machine in Miami against production on 2026-11-11, with an API key in SANDBOXER_API_KEY. These are a few runs each, so treat the numbers as single measurements, not benchmarks. The local server, run as sbx mcp:
initialize: 3 ms (including process start) {"name":"sandboxer","title":"Sandboxer","version":"aa440e9a"} protocol 2025-06-18
tools/list: 0 ms 21 tools: create_sandbox, create_task, task_status, list_sandboxes, get_sandbox, exec, command_status, kill_command, read_file, write_file, host_port, stop_sandbox, resume_sandbox, extend_sandbox, rename_sandbox, label_sandbox, delete_sandbox, save_snapshot, list_snapshots, delete_snapshot, handoff_session
list_sandboxes: 98 ms
list_sandboxes: 29 ms
list_sandboxes: 29 ms
create_sandbox: 204 ms Sandbox sb_caabq7uri9 is ready. URL: https://candid-serene-saffron.box.sandboxer.com. …
exec: 70 ms "Exit code 0.\n\nstdout:\nLinux 6.18.56-sandboxer\n2"
delete_sandbox: 29 ms Deleting sb_caabq7uri9: its disk, memory and automatic snapshots are removed.The same server through npx -y sandboxer-mcp, on a machine without sbx and with an empty npm cache:
sandboxer-mcp: downloading sbx-linux-amd64 (aa440e9a) from https://sandboxer.com/dl
initialize: 5849 ms (including process start) {"name":"sandboxer","title":"Sandboxer","version":"aa440e9a"} protocol 2025-06-18
tools/list: 0 ms 21 tools: create_sandbox, create_task, task_status, … delete_snapshot, handoff_sessionThe next two launches took 327 ms and 300 ms to initialize. The hosted server, with the key sent as a bearer token:
no key: 401 WWW-Authenticate: Bearer resource_metadata="https://sandboxer.com/.well-known/oauth-protected-resource/mcp", scope="sandboxer"
initialize: 99 ms 200 application/json {"name":"sandboxer","title":"Sandboxer","version":"aa440e9a"} protocol 2025-06-18 session: yes
tools/list: 30 ms 20 tools: create_sandbox, create_task, task_status, list_sandboxes, get_sandbox, exec, command_status, kill_command, read_file, write_file, host_port, stop_sandbox, resume_sandbox, extend_sandbox, rename_sandbox, label_sandbox, delete_sandbox, save_snapshot, list_snapshots, delete_snapshot
list_sandboxes: 29 ms
list_sandboxes: 29 ms
list_sandboxes: 30 ms
create_sandbox: 176 ms Sandbox sb_h1vx3my5y6 is ready. URL: https://topaz-active-cherry.box.sandboxer.com. …
exec: 61 ms "Exit code 0.\n\nstdout:\nLinux 6.18.56-sandboxer\n2"
delete_sandbox: 31 ms Deleting sb_h1vx3my5y6: its disk, memory and automatic snapshots are removed.What this means in practice:
- Per-call speed is the same. After the first call, both took about 30 ms. The local server's first call is slower because it opens a TLS connection to the API.
- The tool lists match except for one tool. Both have
create_taskandtask_status, which run a coding agent on a connected GitHub repo and end in a pull request. Only the local server hashandoff_session. npxcosts startup time. In our test, each launch spent about a third of a second resolving the package, and the first launch downloadssbx. Ifsbxis already on yourPATH,sandboxer-mcpruns that one instead: with our CLI on thePATH, the firstnpxlaunch took 519 ms and printed no download line.- Sandbox creation was quick both ways.
create_sandboxreturned a readysmallsandbox in 176 to 204 ms in our test. It depends on the machine and on load, not the transport. On October 27, 2026 the same calls took 3 to 6 seconds; see start, resume and fork times. - The unauthenticated
401is how OAuth starts. Clients readresource_metadataand open the sign-in page.
When the local server is out of date#
The hosted server is always the current release. The local server is whatever sbx you run. If it's older than the current release, the MCP docs say every tool result ends with a note such as Note: sbx 5750b620 is out of date; run sbx update (9eff74cd). The agent sees it, and the server may lack newer tools or options until you update. Run sbx update (an alias of sbx self-update) and restart the client. Our sbx was current (aa440e9a, the same version /healthz reported), and no note appeared in any tool result.
Claude Code#
Claude Code's syntax is in its MCP docs. Hosted, signing in with your Sandboxer account:
claude mcp add --transport http --scope user sandboxer https://sandboxer.com/mcp
# then, inside Claude Code: /mcp, choose sandboxer, and sign inLocal, using your sbx login, with defaults for every sandbox the agent creates:
claude mcp add --scope user sandboxer -- sbx mcp --type small --ttl 1800Local without the CLI. Claude Code passed its own environment to stdio servers when we checked, so export SANDBOXER_API_KEY in the shell that starts claude:
claude mcp add --scope user sandboxer -- npx -y sandboxer-mcpHosted with a key, shared with a project in .mcp.json. The single quotes keep ${SANDBOXER_API_KEY} literal, and Claude Code fills it in from the environment, so the key never lands in the file:
claude mcp add-json --scope project sandboxer '{"type":"http","url":"https://sandboxer.com/mcp","headers":{"Authorization":"Bearer ${SANDBOXER_API_KEY}"}}'What claude mcp list showed in Claude Code 2.1.322 with all four in a scratch config (each under its own name), run from a shell without SANDBOXER_API_KEY:
sandboxer: https://sandboxer.com/mcp (HTTP) - ! Needs authentication
sandboxer-local: sbx mcp --type small --ttl 1800 - ✔ Connected
sandboxer-npx: npx -y sandboxer-mcp - ✔ Connected
sandboxer-key: https://sandboxer.com/mcp (HTTP) - ⏸ Pending approval (run `claude` to approve)
…
[Contains warnings] Project config (shared via .mcp.json)
└ [Warning] [sandboxer-key] mcpServers.sandboxer-key: Missing environment variables: SANDBOXER_API_KEYNeeds authentication is expected for the OAuth entry until you run /mcp, or claude mcp login sandboxer from your shell. The missing-variable warning means the key wasn't set: Claude Code still loads the entry but sends the ${SANDBOXER_API_KEY} text unexpanded, so export the key before starting claude. A project .mcp.json server waits for you to approve it the first time claude starts in that directory. ✔ Connected only means the process started; a local server with no credentials still connects and prints not signed in to stderr.
Codex#
Codex's syntax is in its MCP docs (the old developers.openai.com/codex/mcp link redirects there). Servers go in ~/.codex/config.toml, or .codex/config.toml in a trusted project. Hosted with a key:
codex mcp add sandboxer --url https://sandboxer.com/mcp --bearer-token-env-var SANDBOXER_API_KEY--bearer-token-env-var is in codex mcp add --help (codex-cli 0.167.1) but not on the docs page; the page documents the resulting bearer_token_env_var key. Leave it out and run codex mcp login sandboxer (add --no-browser without a local browser) to sign in instead. Local, using your sbx login:
codex mcp add sandboxer -- sbx mcp --type small --ttl 1800The resulting config, and what codex mcp list printed on codex-cli 0.167.1:
[mcp_servers.sandboxer]
url = "https://sandboxer.com/mcp"
bearer_token_env_var = "SANDBOXER_API_KEY"
[mcp_servers.sandboxer-local]
command = "sbx"
args = ["mcp", "--type", "small", "--ttl", "1800"]Name Command Args Env Cwd Status Auth
sandboxer-local sbx mcp --type small --ttl 1800 - - enabled Unsupported
Name Url Bearer Token Env Var Status Auth
sandboxer https://sandboxer.com/mcp SANDBOXER_API_KEY enabled Bearer tokenWith npx, forward the key explicitly. Codex's docs describe env_vars as the variables "to allow and forward" to a stdio server. In our October 27 test (codex-cli 0.164.0), a server started by Codex saw HOME but not SANDBOXER_API_KEY until we listed it there. Don't use --env SANDBOXER_API_KEY=... on the command line: that writes the key itself into config.toml.
[mcp_servers.sandboxer]
command = "npx"
args = ["-y", "sandboxer-mcp"]
env_vars = ["SANDBOXER_API_KEY"]Cursor#
Cursor's format is in its MCP docs. Use ~/.cursor/mcp.json for every project, or .cursor/mcp.json for one. Hosted, with Cursor opening the Sandboxer sign-in page when it connects:
{
"mcpServers": {
"sandboxer": { "url": "https://sandboxer.com/mcp" }
}
}Hosted with a key. Cursor fills in ${env:…} from your environment:
{
"mcpServers": {
"sandboxer": {
"url": "https://sandboxer.com/mcp",
"headers": { "Authorization": "Bearer ${env:SANDBOXER_API_KEY}" }
}
}
}Local, with the CLI or with npx:
{
"mcpServers": {
"sandboxer": { "command": "sbx", "args": ["mcp", "--type", "small", "--ttl", "1800"] },
"sandboxer-npx": {
"command": "npx",
"args": ["-y", "sandboxer-mcp"],
"env": { "SANDBOXER_API_KEY": "${env:SANDBOXER_API_KEY}" }
}
}
}Cursor needs the command on its PATH or as a full path. A desktop app doesn't always inherit your shell's PATH, so use the output of which sbx if Cursor can't find it. Cursor's docs say it fills in ${env:NAME} in command, args, env, url and headers, and signs in to remote servers with OAuth (authorization code with PKCE). Its field table also lists a type of "stdio" for local servers, though its own examples leave it out. We didn't have Cursor on the test machine, so we didn't run these files; they follow Cursor's documented format.
Check it works#
Restart or reconnect the client, then ask the agent:
Create a small Sandboxer sandbox, run `uname -sr && nproc` in it, show me the output, then delete it.The agent calls create_sandbox, exec and delete_sandbox, the same three calls timed above. delete_sandbox always needs the explicit sandbox id, so the agent can't delete one by accident with a default.
FAQ#
Do the local and hosted servers create different sandboxes?#
No. Both call the same API with your account, and the sandboxes bill to the same wallet. list_sandboxes in either one shows sandboxes created by the other.
Which one should a CI job or headless agent use?#
Either, with an API key in SANDBOXER_API_KEY, because neither can open a browser there. A scoped key such as the ci preset limits what the agent can do, tool by tool.
Why does the local server have one more tool?#
handoff_session moves the Claude Code or Codex session on your machine into a new sandbox. It needs your local files and session, so it only exists in sbx mcp.
Can an agent open a pull request through either server?#
Yes. Both list create_task, which runs a coding agent on a GitHub repo in its own sandbox and opens a pull request, and task_status, which reports its progress. The repo must be connected first (the Sandboxer GitHub App installed on it). We listed these tools but didn't run a task for this page.
How long do sandboxes created through MCP run?#
They stop after an hour unless ttlSeconds says otherwise. With the local server, --ttl changes that default for every create. A stopped sandbox bills no running time.
Will my key end up in a config file?#
Not with the configs above. Each one reads the key from an environment variable at run time. The risky forms are Claude Code's --header with a shell-expanded key and --env KEY=value in Claude Code or Codex, which write the value itself.
Related#
More guides
For running AI-written code we rank Sandboxer, Freestyle and E2B first: each gives code its own VM with an API or SDK and can pause with memory. Pick Daytona for Windows or GPUs, Modal or Northflank for GPUs at scale, E2B or Northflank to run in your own cloud, and Vercel Sandbox if your app lives on Vercel.
For coding agents we rank Sandboxer first: a full Ubuntu VM with Claude Code and Codex preinstalled, Docker, and stop-and-resume that keeps the agent's session in memory. Freestyle and Amp Orbs also keep memory across pauses. Pick E2B for prebuilt agent templates on open source, Docker Sandboxes for free local runs, and Codespaces if you live in GitHub.
The best Daytona alternatives depend on why you're switching. For a full Linux microVM on every sandbox with memory-saving stop and Docker, we rank Sandboxer first. E2B suits open source and self-hosting, Modal massive short-job fleets, Northflank bring-your-own-cloud with GPUs, and Vercel Sandbox apps on Vercel.
If you're leaving E2B for longer sessions or a fuller machine, we rank Sandboxer first, then Freestyle: both give each sandbox a full Linux VM that keeps memory across pauses, with Docker and no short session cap. Pick Daytona for Windows or GPUs, Northflank for bring-your-own-cloud, and stay on E2B if you need open source.