Skip to main content

OpenSandbox MCP Sandbox Server

1. Overview

OpenSandbox MCP Server exposes the OpenSandbox Python SDK as MCP tools for Claude Code, Cursor, and other MCP-capable clients. It provides focused sandbox lifecycle management, command execution, and text file operations.

2. Installation & Startup

Source

uv sync
uv run opensandbox-mcp

Package

pip install opensandbox-mcp
opensandbox-mcp

Configuration

Environment variables:

  • OPEN_SANDBOX_API_KEY
  • OPEN_SANDBOX_DOMAIN

CLI overrides:

opensandbox-mcp --api-key ... --domain ... --protocol https

Config fields:

  • api_key: OpenSandbox API key for authentication.
  • domain: OpenSandbox API domain, for example api.opensandbox.io.
  • protocol: http or https for API requests.
  • request_timeout_seconds: HTTP request timeout in seconds.
  • transport: stdio by default, or streamable-http.
  • use-server-proxy: when present, forces the SDK client to use server proxy mode.

Streamable HTTP

opensandbox-mcp \
  --transport streamable-http \
  --host 0.0.0.0 \
  --port 8000

The HTTP transport defaults to 127.0.0.1:8000. Set --host 0.0.0.0 when the MCP server must be reached from another container, and use --port to select a different listening port. Keep the default loopback host unless the container network or an upstream gateway protects the exposed endpoint.

3. Integrations

Claude Code stdio

claude mcp add opensandbox-sandbox --transport stdio -- \
  opensandbox-mcp --api-key "$OPEN_SANDBOX_API_KEY" --domain "$OPEN_SANDBOX_DOMAIN"

Claude Code http

claude mcp add opensandbox-sandbox --transport http http://localhost:8000/mcp

Cursor stdio

{
  "mcpServers": {
    "opensandbox-sandbox": {
      "command": "opensandbox-mcp",
      "args": [
        "--api-key",
        "${OPEN_SANDBOX_API_KEY}",
        "--domain",
        "${OPEN_SANDBOX_DOMAIN}"
      ]
    }
  }
}

Cursor http

{
  "mcpServers": {
    "opensandbox-sandbox": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

4. Tools

Notes:

  • All tools operate on a sandbox_id returned by sandbox_create or sandbox_connect.
  • file_read/file_write are text-only; use encoding and range_header for large files.

Sandbox

  • sandbox_create: create a new sandbox and register it locally
  • sandbox_connect: attach to an existing sandbox and register it locally
  • sandbox_kill: terminate a sandbox by ID
  • sandbox_get_info: fetch sandbox info by ID
  • sandbox_list: list sandboxes with optional filter object
  • sandbox_renew: extend sandbox expiration
  • sandbox_healthcheck: check if sandbox is healthy
  • sandbox_get_metrics: get resource metrics
  • sandbox_get_endpoint: get network endpoint for a port

Command Execution

  • command_run: run a command inside a sandbox
  • command_get_status: get a command's running state, exit code, and error
  • command_get_logs: read combined stdout/stderr of a background command, with an optional cursor for incremental reads
  • command_interrupt: interrupt a running command

Filesystem

  • file_read: read a text file
  • file_write: write a text file
  • file_delete: delete files
  • file_search: search for files by glob
  • file_create_directories: create directories
  • file_delete_directories: delete directories
  • file_move: move/rename files or directories
  • file_replace_contents: replace file content

5. Minimal Workflow

  1. sandbox_create -> keep the sandbox_id.
  2. file_write code or assets into the sandbox.
  3. command_run to execute, install dependencies, or start a service.
  4. sandbox_get_endpoint if you expose a port.
  5. sandbox_kill when finished.

Background Commands

  1. command_run with background=true -> keep the execution id.
  2. command_get_status until running is false; check exit_code and error.
  3. Between status checks, command_get_logs with the cursor from the previous call to read only new output.
  4. After running is false, call command_get_logs once more to read the remaining output.
  5. command_interrupt to stop a command early.

The cursor is a server-side position: pass back the returned value instead of computing it from the content length. Empty content does not mean the command finished.

6. Usage Examples

Here are some examples of what you can ask an LLM to do:

  • "Create a Python sandbox and run a quick health command."
  • "Write a Python script into the sandbox and run it."
  • "Download a GitHub repo, install dependencies, and run its tests."
  • "Run the test suite in the background, report progress, and tell me whether it passed."
  • "Generate a CSV file with fake sales data and run a simple summary script."
  • "Start a tiny web server on port 8000 and return the public URL."
  • "Build a minimal REST API (hello + health) and expose it on port 8000."
  • "Create a tar.gz of /app and report the file size."
  • "Build a simple Snake game and return the web endpoint where it can be accessed."

Metadata

Release files for opensandbox-mcp 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opensandbox-mcp 1.2.1
File Size Uploaded Provenance Actions
opensandbox_mcp-1.2.1.tar.gz 18.2 kB Without provenance Details for opensandbox_mcp-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opensandbox-mcp 1.2.1
File Interpreter ABI Platform Actions
opensandbox_mcp-1.2.1-py3-none-any.whl Python 3 none any Details for opensandbox_mcp-1.2.1-py3-none-any.whl

Total release size: 39.0 kB

Release files / opensandbox_mcp-1.2.1.tar.gz

Download URL opensandbox_mcp-1.2.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fad0dcccf779a4ca3d427f226f25959b3d2784ee6fd0d94353095e84931b4a80
BLAKE2b-256 checksum
How to use checksums
d542808b621ee7ce6b539062b3dd2a9f7e61c45d21693a72216ceaba0b63dd39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / opensandbox_mcp-1.2.1-py3-none-any.whl

Download URL opensandbox_mcp-1.2.1-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9e81cf37407ecaebca4d32995a463454ca772d83490128c28e9c7a130f50a4a
BLAKE2b-256 checksum
How to use checksums
d2aa2ea82f876e9947c92ed1587e0ae238553c30f65fa0b49577dc0ca23039b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for opensandbox-mcp 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page