
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 分