
Sandbox Env MCP
io.github.hs3434由 GitHub 账号 hs3434 发布v0.3.1更新于 Oct 25, 2026
Persistent Docker/SSH sandbox for AI agents: shell exec, file ops, audit log.
概览
为 AI 助手提供持久化 shell 会话、文件操作,以及在沙箱中管理 Docker 或 SSH 机器的能力。
- 可以做什么
- 在持久化的 bash 或 PowerShell shell 中执行命令,读取缓冲输出、写入 stdin 并管理各机器上的 shell 会话。在任意目标机器上读取、写入、修补和搜索文件,写入为原子操作,并对 JSON、YAML、TOML 做语法检查。创建、启动、停止、重启、删除、构建、提交、检查 Docker 容器并查看日志。连接和断开已配置的 SSH 主机,包括 Windows 目标。当审计日志存于 SQLite 时,可查询历史工具调用记录。
- 适用场景
- 适合需要真实且有状态的工作环境而非一次性命令的场景:在多次调用之间保留虚拟环境和目录、同时操作多个容器或远程主机,或需要为每个操作留下可审计记录。
- 运行要求
- 本地 Python 3.12+ 进程,需 Docker SDK 和运行中的 Docker 守护进程;SSH 模式还需 openssh-client。配置位于用户主目录下的配置文件,可用环境变量覆盖。HTTP 模式使用令牌文件中的 bearer 令牌。
安装
在 SourceWeft 中
- 打开 控制台中的 Sandbox Env MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
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.
Quick start
On 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.
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:
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
Docker
SSH
Available when [ssh.targets] is configured.
File operations
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.
Backends
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
HTTP 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.
来源:README.md,提交 939e52c
工具
0版本历史
1- v0.3.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分