Agents
MCP server
Give any MCP client sandboxes to run code in: one URL, your API key, every provider.
Connect
Most clients sign in with your browser: add the server URL, approve the client on SandboxPlease, and it gets its own API key with a $10 monthly limit. You can change the limit or revoke the key in Settings → Keys. For CI and other headless runs, send a key you created there as Authorization: Bearer instead.
https://api.sandboxplease.com/mcpClaude Code
Sign in with your browser
Add the server, then run /mcp in Claude Code, pick sandboxplease and choose Authenticate. Add --scope user to use it in every project.
claude mcp add --transport http sandboxplease https://api.sandboxplease.com/mcpWith an API key
For CI and claude -p. Your shell expands $SANDBOXPLEASE_API_KEY, so the key is saved in Claude Code's config.
claude mcp add --transport http sandboxplease https://api.sandboxplease.com/mcp \
--header "Authorization: Bearer $SANDBOXPLEASE_API_KEY"Claude Desktop
Sign in with your browser
Settings → Connectors → Add custom connector. Name it SandboxPlease, paste the server URL, then Connect.
https://api.sandboxplease.com/mcpAs a local server
Settings → Developer → Edit Config opens claude_desktop_config.json. sp mcp uses the key from sp login, so none goes in the file. Use the full path which sp prints, then restart Claude Desktop.
{
"mcpServers": {
"sandboxplease": {
"command": "/Users/you/.local/bin/sp",
"args": [
"mcp"
]
}
}
}Cursor
Sign in with your browser
Add it to ~/.cursor/mcp.json, then click Needs login next to sandboxplease in Settings → MCP.
{
"mcpServers": {
"sandboxplease": {
"url": "https://api.sandboxplease.com/mcp"
}
}
}With an API key
Paste your key in ~/.cursor/mcp.json, which stays on your machine, unlike a project's .cursor/mcp.json.
{
"mcpServers": {
"sandboxplease": {
"url": "https://api.sandboxplease.com/mcp",
"headers": {
"Authorization": "Bearer sp-v1-…"
}
}
}
}VS Code
Sign in with your browser
Add it to .vscode/mcp.json, or run MCP: Open User Configuration. VS Code asks you to sign in when it starts the server.
{
"servers": {
"sandboxplease": {
"type": "http",
"url": "https://api.sandboxplease.com/mcp"
}
}
}With an API key
VS Code asks for the key once and stores it securely.
{
"inputs": [
{
"type": "promptString",
"id": "sandboxplease-key",
"description": "SandboxPlease API key",
"password": true
}
],
"servers": {
"sandboxplease": {
"type": "http",
"url": "https://api.sandboxplease.com/mcp",
"headers": {
"Authorization": "Bearer ${input:sandboxplease-key}"
}
}
}
}OpenCode
Sign in with your browser
Add it to opencode.json in your project or ~/.config/opencode/opencode.json, then run opencode mcp auth sandboxplease.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"sandboxplease": {
"type": "remote",
"url": "https://api.sandboxplease.com/mcp"
}
}
}With an API key
OpenCode reads the key from your environment.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"sandboxplease": {
"type": "remote",
"url": "https://api.sandboxplease.com/mcp",
"headers": {
"Authorization": "Bearer {env:SANDBOXPLEASE_API_KEY}"
}
}
}
}Codex
Sign in with your browser
Codex opens the sign-in page as soon as you add the server. Run codex mcp login sandboxplease to sign in again.
codex mcp add sandboxplease --url https://api.sandboxplease.com/mcpWith an API key
Or add the table to ~/.codex/config.toml. Codex reads the key from your environment at start.
codex mcp add sandboxplease --url https://api.sandboxplease.com/mcp \
--bearer-token-env-var SANDBOXPLEASE_API_KEY[mcp_servers.sandboxplease]
url = "https://api.sandboxplease.com/mcp"
bearer_token_env_var = "SANDBOXPLEASE_API_KEY"Windsurf
Sign in with your browser
Cascade → MCP menu → Open MCP config file opens mcp_config.json. Save, refresh the MCP list and sign in when asked.
{
"mcpServers": {
"sandboxplease": {
"serverUrl": "https://api.sandboxplease.com/mcp"
}
}
}With an API key
Windsurf reads the key from your environment.
{
"mcpServers": {
"sandboxplease": {
"serverUrl": "https://api.sandboxplease.com/mcp",
"headers": {
"Authorization": "Bearer ${env:SANDBOXPLEASE_API_KEY}"
}
}
}
}Other clients
A client that speaks Streamable HTTP needs only the server URL when it supports OAuth, or the URL and an Authorization: Bearer header otherwise. A client that only starts local servers runs sp mcp, which serves the same tools over stdio with the key from sp login or SANDBOXPLEASE_API_KEY.
curl -fsSL https://sandboxplease.com/install | sh
sp login
sp mcp # the command your client startsTo give sandboxes to an agent you write yourself, see the framework integrations.
Tools
Every tool takes the sandbox id returned by create_sandbox. Outputs are JSON, so the model reads exit codes, costs and end reasons as fields.
| Tool | What it does |
|---|---|
create_sandbox | Start a sandbox. No arguments picks the best healthy provider; routing options match the API. |
exec | Run a shell command and get exit_code, stdout and stderr. |
write_file | Create or overwrite a file. Parent directories are created. |
read_file | Read a file: text as utf8, anything else as base64, up to 256 KB. |
list_files | List the files and directories under a path. |
get_port_url | Public HTTPS URL for a port, e.g. a dev server started with exec. |
pause | Pause a sandbox: billing stops, files and memory are kept. |
resume | Resume a paused sandbox where it left off. |
snapshot_sandbox | Capture a running sandbox's files (and memory on fork providers); it keeps running. |
fork_sandbox | Start 1 to 20 copies of a snapshot in parallel, on its provider and size. |
list_snapshots | Snapshots ready to fork, with their storage cost and expiry. |
delete_snapshot | Delete a snapshot for good; its copies keep running. |
kill_sandbox | Stop a sandbox for good and return its final cost. |
kill_all_sandboxes | Kill every sandbox the key reaches, in one call: for when an agent lost track. |
list_sandboxes | Sandboxes still running or paused, newest first. |
quote_sandbox | What create_sandbox would run and cost, nothing started: call it before GPUs or large sizes. |
catalog | Every provider with features, regions, cold start, uptime and price per size. |
balance | Credit balance, and this key's spending limit and usage. |
Idle sandboxes
Agents forget to clean up. A sandbox created over MCP is killed after 10 minutes without a tool call on it, and billing stops at its last call. Pass idle_timeout (seconds) to create_sandbox to keep it longer, and timeout to cap its total lifetime. Such a sandbox shows the end reason idle in Logs.
Long outputs keep their first 4,000 and last 12,000 characters per stream, so a build log still ends with its error. Redirect anything longer to a file and read it with read_file or exec and grep.
Errors
A failed tool call returns the same code and hint as the API, so the agent knows what to do next. A request without a valid key answers HTTP 401 before any tool runs, with a WWW-Authenticate header that starts the browser sign-in in clients that support it.
{
"error": {
"code": "not_found",
"message": "Sandbox sbx_7f3a9c21e4b05d68a1c2 not found",
"hint": "Check the id. GET /v1/sandboxes lists the sandboxes that are still running or paused.",
"docs_url": "https://sandboxplease.com/docs/errors#not_found",
"request_id": "req_ea8a463f20e2253fb6db9dab"
}
}Every code is listed in Errors.