GS

ghostwriternr/sandbox-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

24 stars 6 forks 质量 69 趋势 10MIT

远程MCP用于在沙盒上运行OpenCode。

概览

一个MCP服务器,使AI助手能够将复杂且长时间运行的编码任务委派给在安全的Cloudflare沙盒中运行的OpenCode。 在移动端或短时间使用AI助手时,你不能: - 克隆仓库并进行多文件代码修改 - 运行测试、构建并创建拉取请求 - 执行长时间运行的任务(几分钟到数小时) - 在断线间保持状态 - 启动编码任务,稍后回头查看 - 会话在断线和设备切换中依然存活 - 通过网页界面或轮询查看结果 - OpenCode 自主处理复杂性 默认情况下,该服务器使用 Anthropic 作为 AI 提供者。如需使用其他提供者(OpenAI、Azure、Google 等),请参见“定制提供者”。 - Cloudflare账户,启用Workers、R2和Containers- Anthropic API密钥- GitHub令牌(用于git操作) 将此服务器添加到你的MCP客户端配置中。针对Claude桌面: 连接后,你的AI助手可以使用以下工具:

概述(AI 翻译)

一个MCP服务器,使AI助手能够将复杂且长时间运行的编码任务委派给在安全的Cloudflare沙盒中运行的OpenCode。

为什么?

在移动端或短时间使用AI助手时,你不能:

  • 克隆仓库并进行多文件代码更改
  • 运行测试、构建和创建拉取请求
  • 执行长时间运行的任务(几分钟到几小时)
  • 在断线之间保持状态

这个MCP服务器通过执行后遗忘任务委派来解决这个问题:

  • 开始编码任务,稍后再查看
  • 会话在断线和设备切换后依然存续
  • 通过网页界面或投票查看进展
  • OpenCode 自主处理复杂性

注: 默认情况下,该服务器使用 Anthropic 作为 AI 提供者。如需使用其他提供者(OpenAI、Azure、Google 等),请参见“定制提供者”。

部署到Cloudflare

先决条件

  • 启用Workers、R2和Containers的Cloudflare账户
  • Anthropic API 密钥
  • GitHub 令牌(用于 git 操作)

布置

  1. 克隆与安装:

  2. 设定秘密:

  3. 部署:

连接你的MCP客户端

将此服务器添加到你的MCP客户端配置中。针对Claude桌面:

用途

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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.

Deploy to Cloudflare

Prerequisites

Setup

  1. Clone and install:
git clone https://github.com/ghostwriternr/sandbox-mcp.git
cd sandbox-mcp
npm install
  1. Set 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_xxx
  1. Deploy:
npm run deploy

Connect 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 Inspector
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "sandbox": { "url": "https://sandbox-mcp.you.workers.dev/mcp" } } }