opensandbox-mcp

v1.3.0
opensandbox-mcp Checked 3 hours ago Published 1 day ago

OpenSandbox MCP Sandbox Server (Python)

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

sandbox_create

Create a sandbox and store it in the MCP server session. This allocates a new sandbox instance using the OpenSandbox API and tracks it locally so subsequent tool calls can reuse it. Parameters: image: Container image reference (e.g., "python:3.11"). ctx: MCP context for progress reporting (optional). auth_username: Registry username for private images. auth_password: Registry password/token for private images. timeout_seconds: Sandbox lifetime in seconds (absolute TTL). ready_timeout_seconds: Max…

ParameterTypeDescription
image *string
auth_password
auth_username
entrypoint
env
extensions
health_check_polling_interval_msinteger
metadata
network_policy
ready_timeout_secondsnumber
resource
skip_health_checkboolean
timeout_secondsnumber

sandbox_connect

Connect to an existing sandbox and store it locally. Use this when a sandbox already exists and you want to use it in this MCP server session without creating a new one. Parameters: sandbox_id: Existing sandbox identifier. connect_timeout_seconds: Max time to wait for readiness. health_check_polling_interval_ms: Interval between health checks in ms. skip_health_check: If True, return before readiness checks complete. Returns: SandboxInfoResponse with: sandbox_id: The sandbox identifie…

ParameterTypeDescription
sandbox_id *string
connect_timeout_secondsnumber
health_check_polling_interval_msinteger
skip_health_checkboolean

sandbox_kill

Terminate a sandbox by ID and remove it from local registry. Parameters: sandbox_id: Target sandbox identifier. Returns: {"status": "killed"} when successful.

ParameterTypeDescription
sandbox_id *string

sandbox_get_info

Fetch sandbox info by ID. Parameters: sandbox_id: Target sandbox identifier. Returns: Sandbox info dict from the SDK.

ParameterTypeDescription
sandbox_id *string

sandbox_list

List sandboxes matching filter criteria. Parameters: ctx: MCP context for progress reporting (optional). filter: SandboxFilter object (states, metadata, page, page_size). Returns: Paginated sandbox list.

ParameterTypeDescription
filter

sandbox_renew

Set the sandbox to expire timeout_seconds from now. This replaces the current expiration time instead of adding to it, so a value smaller than the remaining lifetime shortens the sandbox's life. Call sandbox_get_info first and compare expires_at if you only want to extend it. Parameters: sandbox_id: Target sandbox identifier. timeout_seconds: Seconds from now until the sandbox expires. Returns: Renew response dict including new expiration time.

ParameterTypeDescription
sandbox_id *string
timeout_seconds *number

sandbox_get_metrics

Get resource metrics for a sandbox. Parameters: sandbox_id: Target sandbox identifier. connect_if_missing: Connect if sandbox not in local registry. Returns: Metrics dict.

ParameterTypeDescription
sandbox_id *string
connect_if_missingboolean

sandbox_healthcheck

Check if a sandbox is healthy. Parameters: sandbox_id: Target sandbox identifier. connect_if_missing: Connect if sandbox not in local registry. Returns: {"sandbox_id": "...", "healthy": true|false}.

ParameterTypeDescription
sandbox_id *string
connect_if_missingboolean

command_run

Run a command inside a sandbox. Parameters: sandbox_id: Target sandbox identifier. command: Shell command to execute (supports pipes/redirects). background: If True, run asynchronously and return immediately. working_directory: Working directory for the command. connect_if_missing: Connect if sandbox not in local registry. Returns: Execution result with id, exit code, and streamed logs; timing lives on the ``complete`` event (``execution_time_in_millis``). Example: result =…

ParameterTypeDescription
command *string
sandbox_id *string
backgroundboolean
connect_if_missingboolean
working_directory

command_interrupt

Interrupt a running command execution. Parameters: sandbox_id: Target sandbox identifier. execution_id: Execution identifier to interrupt. connect_if_missing: Connect if sandbox not in local registry. Returns: {"status": "interrupted"} when successful.

