opencode-sandbox
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., "@opencode-sandboxcreate a sandbox for my project"
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.
opencode-sandbox
Spin up an isolated opencode instance from prebuilt public GHCR images and hand
it to Claude Code as an MCP server. No build step, no checkout of the opencode
fork — each instance is its own Docker Compose project with its own named
volumes, and its workspace is a named volume rather than a host bind, so it
cannot see your filesystem. Images are public and pull anonymously; the
backend reports opencode 1.18.4 and the MCP bridge exposes 80 tools.
Install
Build from source and drop the binary on your PATH:
bun run build
cp dist/opencode-sandbox ~/.local/bin/(bun run install-local does both in one step.) Or grab a prebuilt binary
from this repo's GitHub Releases.
Related MCP server: devcontainer-mcp
Quickstart
Create an instance. No API key is required — opencode ships with free default
models (opencode models lists them), so a fresh instance works immediately.
Any provider API key already in your shell (ANTHROPIC_API_KEY,
OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, OPENROUTER_API_KEY) is
forwarded into it at create time for the paid providers — there's no UI login
step and no auth.json to manage. Those keys are stored in the instance's
.env, so it and its state directory are kept owner-only.
opencode-sandbox create scratch --seed ./my-project --config ./opencode.jsonc--seed copies a directory into the fresh workspace before the instance first
starts (.git history included; .DS_Store files excluded); --config places
an opencode.jsonc for that instance alone. Both are optional. The workspace
is a copy, not a bind mount — edits inside the instance never touch the seed
directory.
--api-port <n> additionally publishes the raw opencode backend on
127.0.0.1:<n>, so a local opencode client can attach to the same instance
an agent is driving over MCP.
--publish does the same for anything else running inside the instance — a
dev server, a database — so you can open what the agent just built. It repeats,
and takes docker's -p order:
opencode-sandbox create scratch --publish 5173 --publish 18090:8090Bare 5173 reuses the same number on the host; 18090:8090 remaps when the
host port is taken. Ports are fixed at create time and bound to 127.0.0.1.
Register it with Claude Code. create prints this line, and url reprints it
later:
opencode-sandbox url scratch
claude mcp add --transport http scratch http://127.0.0.1:4784/mcpNow use it — the instance's 80 tools (read, write, run shell commands, all
scoped to its own /workspace) are available in that Claude Code session.
When you're done:
opencode-sandbox destroy scratch --yesdestroy removes the containers and their volumes, including the workspace —
get anything worth keeping out first (see below).
Getting work out
No credentials ever enter the instance; the host reaches in instead. For work
on a git branch, run the line fetch-url prints from your project's repo —
git speaks its wire protocol over docker exec, so the branch, its history,
and its files land locally for review before you push with your own
credentials:
opencode-sandbox fetch-url scratch
git -c protocol.ext.allow=user fetch 'ext::docker exec -i ocsbx-scratch-opencode-1 git -C /workspace upload-pack .' <branch>:sandbox/<branch>For loose artifacts, or a full salvage before destroy, copy the whole
workspace to a host directory (works even while the instance is stopped):
opencode-sandbox export scratch ./scratch-outA web UI is available too, behind --web on create; without it, the MCP
bridge is the only interface.
Security note
Neither the MCP bridge nor the backend published by --api-port has inbound
authentication of its own, and --publish exposes whatever the agent chose to
run. Anyone who can reach one of these ports gets the full
opencode tool surface — reading and writing
files and running shell commands inside that instance's /workspace. The
published port is bound to 127.0.0.1 by default; keep it that way. Do not
widen it to 0.0.0.0 or put it behind a public reverse proxy without a real
auth layer in front of it.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
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 Connectors
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…
Self-hosted MCP server: 26 deterministic dev, security, and EVM tools.
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
- AlicenseNot gradedqualityBmaintenance45+ first-class, OS and backend specific MCP tools that let AI coding agents create, manage, read, edit, and write files inside dev containers, keeping your machine clean and your environment reproducible and deploy-friendly. Use local Docker, GitHub Codespaces, Azure, AWS, Google Cloud or Kubernetes seamlessly!26MIT
- 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.-
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/hsb3/opencode-sandbox'
If you have feedback or need assistance with the MCP directory API, please join our Discord server