Exec Sandbox

io.github.inhuman由 GitHub 帳號 inhuman 發布v0.5.4更新於 Oct 24, 2026

Single exec tool running caller Python in a network-isolated locked-down sandbox.

發布方自己的服務:sandbox.co

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

一個 MCP 伺服器,只提供一個 exec 工具,在網路隔離、受限的沙箱中執行助理提供的 Python 程式碼,並回傳標準輸出、標準錯誤與結束碼。

可以做什麼
在沙箱中執行 Python 程式碼,回傳 stdout、stderr、結束碼、耗時,以及截斷或逾時旗標,可傳入 stdin 並指定單次逾時。使用內建的 PyYAML、Jinja2、Pillow、numpy、pandas、matplotlib 在執行中進行資料處理、範本渲染與繪圖。非零結束碼與逾時屬於正常結果,而非工具錯誤。
適用情境
適合讓助理透過撰寫程式碼來完成運算、資料轉換或產生檔案,而不是呼叫大量細碎工具,並希望這些程式碼被限制在一次性沙箱中。若需要 shell 存取、Python 以外的語言,或讓執行的程式碼連上網路,則較不適用。
執行需求
以本機程序方式執行,通常使用已發布的 Docker 映像,需要可寫的 /tmp tmpfs 與唯讀根檔案系統。透過環境變數設定,例如 MCP_EXEC_TRANSPORT(stdio、http 或 sse)、MCP_EXEC_DEFAULT_TIMEOUT_S、MCP_EXEC_MAX_TIMEOUT_S、MCP_EXEC_MAX_OUTPUT_BYTES 與 MCP_EXEC_MAX_STDIN_BYTES。stdio 模式不需要帳號或 API 金鑰。
安裝前請注意
exec 是權限最大的介面,應透過助理的工具政策僅開放給受信任角色。網路隔離僅在 stdio 下成立:使用 HTTP 或 SSE 時容器需要監聽埠,除非在編排層封鎖對外流量,否則沙箱程式碼可能連上網路。每個執行個體內的執行是序列化的。設定 MCP_EXEC_AUTH_TOKEN 後,HTTP/SSE 請求必須帶有相符的 X-MCP-AUTH 標頭;留空則關閉此檢查。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Exec Sandbox,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-exec

English | Русский

[Version] [MCP Registry] [Docker Pulls] [Docker Image Version] [Build] [Go Version] [Go Report Card] [License: MIT] [Issues] [Last Commit]

Public OSS MCP server (Go, MIT) exposing a single powerful tool — exec — that runs caller-supplied Python code in a network-isolated, locked-down sandbox and returns stdout / stderr / exit_code. It is the "code-execution mode" building block: instead of flooding an agent's context with hundreds of tool schemas, the agent writes code that orchestrates the work.

Works over three transports — stdio / HTTP / SSE — with an identical tool set everywhere (official modelcontextprotocol/go-sdk).

The exec tool

Input: { code: string (required), timeout_s?: int, stdin?: string } Output: { stdout, stderr, exit_code, duration_ms, truncated, timed_out }

  • A non-zero exit_code or timed_out=true is a normal result, not a tool error. Only invalid input (empty code, oversized stdin) is a tool-call error.
  • Sandbox v1: Python 3 with stdlib + PyYAML, Jinja2, Pillow, numpy, pandas, matplotlib.

Security model (invariants)

Per execution: no network, non-root, cap-drop=ALL, no-new-privileges, read-only rootfs, no CAP_SYS_ADMIN, ephemeral tmpdir (cleaned up), wall-clock timeout (kills the whole process-group), memory/PID/CPU limits, capped output (1 MiB → truncated). Runs are serialized within an instance; scale out with replicas. Caller data (code/stdin/output) is never persisted and never logged in full — only metadata.

exec is the most powerful surface there is. When embedding it in an agent, gate it behind that agent's tool-policy (trusted roles only).

Network note: --network none only applies to stdio. In HTTP/SSE the container needs networking to serve its port, so sandboxed code would inherit egress — deny it at the orchestrator. In k8s, a NetworkPolicy that allows ingress to the port and denies all egress:

yaml
apiVersion: networking.k8s.io/v1kind: NetworkPolicymetadata: { name: mcp-exec-lockdown }spec:  podSelector: { matchLabels: { app: mcp-exec } }  policyTypes: [Ingress, Egress]  ingress: [{ ports: [{ port: 8080 }] }]  egress: []   # deny all egress → sandbox has no network

Run

bash
go build -o mcp-exec ./cmd/mcp-execMCP_EXEC_TRANSPORT=stdio ./mcp-exec

Docker (recommended production posture):

bash
docker run --rm -i --network none --read-only --cap-drop ALL \  --security-opt no-new-privileges --user 65532:65532 \  --tmpfs /tmp:rw,noexec,nosuid,size=64m \  --memory 256m --pids-limit 128 --cpus 1 \  idconstruct/mcp-exec

--tmpfs /tmp is required: the rootfs is read-only, and each run needs a writable ephemeral workspace (cleaned up after).

Optional auth (HTTP/SSE)

Set MCP_EXEC_AUTH_TOKEN to require every HTTP/SSE request to carry a matching X-MCP-AUTH header (constant-time compare; 401 otherwise). Empty token disables it. Not applicable to stdio.

Configuration

Env varPurposeDefault
MCP_EXEC_TRANSPORTstdio | http | ssestdio
MCP_EXEC_ADDRlisten address for http/sse:8080
MCP_EXEC_DEFAULT_TIMEOUT_Sdefault wall-clock timeout30
MCP_EXEC_MAX_TIMEOUT_Stimeout ceiling300
MCP_EXEC_MAX_OUTPUT_BYTEScombined stdout+stderr cap1048576
MCP_EXEC_MAX_STDIN_BYTESstdin size cap1048576
MCP_EXEC_PYTHONinterpreter pathpython3
MCP_EXEC_AUTH_TOKENif set, http/sse require X-MCP-AUTH header (constant-time); empty = off``

Not in v1

bash / multi-language, network from the sandbox, proxying other MCP servers into the sandbox.

License

MIT.

來源:README.md,提交 ae987e0

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.5.4最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Sandbox 整合