
xuanpass/opencode-http-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Zero-dependency, pure-JS stdio MCP bridge for OpenCode 2.x/3.x servers (/api/... routing, no SDK, no build step)
概要
A stdio MCP server that bridges MCP clients (WorkBuddy, Claude Desktop, Cursor, any JSON-RPC stdio client) to an OpenCode 2.x / 3.x server. It talks to OpenCode's official /api/... HTTP endpoints and hand-rolls the MCP stdio (JSON-RPC) protocol on top of node:readline. No @modelcontextprotocol/sdk, no zod, no build step — just Node standard library. The community opencode-mcp 3.x package is TypeScript + @opencode-ai/sdk + zod and must be built before use. Its OpenCodeClient routes to whatever the installed SDK knows about — and the SDK currently only ships 1.x-style paths, so it does not match a running OpenCode server that moved every business endpoint behind an /api/... prefix. The result: 405, the Web UI HTML fallback, or .map is not a function crashes. opencode-http-mcp speaks the current /api/... contract from the start, with to opencode-mcp 3.x — every one of the upstream's 87 unique tool names (92 locally, incl.
README
以下は原文 README の抜粋です。原文を見る。
opencode-http-mcp
A zero-dependency, pure-JavaScript stdio MCP server that bridges MCP clients (WorkBuddy, Claude Desktop, Cursor, any JSON-RPC stdio client) to an OpenCode 2.x / 3.x server.
It talks directly to OpenCode’s official /api/... HTTP endpoints and
hand-rolls the MCP stdio (JSON-RPC) protocol on top of node:readline.
No @modelcontextprotocol/sdk, no zod, no build step — just Node standard
library.
Why this exists
The community opencode-mcp 3.x package is TypeScript + @opencode-ai/sdk
- zod and must be built before use. Its
OpenCodeClientroutes to whatever the installed SDK knows about — and the SDK currently only ships 1.x-style paths, so it does not match a running OpenCode 2.x/3.x server that moved every business endpoint behind an/api/...prefix. The result:405, the Web UI HTML fallback, or.map is not a functioncrashes.
opencode-http-mcp speaks the current /api/... contract from the start,
with full tooling parity to opencode-mcp 3.x — every one of the
upstream’s 87 unique tool names (92 locally, incl. 5 extras), grouped into
layered modules — and honest no-route fallbacks for the small set of
1.x-only endpoints that a 2.x build does not expose (instead of faking data).
Architecture (layered, mirrors upstream)
Layer 0 src/http.js OpenCodeClient — HTTP + SSE + { data } unwrap
Layer 0.5 src/helpers.js formatting / result envelopes / redaction
Layer 0.5 src/registry.js tool registry
Layer 0.5 src/util.js arg helpers (dir / req / modelOpts)
Layer 1 src/jobs.js JobService — session-turn dispatch & observation
Layer 2 src/tools/*.js grouped tool modules (one per upstream file)
Entry src/index.js stdio JSON-RPC MCP entry point
Upstream parity map (opencode-mcp 3.x → opencode-http-mcp)
Tool-surface parity — 100% of upstream names, plus 5 extras
| upstream file | module | upstream tools | local tools | delta |
|---|---|---|---|---|
| session.ts | session.js | 20 | 20 | — |
| message.ts | message.js | 6 | 6 | — |
| file.ts | file.js | 6 | 6 | — |
| config.ts | config.js | 3 | 3 | — |
| provider.ts | provider.js | 6 | 6 | — |
| project.ts | project.js | 3 | 3 | — |
| misc.ts | misc.js | 12 | 16 | +integration/pty/reference/skill_list (2.x routes upstream doesn’t wrap) |
| global.ts | global.js | 1 | 1 | — |
| events.ts | events.js | 1 | 1 | — |
| input.ts | input.js | 6 | 4 | job tools moved to workflow.js |
| tui.ts | tui.js | 9 | 9 | — |
| workflow.ts | workflow.js | 13 | 17 | +job_list/get/cancel/update (JobService tools live here) |
| total | 86 registrations → 87 unique names | 92 unique names | 0 missing, 5 extra |
- 0 missing: every
opencode_*tool name upstream registers exists locally, verified by name-level diff (comm), no duplicate registrations. - 5 extra:
opencode_integration_list,opencode_pty_list,
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"opencode": {
"command": "node",
"args": ["/absolute/path/to/opencode-http-mcp/src/index.js"],
"env": {
"OPENCODE_BASE_URL": "http://192.168.123.101:49374",
"OPENCODE_SERVER_USERNAME": "opencode",
"OPENCODE_SERVER_PASSWORD": "YOUR_PASSWORD_HERE"
}
}
}
}