sandbox-env-mcp
Provides comprehensive Docker container lifecycle management, including creating, starting, stopping, restarting, and removing containers, building images, inspecting configurations, committing state, and viewing logs.
Allows SSH connectivity to remote Linux machines for executing commands, managing files, and running persistent shells.
Enables querying historical tool call audit logs that are stored in a SQLite database.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sandbox-env-mcplist all files in /tmp on the default machine"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
sandbox-mcp
MCP server that gives AI agents a real working environment: persistent shells, a filesystem, and multi-machine management — backed by Docker containers or remote SSH hosts.
Features
Persistent shells — stateful bash or PowerShell sessions that survive across tool calls. Set env vars, activate venvs, change directories, and they stay.
Multi-machine — manage several Docker containers and SSH hosts simultaneously. Each has its own isolated workspace and shell pool.
Full filesystem access — read, write, patch, and search files on any target machine. All writes are atomic (temp-file + rename).
Zero-config startup — creates a default Docker container automatically on first run. One command, ready to go.
Progressive discovery —
envtool exposes capabilities step by step. Agents callenv(action="help")to see what's available.Docker lifecycle — create, stop, start, restart, remove containers. Build images, inspect configs, commit state, view logs.
SSH remote access — connect to Linux and Windows machines over SSH. Windows targets get automatic code-page probing.
Safety net — sensitive-path warnings (
.ssh,.aws,.env*) without blocking access. Pre-write syntax lint for JSON/YAML/TOML.Audit trail — every tool call is logged with timestamps, parameters, and outcomes. Queryable from within the agent session.
Related MCP server: mcp-remote-ssh
Quick start
pip install sandbox-env-mcp
# stdio — for Claude Desktop, Cline, Continue
sandbox-mcp
# HTTP — for remote agents
sandbox-mcp-httpOn first run a default container (python:3.14-slim, named admin)
starts automatically with a persistent bash shell. No other setup.
Requirements: Python 3.12+, Docker SDK, running Docker daemon.
SSH mode needs openssh-client.
Tools
All tools target the default machine unless an explicit machine
parameter is passed.
Tool | What it does |
| Run a command in a persistent shell. Blocks until the command finishes ( |
| Read buffered output from a running or finished command. |
| Create a fresh shell on a machine. Returns a |
| Terminate and remove a shell by |
| List all shells with state, machine, uptime, last command. |
| Write raw bytes to a running shell — interrupt with Ctrl-C ( |
| List all registered machines with backend, status, purpose, shell count. |
| Set the default machine or default shell for a machine. |
| Read a file with line numbers. Supports offset + limit pagination. |
| Write content atomically. Creates parent directories automatically. |
| Targeted edits with fuzzy matching. |
| Search file contents (ripgrep) or find files (glob). Sorted by modification time. |
| Progressive-discovery portal. Start with |
audit_query is exposed when the audit log is a SQLite database —
it lets the agent search historical tool calls.
Shell states
Every shell is in one of four states:
State | What it means | What the agent can do |
| Shell just created; booting up. Times out → | Wait — |
| At a prompt, accepting commands. | Send commands, read output, write stdin. |
| A command is running. | Poll output with |
| Shell process exited (signal, exit, timeout, broken pipe). Last output is preserved. | Read remaining output, then |
Key shell_exec parameters:
wait(defaulttrue): block until the command completes.timeout(default10s): on expiry returnsstatus="waiting"with a hint to switch towait=false+shell_readfor long-running commands.max_output(default50000bytes): caps returned output; excess is shown as the tail (last N bytes).
env actions
env(action="help") lists what's available. env(action="help", topic="<action>") returns full docs for a specific action.
Always available
Action | Params | Description |
|
| List actions or get docs for one. |
| — | Default machine, machines, shells. |
| — | Pre-defined SSH targets from config. |
| — | Registered machines. |
|
| Shells, optionally filtered. |
|
| New shell session. |
|
| Terminate and remove. |
|
| Set default machine or shell. |
Docker
Action | Required params | Description |
|
| Create/start container. Reattaches on name collision. |
| — | List managed containers. |
| — | List all images on daemon. |
|
| Layer-by-layer build history. |
|
| Build from a Dockerfile in |
|
| Commit container as new image. |
|
| Stop (state preserved). |
|
| Start a stopped container. |
|
| Stop + remove container and its shells. |
|
| Curated config. |
|
| Logs with |
|
| Filesystem changes vs image. |
|
| CPU/memory/network/IO snapshot. |
|
| Stop + start + verify. |
SSH
Action | Required params | Description |
|
| Connect to a configured target. |
|
| Disconnect and unregister. |
Available when [ssh.targets] is configured.
File operations
Tool | Key params | Highlights |
|
| Line-numbered. Rejects files > 50 KB with a hint. |
|
| Atomic (temp + rename), auto-creates parent dirs, post-write verification. |
|
| Fuzzy matching. Preserves BOM and line endings. |
|
| Powered by ripgrep. Results sorted by modification time. |
Safety warnings are surfaced for sensitive paths (.ssh, .aws,
.env*, /etc/shadow, etc.) — advisory only, agents still have full
access. Writes to .json, .yaml, .yml, .toml are
syntax-checked before writing (fail-closed).
Configuration
Config lives at ~/.sandbox-mcp/config.toml (copy
config/config.example.toml). Every field can be overridden with
SANDBOX_MCP_<SECTION>_<KEY> env vars.
[server]
port = 8010
auth_tokens_file = "~/.sandbox-mcp/auth_tokens"
[storage]
work_home = "/var/lib/sandbox-mcp"
[docker]
default_image = "python:3.14-slim"
auto_network = "sandbox-mcp" # "" = none
admin_machine = "admin" # "" = no /host mount
host = "" # "" = from Docker environment
[ssh]
connect_timeout = 10
[ssh.targets.win-build]
host = "192.168.1.100"
user = "builder"
os_type = "windows"
[default_machine]
enabled = true
backend = "docker"
name = "admin"
[shell]
default_max_output = 50000
[files]
max_file_size = 51200Backends
Docker
Containers get bind mounts for workspace isolation:
work_home/<name>/→/workspace(rw)work_home/<share_subdir>/→/share/(ro, shared across peers)work_home/<share_subdir>/<name>/→/share/<name>/(rw overlay)
When a container's name matches admin_machine, it also gets
work_home/ → /host (rw) — a global view of all workspaces.
Server startup auto-reconciles with the Docker daemon: surviving containers are re-adopted into the registry.
SSH
Connects over SSH with ControlMaster for connection reuse. Windows targets get automatic code-page probing and encoded-command execution.
Deployment
# docker-compose.yml
services:
sandbox-mcp:
image: ghcr.io/hs3434/sandbox-env-mcp:latest
network_mode: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/sandbox-mcp:/var/lib/sandbox-mcp
- ./config:/root/.sandbox-mcpHTTP mode reads bearer tokens from auth_tokens_file (hot-reload on
every request). If the file is empty or missing and
auto_generate_if_empty=true, a random token is printed to stderr at
startup.
Audit
Every tool call is recorded: timestamp, machine, action, status,
duration, and hashed parameters. Defaults to SQLite at
~/.sandbox-mcp/audit.db. Set log_path="" for JSON-line stderr
output instead.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityFmaintenanceAn MCP server that allows AI models to execute system commands on local machines or remote hosts via SSH, supporting persistent sessions and environment variables.Last updated19627MIT
- AlicenseAqualityBmaintenanceMCP server giving AI agents full SSH access with persistent sessions, structured command output, SFTP file transfer, and port forwarding.Last updated185MIT
- Alicense-qualityCmaintenanceAn MCP server that gives AI agents SSH access to remote machines through your local OpenSSH client, enabling remote command execution, file transfer, persistent shell sessions, and port forwarding.Last updated4MIT
- Alicense-qualityDmaintenanceMCP server that enables AI agents to run fully interactive SSH sessions (via tmux) and execute commands like a human operator, with persistent sessions and multiple concurrent connections.Last updated6MIT
Related MCP Connectors
Cloud-hosted MCP server for durable AI memory
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server for AI dialogue using various LLM models via AceDataCloud
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/hs3434/sandbox-env-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server