opencode-sandbox
opencode-sandbox
从预构建的公共 GHCR 镜像快速启动一个隔离的 opencode 实例,并将其作为 MCP 服务器交给 Claude Code。无需构建步骤,无需检出 opencode 分支——每个实例都是独立的 Docker Compose 项目,拥有自己的命名卷,其工作区也是命名卷而非主机绑定,因此无法访问你的文件系统。镜像为公共镜像,可匿名拉取;后端报告 opencode 1.18.4,MCP 桥接器暴露了 80 个工具。
安装
从源码构建并将二进制文件放入你的 PATH:
bun run build
cp dist/opencode-sandbox ~/.local/bin/(bun run install-local 一步完成这两项操作。)或者从此仓库的 GitHub Releases 获取预构建的二进制文件。
Related MCP server: Sandbox Agent
快速开始
创建一个实例。你 shell 中已有的任何提供商 API 密钥(ANTHROPIC_API_KEY、OPENAI_API_KEY、GOOGLE_GENERATIVE_AI_API_KEY、OPENROUTER_API_KEY)都会在创建时转发到实例中——无需 UI 登录步骤,也无需管理 auth.json。
opencode-sandbox create scratch --seed ./my-project --config ./opencode.jsonc--seed 会在实例首次启动前将目录复制到新的工作区;--config 会为该实例单独放置一个 opencode.jsonc。两者都是可选的。
将其注册到 Claude Code。create 会打印此行,url 稍后可以重新打印:
opencode-sandbox url scratch
claude mcp add --transport http scratch http://127.0.0.1:4784/mcp现在使用它——该实例的 80 个工具(读取、写入、运行 shell 命令,所有操作都限定在其自己的 /workspace 内)在该 Claude Code 会话中可用。完成后:
opencode-sandbox destroy scratch --yesdestroy 会移除容器及其卷,包括工作区。
创建时使用 --web 还可以使用 Web UI;否则,MCP 桥接器是唯一的接口。
安全说明
MCP 桥接器本身没有入站身份验证。任何能够访问其端口的人都可以获得完整的 opencode 工具界面——在该实例的 /workspace 内读写文件和运行 shell 命令。默认情况下,发布的端口绑定到 127.0.0.1;请保持此设置。不要将其放宽到 0.0.0.0,也不要将其放在没有真正认证层的公共反向代理后面。
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP catalog with 30 tenant-isolated browser, RAG, AI, mail and media tools.
327 dev tools via REST API and MCP. Generate Dockerfiles, schemas, K8s, APIs, and more.
Create, deploy, and operate MCP servers directly from your GitHub repositories.
A MCP server built for developers enabling Git based project management with project and personal…
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceRuns isolated AI agents in Docker containers with persistent workspaces and conversation history. Each agent has access to file operations, shell commands, GitHub integration, and can connect to external MCP servers for additional tools.3MIT
- AlicenseAqualityCmaintenanceEnables code execution in isolated Docker containers with persistent IPython, Node.js, or R kernels, supporting file import/export and cross-session transfers via MCP tools.6MIT
- FlicenseNot gradedqualityBmaintenanceContainerized MCP server for coding agents with tools for file editing, shell commands, process management, Git, browser automation, and project snapshots.-
- AlicenseAqualityCmaintenanceRun Python, JavaScript, or shell snippets in secure, resource-limited Docker containers with no network access, exposed as MCP tools.2Apache 2.0