OpenCode MCP Bridge

io.github.ManuOtel由 GitHub 帳號 ManuOtel 發布v0.2.0更新於 Oct 24, 2026

Coordinate and verify OpenCode workers over MCP Streamable HTTP.

已驗證Streamable HTTP可網頁執行開發者工具AI 與機器學習

概覽

AI 產生的概覽

一個遠端 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 等變數。
安裝前請注意
文件稱此 Bearer 權杖等同 root 權限:應保存在環境變數中,切勿提交或貼到聊天,設定外洩後要輪換。worker_run 和 worker_cleanup 會改變狀態,需經核准;worker_verify 的結果應搭配自己的差異審查、測試和 lint 核實,不能只依賴 worker 的摘要。舊版 /mcp 端點會暴露 exec_run,除非 ENABLE_EXEC_RUN=true 否則預設關閉;不打算提供 shell 時不要開啟。社群示範端點僅供選擇加入,需另用權杖,不適用於正式環境。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 OpenCode MCP Bridge,將其新增到工作區。
  2. 連接 所需的 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

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 logo]

opencode-mcp-bridge

A coordinator-facing MCP server for a self-hosted OpenCode instance.

First use in 60 seconds

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 (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.

bash
export OPENCODE_MCP_URL="https://<your-domain>/worker-mcp"export OPENCODE_MCP_BEARER_TOKEN="<paste-token-here>"

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.

bash
./scripts/install-client.sh both --dry-run

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.

EndpointToolsUse
/worker-mcpWorker tools only (8, never exec_run)Default for all new clients. Least privilege; no shell.
/mcpFull compatibility catalog (19 tools)Legacy only. exec_run fails closed unless ENABLE_EXEC_RUN=true.
/healthNone (open)Reverse-proxy liveness checks.
/readyNone (Bearer token)Readiness: OpenCode plus registry (200/503).
/metricsNone (Bearer token)Bounded counters, no sensitive data.

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

bash
codex mcp add opencode --url "$OPENCODE_MCP_URL" --bearer-token-env-var OPENCODE_MCP_BEARER_TOKEN

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):

bash
codex plugin marketplace add ManuOtel/opencode-mcp-bridge --ref v0.6.0

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:

bash
claude mcp add --transport http --header 'Authorization: Bearer ${OPENCODE_MCP_BEARER_TOKEN}' opencode "$OPENCODE_MCP_URL"claude mcp add --transport http --header 'Authorization: Bearer ${OPENCODE_MCP_BEARER_TOKEN}' opencode-bridge "$OPENCODE_MCP_URL"

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:

bash
claude plugin marketplace add ManuOtel/opencode-mcp-bridgeclaude plugin install opencode-worker@opencode-mcp-bridge

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).

HarnessWhereStatus
ChatGPT Developer Mode / connectorsdocs/harnesses.mdUnverified with a static Bearer header
Cursordocs/harnesses.mdProtocol-level
VS Codedocs/harnesses.mdProtocol-level
Gemini CLIdocs/harnesses.mdProtocol-level
OpenHandsdocs/harnesses.mdUnverified
Windsurfdocs/harnesses.mdProtocol-level
Clinedocs/harnesses.mdProtocol-level
Roo Codedocs/harnesses.mdProtocol-level
Pidocs/harnesses.mdProtocol-level
Hermes Agentdocs/harnesses.mdProtocol-level
GitHub Copilot / Copilot Studio / M365 Copilotdocs/copilot-setup.mdSeparate guide
MCP Inspectordocs/harnesses.mdDebugging only

OpenHands

bash
openhands mcp add opencode-bridge --transport http \  --header "Authorization: Bearer <paste-token-here>" \  "https://<your-domain>/worker-mcp"

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:

text
worker_catalog()worker_run(message="Implement X in /path/to/repo", directory="/path/to/repo", title="feat-x")worker_wait(taskID="<taskID>", directory="/path/to/repo", timeout_s=30)worker_verify(taskID="<taskID>", directory="/path/to/repo")worker_cleanup(taskID="<taskID>", directory="/path/to/repo")
  1. worker_catalog (free and connected by default). Default: opencode/muse-spark-1.3-contributor-free. Paid fallback opencode-go/muse-spark-1.3-contributor only when explicitly requested, passed as providerID/modelID. Never auto-selected.
  2. worker_run with message, directory, title, optional requestID for safe retries (deduplicated=true on same-input retry). Save taskID and directory (status reads are directory-scoped).
  3. worker_wait (up to timeout_s, default 30, clamped 1-120; returns early on change, or timed_out=true with next_action="worker_wait") or worker_status for one snapshot. running waits again, idle verifies, stale cleans up, error/unknown recovers (skills/recover-opencode-task/SKILL.md).
  4. worker_verify, then inspect the exact diff and run tests and lint with the host's own tools. Never trust a worker summary alone.
  5. worker_cleanup (action=abort stops, action=delete removes).

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_TOKEN is root-equivalent: long random value, rotate on leak, never commit .env or tokens.
  • /worker-mcp never exposes exec_run; a leaked worker token cannot become a direct shell. Do not expose /mcp or set ENABLE_EXEC_RUN=true where a shell is not intended.
  • Rotation: MCP_BEARER_TOKEN_SECONDARY holds one overlap token; move clients over, promote, restart. Blank or duplicate values fail closed.
  • Open with no secrets: GET /health plus read-only RFC 9728 discovery and server card. Everything under /mcp and /worker-mcp needs the Bearer token.

Local deployment

Needs Python 3.11+, uv, and a running opencode serve or opencode web (server docs).

bash
git clone https://github.com/ManuOtel/opencode-mcp-bridge.gitcd opencode-mcp-bridgeuv synccp .env.example .env# edit .env: OpenCode credentials + a fresh MCP_BEARER_TOKENuv run python -m opencode_mcp_bridge.server

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/.

bash
uv syncuv run pytestuv run ruff check src testsuv run ruff format --check src testsgit diff --check

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
該伺服器需要登入,因此 SourceWeft 無法在沒有帳號的情況下讀取其工具,也未收錄。已連接帳號所能看到的內容可能因帳號及其權限而異。

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式必需10 分
  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。