ParameterTypeDescription
execution_id *string
sandbox_id *string
connect_if_missingboolean

command_get_status

Get the status of a command started by command_run. Works for both foreground and background executions. Parameters: sandbox_id: Target sandbox identifier. execution_id: Execution identifier returned by command_run. connect_if_missing: Connect if sandbox not in local registry. Returns: Command status with running flag, exit code, error, and start/finish timestamps. ``running=False`` means the command has finished; check ``exit_code`` and ``error`` for the outcome. ``running=None`` mea…

ParameterTypeDescription
execution_id *string
sandbox_id *string
connect_if_missingboolean

command_get_logs

Read the combined stdout/stderr of a background command. Pass the returned ``cursor`` back on the next call to read only new output; omit it to read from the start of the log. Treat ``cursor`` as an opaque server-side position and never derive it from the content length. Empty ``content`` does not mean the command finished; use command_get_status for that. Each read returns at most one page of 16 MiB, so once command_get_status reports ``running=False``, keep calling this tool with the last cursor until ``content`` is empty and…

ParameterTypeDescription
execution_id *string
sandbox_id *string
connect_if_missingboolean
cursor

file_read

Read a text file from the sandbox. Parameters: sandbox_id: Target sandbox identifier. path: File path to read. encoding: Text encoding. range_header: Optional byte range header (e.g., "bytes=0-1023"). connect_if_missing: Connect if sandbox not in local registry. Returns: {"path": "...", "content": "..."}.

ParameterTypeDescription
path *string
sandbox_id *string
connect_if_missingboolean
encodingstring
range_header

file_write

Write a text file inside the sandbox. Parameters: sandbox_id: Target sandbox identifier. path: Destination file path. content: File content. encoding: Text encoding. mode: Unix file permissions. owner: Owner username. group: Group name. connect_if_missing: Connect if sandbox not in local registry. Returns: {"status": "written"} when successful.

ParameterTypeDescription
content *string
path *string
sandbox_id *string
connect_if_missingboolean
encodingstring
group
modeinteger
owner

file_delete

Delete files inside the sandbox. Parameters: sandbox_id: Target sandbox identifier. paths: File paths to delete. connect_if_missing: Connect if sandbox not in local registry. Returns: {"status": "deleted"} when successful.

ParameterTypeDescription
paths *array
sandbox_id *string
connect_if_missingboolean

file_create_directories

Create directories inside the sandbox. Parameters: sandbox_id: Target sandbox identifier. entries: List of directory entries (path, mode, owner, group). connect_if_missing: Connect if sandbox not in local registry. Returns: {"status": "created"} when successful.

ParameterTypeDescription
entries *array
sandbox_id *string
connect_if_missingboolean

file_delete_directories

Delete directories inside the sandbox. Parameters: sandbox_id: Target sandbox identifier. paths: Directory paths to delete. connect_if_missing: Connect if sandbox not in local registry. Returns: {"status": "deleted"} when successful.

ParameterTypeDescription
paths *array
sandbox_id *string
connect_if_missingboolean

file_move

Move or rename files/directories inside the sandbox. Parameters: sandbox_id: Target sandbox identifier. entries: List of move entries (source, destination). connect_if_missing: Connect if sandbox not in local registry. Returns: {"status": "moved"} when successful.

ParameterTypeDescription
entries *array
sandbox_id *string
connect_if_missingboolean

file_replace_contents

Replace content inside files. Parameters: sandbox_id: Target sandbox identifier. entries: List of replace entries (path, old_content, new_content). connect_if_missing: Connect if sandbox not in local registry. Returns: List of replacement results with counts per file.

ParameterTypeDescription
entries *array
sandbox_id *string
connect_if_missingboolean

sandbox_get_endpoint

Get a sandbox network endpoint for a specific port. Parameters: sandbox_id: Target sandbox identifier. port: Port number inside the sandbox. connect_if_missing: Connect if sandbox not in local registry. Returns: Endpoint info dict.

ParameterTypeDescription
port *integer
sandbox_id *string
connect_if_missingboolean