Skip to content

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.

Server URL
https://api.sandboxplease.com/mcp

Claude 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.

Terminal
claude mcp add --transport http sandboxplease https://api.sandboxplease.com/mcp

With an API key

For CI and claude -p. Your shell expands $SANDBOXPLEASE_API_KEY, so the key is saved in Claude Code's config.

Terminal
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.

Remote MCP server URL
https://api.sandboxplease.com/mcp

As 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.

claude_desktop_config.json
{
  "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.

~/.cursor/mcp.json
{
  "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.

~/.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.

mcp.json
{
  "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.

mcp.json
{
  "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.

opencode.json
{
  "$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.

opencode.json
{
  "$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.

Terminal
codex mcp add sandboxplease --url https://api.sandboxplease.com/mcp

With an API key

Or add the table to ~/.codex/config.toml. Codex reads the key from your environment at start.

Terminal
codex mcp add sandboxplease --url https://api.sandboxplease.com/mcp \
  --bearer-token-env-var SANDBOXPLEASE_API_KEY
~/.codex/config.toml
[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.

mcp_config.json
{
  "mcpServers": {
    "sandboxplease": {
      "serverUrl": "https://api.sandboxplease.com/mcp"
    }
  }
}

With an API key

Windsurf reads the key from your environment.

mcp_config.json
{
  "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.

Terminal
curl -fsSL https://sandboxplease.com/install | sh
sp login
sp mcp   # the command your client starts

To 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.

ToolWhat it does
create_sandboxStart a sandbox. No arguments picks the best healthy provider; routing options match the API.
execRun a shell command and get exit_code, stdout and stderr.
write_fileCreate or overwrite a file. Parent directories are created.
read_fileRead a file: text as utf8, anything else as base64, up to 256 KB.
list_filesList the files and directories under a path.
get_port_urlPublic HTTPS URL for a port, e.g. a dev server started with exec.
pausePause a sandbox: billing stops, files and memory are kept.
resumeResume a paused sandbox where it left off.
snapshot_sandboxCapture a running sandbox's files (and memory on fork providers); it keeps running.
fork_sandboxStart 1 to 20 copies of a snapshot in parallel, on its provider and size.
list_snapshotsSnapshots ready to fork, with their storage cost and expiry.
delete_snapshotDelete a snapshot for good; its copies keep running.
kill_sandboxStop a sandbox for good and return its final cost.
kill_all_sandboxesKill every sandbox the key reaches, in one call: for when an agent lost track.
list_sandboxesSandboxes still running or paused, newest first.
quote_sandboxWhat create_sandbox would run and cost, nothing started: call it before GPUs or large sizes.
catalogEvery provider with features, regions, cold start, uptime and price per size.
balanceCredit 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.

Tool result · isError
{
  "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.