
OpenCode MCP Bridge
io.github.ManuOtel由 GitHub 账号 ManuOtel 发布v0.2.0更新于 Oct 24, 2026
Coordinate and verify OpenCode workers over MCP Streamable HTTP.
概览
一个远程 MCP 桥接服务,让宿主助手把仓库或系统任务委派给自建的 OpenCode worker,并核验结果。
- 可以做什么
- 列出可用的 OpenCode worker 模型并选择,默认免费模型,仅在明确要求时使用付费备选(worker_catalog)。以消息、目录和标题异步启动 worker 任务,重试时可去重(worker_run)。用有上限的长轮询等待,或获取一次状态快照(worker_wait、worker_status)。核验 worker 结果并查看差异(worker_verify)。批准或恢复需审批的步骤,以及停止或删除任务(worker_decide、worker_resume、worker_cleanup)。
- 适用场景
- 当 Codex、Claude Code 等宿主工具需要把仓库或系统工作交给另一台机器上的 OpenCode 实例,并由宿主模型划定任务范围、检查结果时使用。适合已经自行运行 OpenCode 服务器和桥接部署的团队。
- 运行要求
- 需要你自己桥接主机上的远程 Streamable HTTP 端点(以 /worker-mcp 结尾),以及通过 Authorization 头发送的 Bearer 令牌。必须自行运行 OpenCode 服务器和桥接部署;没有 npm 或 Homebrew 包,也没有本地 stdio 传输。自建需要 Python 3.11+、uv 和运行中的 opencode serve 或 opencode web,以及 OPENCODE_BASE_URL、OPENCODE_SERVER_PASSWORD、MCP_BEARER_TOKEN 等变量。
安装
在 SourceWeft 中
- 打开 控制台中的 OpenCode MCP Bridge,将其添加到工作区。
- 连接 所需的 凭据。它们会被私密存储,绝不会在公开页面上展示。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
交给智能体安装
把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。
阅读 https://sourceweft.com/mcp/io.github.ManuOtel%2Fopencode-mcp-bridge/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。 客户端会在首次连接时完成 OAuth 登录。
{
"mcpServers": {
"opencode-bridge": {
"type": "http",
"url": "https://opencode-mcp.manuotel.com/worker-mcp"
}
}
}README
opencode-mcp-bridge
A coordinator-facing MCP server for a self-hosted OpenCode instance.
Protocol-level compatibility (MCP over Streamable HTTP) - no official partnerships; some harnesses are unverified end-to-end, see docs/compatibility.md:
[Codex docs] [Claude Code docs] [ChatGPT docs] [Cursor docs] [VS Code docs] [Gemini CLI docs] [OpenHands docs] [Pi docs] [Hermes docs] [MCP Inspector docs]
A host harness (Codex, Claude Code, or any MCP-capable client) delegates repository or system work to an OpenCode worker on another machine. The host model scopes the task, coordinates the worker, and verifies the result. The bridge speaks MCP over Streamable HTTP with Bearer authentication (remote HTTP only; there is no local stdio transport). It coordinates OpenCode workers; it does not replace OpenCode.
Bring your own bridge: you provide an OpenCode server, your own bridge
deployment, your own token, and your own
https://<your-domain>/worker-mcp. Generic installs never point at
another person's server. The optional community demo endpoint operated
by ManuOtel at https://opencode-mcp.manuotel.com/worker-mcp
(/worker-mcp only) is opt-in only, requires its own token, and is not
for production. Self-host for production with your own token.
https://YOUR-BRIDGE-HOST/worker-mcp (as shipped in .mcp.json) is a
placeholder, not a usable server; it fails loudly by design.
Documentation map
- First use: env vars and Quick connect.
- Endpoints:
/worker-mcp(recommended) vs/mcp(legacy). - Codex and Claude Code: concise setup.
- More harnesses: compact matrix plus
docs/harnesses.md. - Worker workflow: run, wait, verify, clean up.
- Security, Local deployment, Contributor workflow, Publish and discover: pointers below.
- Full guides: docs/client-setup.md, docs/copilot-setup.md, docs/harnesses.md, docs/compatibility.md, docs/tool-api.md, docs/worker-operating-model.md, docs/operations.md, docs/registry.md.
First use (60 seconds)
You need your own bridge deployment and its Bearer token. Keep the token in environment variables. Never paste a real token into a file, a chat log, or a commit. The optional community demo above is separate and may require its own token; generic steps below only use your bridge.
Replace <your-domain> with your bridge host and <paste-token-here>
with MCP_BEARER_TOKEN from that host. Generate a fresh token with
python3 -c "import secrets; print(secrets.token_urlsafe(48))".
Quick connect (your own bridge): ./scripts/install-client.sh both
registers Codex and Claude Code transports from OPENCODE_MCP_URL and
OPENCODE_MCP_BEARER_TOKEN. It fails clearly when either is missing or
the URL is malformed (http(s)://... ending in /mcp or
/worker-mcp); it never falls back to anyone else's server.
Full steps: docs/client-setup.md. Copilot-family products: docs/copilot-setup.md.
Every example below uses https://<your-domain>/worker-mcp (safe
default, recommended: the eight worker tools worker_catalog,
worker_run, worker_wait, worker_status, worker_verify,
worker_cleanup, worker_decide, worker_resume; never exec_run)
or https://<your-domain>/mcp (legacy full catalog of 19 tools, with
exec_run only when the operator sets ENABLE_EXEC_RUN=true).
Codex plugin bundles do not interpolate env vars in the server URL, so
register the transport per machine with your concrete URL.
Endpoints
Two Streamable HTTP endpoints share one Bearer token. GET /health
plus read-only GET/HEAD on /.well-known/oauth-protected-resource
(and /mcp and /worker-mcp children) and
/.well-known/mcp/server-card.json stay open with no secrets.
Codex and Claude Code
Protocol-level compatibility (MCP over Streamable HTTP with a Bearer header) unless an end-to-end test is documented. Matrix, status labels, and first-call contract: docs/compatibility.md.
Codex
Codex reads the token from the environment at request time. The
opencode-worker plugin adds skills (delegate-to-opencode, then
verify-opencode-work, on failure recover-opencode-task; code changes
follow opencode-git-workflow). Install from the Git marketplace pinned
at v0.6.0, then register your own transport as above (the bundled
placeholder URL is not usable):
Details: docs/client-setup.md sections 2 and 6. Official docs: https://developers.openai.com/codex/cli/reference
Claude Code
Preferred transport: a project .mcp.json entry with type: http,
url: ${OPENCODE_MCP_URL}, and header
Authorization: Bearer ${OPENCODE_MCP_BEARER_TOKEN} (expanded at load
time, token stays out of the file). CLI alternative, same reference
form:
A shell-expanded header would persist the secret in local config; rotate
the token if a config file leaks. Recommended: the opencode-worker
plugin from this repo's Claude marketplace
(.claude-plugin/marketplace.json), bundling the transport plus the
coordinate-opencode-worker skill. Export both variables first:
There is no npm or Brew package; both marketplaces install from this Git repo. Details: docs/client-setup.md sections 3 and 7. Official docs: https://docs.anthropic.com/en/docs/claude-code/mcp
More harnesses
Config keys differ per product; confirm key names in the linked official
docs before pasting. Full copy-ready blocks:
docs/harnesses.md. Safe pattern everywhere: URL
https://<your-domain>/worker-mcp, header
Authorization: Bearer ${OPENCODE_MCP_BEARER_TOKEN}, the eight
worker_* tools (worker_wait is the bounded read-only long-poll;
worker_decide/worker_resume are approval-gated).
OpenHands
Replace <paste-token-here> with MCP_BEARER_TOKEN from your bridge
host (key names per https://docs.openhands.dev/openhands/usage/cli/mcp-servers).
Unverified end-to-end; full block:
docs/harnesses.md. Without a client:
./scripts/smoke.sh.
Worker workflow
worker_run is asynchronous (returns a taskID at once). Then wait
bounded server-side with worker_wait, or snapshot with
worker_status:
worker_catalog(free and connected by default). Default:opencode/muse-spark-1.3-contributor-free. Paid fallbackopencode-go/muse-spark-1.3-contributoronly when explicitly requested, passed asproviderID/modelID. Never auto-selected.worker_runwithmessage,directory,title, optionalrequestIDfor safe retries (deduplicated=trueon same-input retry). SavetaskIDanddirectory(status reads are directory-scoped).worker_wait(up totimeout_s, default 30, clamped 1-120; returns early on change, ortimed_out=truewithnext_action="worker_wait") orworker_statusfor one snapshot.runningwaits again,idleverifies,stalecleans up,error/unknownrecovers (skills/recover-opencode-task/SKILL.md).worker_verify, then inspect the exact diff and run tests and lint with the host's own tools. Never trust a worker summary alone.worker_cleanup(action=abortstops,action=deleteremoves).
Contracts: docs/tool-api.md. Coordinator behavior:
docs/worker-operating-model.md.
Approval in .mcp.json: worker_run/worker_cleanup prompt;
worker_wait/worker_status/worker_catalog/worker_verify
auto-approve.
Security
MCP_BEARER_TOKENis root-equivalent: long random value, rotate on leak, never commit.envor tokens./worker-mcpnever exposesexec_run; a leaked worker token cannot become a direct shell. Do not expose/mcpor setENABLE_EXEC_RUN=truewhere a shell is not intended.- Rotation:
MCP_BEARER_TOKEN_SECONDARYholds one overlap token; move clients over, promote, restart. Blank or duplicate values fail closed. - Open with no secrets:
GET /healthplus read-only RFC 9728 discovery and server card. Everything under/mcpand/worker-mcpneeds the Bearer token.
Local deployment
Needs Python 3.11+, uv, and a running
opencode serve or opencode web (server
docs).
curl http://127.0.0.1:8087/health returns {"ok": true}. POST /mcp
and POST /worker-mcp without a token return 401. Key variables:
OPENCODE_BASE_URL, OPENCODE_SERVER_PASSWORD, MCP_BEARER_TOKEN,
ENABLE_EXEC_RUN (false), TASK_STATE_PATH, MCP_MAX_BODY_BYTES,
MCP_ALLOWED_ORIGINS. Put a reverse proxy with TLS in front. Release,
checks, rotation, rollback, logs: docs/operations.md.
Contributor workflow
Read AGENTS.md first (ownership, edits, free-model policy,
tests, secrets, worktrees, commits, reporting). Skills in skills/.
Publish and discover
In-repo, no secrets: server.json (safe /worker-mcp metadata for
io.github.ManuOtel/opencode-mcp-bridge), glama.json (claim for
ManuOtel), Smithery via dashboard/CLI. Publishing needs a human owner
login. Checklist: docs/registry.md. A registry entry
lists the software; it never grants access or supplies a token.
/worker-mcp (8 tools, no shell) is the default; /mcp (19 tools,
exec_run opt-in) is legacy. Never publish an endpoint you do not
operate, and never commit tokens.
Community and license
Read CONTRIBUTING.md before changing code or docs. Follow the Code of Conduct; report security faults per SECURITY.md. Open an issue or a pull request from a feature branch.
License: PolyForm Noncommercial 1.0.0 - free for noncommercial use, see LICENSE.md. Commercial use needs permission: [email protected]
来源:README.md,提交 7cc19e4
工具
0版本历史
1- v0.2.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通必需25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式必需10 分
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。