# Sandbox Env MCP [Health: Active]

**Category:** ☁️ Cloud Platforms  
**Repository:** https://github.com/hs3434/sandbox-env-mcp  
**GitHub Stars:** 1  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/sandbox-env-mcp

## Description
Persistent Docker/SSH sandbox for AI agents: shell exec, file ops, audit log.

## Tools
Capabilities this server exposes over MCP:

- **shell_exec** — Run a command in a persistent shell.  Blocks until the command finishes (`wait=true`, 10 s timeout) or fire-and-forget with `wait=false`.
- **shell_read** — Read buffered output from a running or finished command.
- **shell_new** — Create a fresh shell on a machine.  Returns a `shell_id`.
- **shell_remove** — Terminate and remove a shell by `shell_id`.
- **shell_list** — List all shells with state, machine, uptime, last command.
- **write_stdin** — Write raw bytes to a running shell — interrupt with Ctrl-C (`\x03`) or feed input to interactive programs like `read` / `Read-Host`.  On Windows/PowerShell, Ctrl-C is unsupported (pipe mode has no terminal driver); kill the shell instead.
- **machine_list** — List all registered machines with backend, status, purpose, shell count.
- **default_set** — Set the default machine or default shell for a machine.
- **file_read** — Read a file with line numbers.  Supports offset + limit pagination.
- **file_write** — Write content atomically.  Creates parent directories automatically.
- **file_patch** — Targeted edits with fuzzy matching. `mode=replace` (find-and-replace) or `mode=patch` (unified diff).
- **file_search** — Search file contents (ripgrep) or find files (glob).  Sorted by modification time.
- **env** — Progressive-discovery portal.  Start with `env(action="help")`.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "sandbox-env-mcp": {
    "command": "uvx",
    "args": ["sandbox-env-mcp"]
  }
}
```

## Documentation

## What Sandbox Env MCP MCP server does

Sandbox Env MCP MCP server provides an MCP interface to working environments backed by Docker containers or remote SSH machines. Agents can keep shell state across calls, work with files, and manage more than one target. A shell can retain environment variables, the current directory, or an activated virtual environment between commands.

The server can start with a default Docker container and persistent bash shell. Its machine registry distinguishes targets, their backends, purposes, status, and shell counts. SSH connections are available for configured Linux or Windows hosts.

## How it works

Shell operations use named sessions. `shell_new` creates a shell and returns a `shell_id`; `shell_exec` runs commands in that session, either waiting for completion or returning while a command continues. `shell_read` retrieves buffered output, and `write_stdin` supplies input or sends Ctrl-C on supported systems. A shell that exits retains its final output but must be removed and replaced before continuing.

Commands that exceed the default wait period can be polled with `shell_read`. Output is capped by a configurable maximum, with excess output represented by the tail. `default_set` chooses the machine or shell used when a tool call does not specify a target.

Docker-backed machines use workspace mounts, and the server can reconcile surviving managed containers when it starts. The progressive `env` tool provides help, status, target discovery, Docker actions, and SSH connection actions through documented action names. Tool calls are recorded with timestamps, parameters, and outcomes; an `audit_query` capability is available when the audit log uses SQLite.

## Setup and configuration

Install the package with `pip install sandbox-env-mcp`, then run `sandbox-mcp` for stdio or `sandbox-mcp-http` for HTTP access. The documented runtime requirements are Python 3.12 or newer, the Docker SDK, and a running Docker daemon. SSH mode also requires `openssh-client`.

Configuration is stored at `~/.sandbox-mcp/config.toml`, with an example file under `config/config.example.toml`. Settings cover the HTTP port, audit-token file, storage location, default Docker image, networking, workspace path, shell output limit, file size limit, and SSH connection timeout. Configuration fields can also be overridden through environment variables following the `SANDBOX_MCP_<SECTION>_<KEY>` naming pattern.

## Tools and capabilities

Sandbox Env MCP MCP server exposes these direct tools:

- Shell lifecycle and execution: `shell_exec`, `shell_read`, `shell_new`, `shell_remove`, `shell_list`, and `write_stdin`.
- Machine selection: `machine_list` and `default_set`.
- File access: `file_read`, `file_write`, `file_patch`, and `file_search`.
- Discovery and management: `env`, including Docker and configured SSH actions.

File reads support line numbers and pagination. Writes create parent directories and use temporary-file replacement. Patches support replacement or unified-diff modes, with fuzzy matching. Searches can inspect content with ripgrep or find files by glob, and results are ordered by modification time.

Docker actions include creating, listing, starting, stopping, restarting, inspecting, logging, building, committing, and removing containers, plus image history, filesystem differences, and resource statistics. SSH actions connect to or close configured targets. Windows SSH targets receive code-page probing and encoded command handling.

## Limitations and notes

The default `shell_exec` wait period is 10 seconds; long-running work needs asynchronous execution and output polling. Ctrl-C through `write_stdin` is not supported for Windows or PowerShell pipe-mode shells, so those shells must be terminated instead. Sensitive paths such as `.ssh`, `.aws`, `.env*`, and `/etc/shadow` produce warnings but are not blocked.

JSON, YAML, and TOML writes receive syntax validation and fail if validation does not pass. Files larger than 50 KB are rejected by `file_read` with a hint to use narrower access. Docker access depends on the host daemon, while SSH access depends on configured targets and the required client software. Default shells are not automatically replaced after termination.

_Full upstream README: https://allmcps.com/mcp/sandbox-env-mcp/readme_

