sandbox-mcp
Runs OpenCode coding sessions inside Cloudflare Sandboxes, using Workers, R2, and Containers to execute long-running, fire-and-forget coding tasks that survive client disconnections.
Authenticates with a GitHub token so delegated tasks can perform git operations such as cloning repositories, checking out branches, and creating pull requests.
Can be configured as an alternative AI provider via a proxy service and OpenCode provider config, allowing tasks to be executed with OpenAI models instead of Anthropic.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
sandbox-mcp
An MCP server that enables AI assistants to delegate complex, long-running coding tasks to OpenCode running in secure Cloudflare Sandboxes.
Why?
When using AI assistants on mobile or in short sessions, you can't:
Clone repositories and make multi-file code changes
Run tests, builds, and create pull requests
Execute long-running tasks (minutes to hours)
Maintain state across disconnections
This MCP server solves that with fire-and-forget task delegation:
Start a coding task, check back later
Sessions survive disconnections and device switches
Watch progress via web UI or poll for results
OpenCode handles the complexity autonomously
Note: By default, this server uses Anthropic as the AI provider. To use other providers (OpenAI, Azure, Google, etc.), see Customizing the Provider.
Related MCP server: opencode-delegate
Deploy to Cloudflare
Prerequisites
Cloudflare account with Workers, R2, and Containers enabled
GitHub token (for git operations)
Setup
Clone and install:
git clone https://github.com/ghostwriternr/sandbox-mcp.git
cd sandbox-mcp
npm installSet up secrets:
wrangler secret put PROXY_JWT_SECRET # Any random string for signing tokens
wrangler secret put ANTHROPIC_API_KEY # sk-ant-xxx
wrangler secret put GITHUB_TOKEN # ghp_xxxDeploy:
npm run deployConnect Your MCP Client
Add this server to your MCP client configuration. For Claude Desktop:
{
"mcpServers": {
"sandbox": {
"url": "https://sandbox-mcp.you.workers.dev/mcp"
}
}
}Usage
Once connected, your AI assistant has access to these tools:
opencode_run_task
Start a coding task. Returns immediately with a runId to check later.
{
task: string, // What you want done
repository?: string, // Git repo URL to clone
branch?: string, // Branch to checkout
sessionId?: string, // Continue existing session
}opencode_get_result
Check the status and result of a task.
{
runId: string // The run ID from run_task
}opencode_list_runs
List past task runs.
{
sessionId?: string, // Filter by session
status?: string, // Filter: started, running, completed, failed
limit?: number, // Max results (default 10)
}Local Development
For local development and testing:
cp .dev.vars.example .dev.vars # Then fill in your secrets
npm run dev # Start local server
npm run dev:inspect # With MCP InspectorSee AGENTS.md for architecture details and contribution guidelines.
Customizing the Provider
By default, sandbox-mcp uses Anthropic with claude-sonnet-4-5. To use a different provider:
Changing the Model (Anthropic)
Edit src/models/session.ts and change DEFAULT_MODEL:
export const DEFAULT_MODEL = "claude-opus-4-5"; // Change thisUsing a Different Provider
To use a different provider (e.g., OpenAI), you'll need to modify these files:
Add a proxy service - Create
src/proxy/services/openai.ts:import type { ServiceConfig } from "../types"; export const openai: ServiceConfig<Env> = { target: "https://api.openai.com/v1", validate: (req) => req.headers.get("authorization")?.replace("Bearer ", ""), transform: async (req, ctx) => { req.headers.set("authorization", `Bearer ${ctx.env.OPENAI_API_KEY}`); return req; }, };Register the service - Export it from
src/proxy/services/index.ts:export { openai } from "./openai";Update OpenCode config - In
src/workflows/helpers/opencode.ts, updatebuildProxyConfig():function buildProxyConfig(proxyBaseUrl: string, proxyToken: string): Config { const containerProxyUrl = toContainerUrl(proxyBaseUrl); return { provider: { openai: { options: { apiKey: proxyToken, baseURL: `${containerProxyUrl}/proxy/openai`, }, }, }, }; }Update task execution - In the same file, change
providerIDinexecuteTask():model: { providerID: "openai", // Change from "anthropic" modelID: params.model, },Add the secret:
wrangler secret put OPENAI_API_KEYUpdate the default model - In
src/models/session.ts:export const DEFAULT_MODEL = "gpt-5.2"; // OpenAI model
See the OpenCode provider documentation for supported providers and their configuration.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Durable background job execution, async task scheduling, and state persistence for AI agents.
Execution platform for AI agents on Firecracker microVMs in the EU. Interactive Linux sandboxes with root, templates for Python, Node.js, Go, Rust and a headless browser, public HTTPS URLs. Background jobs that outlive the connection, batches of up to 1,000 jobs with dependencies, hard cost caps reserved up front, execution receipts with SHA-256, log digests that fit the context. IPv4, dual-stack or IPv6-only with its own public address, allowlists or no network. WASI runtime for small tasks. Idle sandboxes sleep and keep their files. Also REST API, Python SDK and LangChain.
Build, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables Claude Code to delegate tasks to OpenCode subagents asynchronously, with tools for starting tasks, polling status, and fetching results.7288 npm6MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude Code and Claude Desktop to delegate coding tasks to any model available in OpenCode while Claude remains the orchestrator, planning work, reviewing diffs, and running tests. Supports synchronous and async delegation, model selection, session continuation, and permission-aware execution.6MIT
- AlicenseNot gradedqualityAmaintenanceConnects MCP clients such as Claude, Cursor, and VS Code to OpenCode's headless API so users can delegate coding tasks, ask questions, run work in the background, and resolve permission or input requests across projects. It also supports monitoring job progress, reviewing resulting changes, and inspecting conversation history.22,181 npmMIT
- AlicenseNot gradedqualityAmaintenanceConnects MCP clients such as Claude, Cursor, and VS Code to OpenCode's headless API so users can ask questions, implement features, run and monitor background coding jobs, supply replies and permissions, and review changes across multiple projects. Supports async job tracking, structured outputs, and project-scoped resources and prompts.22,181 npmMIT