
Consult Opencode
io.github.jayden99236由 GitHub 帳號 jayden99236 發布v0.1.1更新於 Oct 24, 2026
Delegate a self-contained task to opencode's free-tier models as a one-shot subagent.
概覽
讓助理把小型、獨立的任務交給 opencode 免費額度模型作為一次性子代理處理,並以文字回傳結果。
- 可以做什麼
- 委派任務:送出必填的任務描述與可選的模型,交給 opencode 處理並取回子代理的文字回覆。
- 分擔小任務,例如摘要檔案、草擬正規表示式、撰寫樣板測試或徵求第二意見,而不佔用主代理自己的回合。
- 預設使用 opencode 免費額度模型,也可指定已在 opencode 中登入的其他供應商。
- 適用情境
- 適合主編碼代理成本高或忙碌,而某個小型、獨立請求可由較便宜的免費額度模型完成時。也適合在聊天用戶端內直接取得獨立的第二意見。
- 執行需求
- 以本機 stdio 程序執行:需要 Node.js 18 或更新版本、已安裝並在 PATH 中的 opencode 命令列工具(npm install -g opencode-ai),以及安裝此伺服器自身的相依套件。設定時使用 node 指令與伺服器腳本的絕對路徑;免費額度不需 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Consult Opencode,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
consult-opencode
Delegate a self-contained task to opencode as a one-shot subagent, from any coding agent (or human) that can run a shell command — or, more directly, straight from inside an AI chat client via MCP.
Listed on the official MCP Registry as io.github.jayden99236/consult-opencode, with a one-click .mcpb bundle attached to each release for Claude Desktop and other MCPB-compatible clients.
Demo
Why
If you're driving an expensive/primary coding agent (Claude, GPT, etc.) through a session, it's often wasteful to spend one of its own turns on something small and self-contained: summarizing a file, drafting a regex, writing a boilerplate test, getting a second opinion. opencode ships its own free-tier models under the opencode/ provider namespace — zero config, no API key required. This repo gives you two ways to reach it:
- MCP server (
mcp-server.mjs) — the easiest path. Add it once to your AI chat client's config and the model gets a nativeconsult_opencodetool, no shell commands involved. See Direct integration below. - CLI script (
consult-opencode.mjs) — zero dependencies, for agents/scripts that can only run shell commands, or for calling it yourself from a terminal.
Both wrap the same core logic in lib.mjs.
Requirements
The CLI script itself (consult-opencode.mjs + lib.mjs) has no dependencies beyond Node built-ins. The MCP server additionally needs @modelcontextprotocol/sdk and zod — run npm install in this repo to get those (see below).
Direct integration (MCP server)
MCP is the standard way to give an AI chat client a native tool without it having to shell out to anything. Once configured, the model just sees a consult_opencode tool it can call directly.
Claude Desktop
Add to your claude_desktop_config.json (find it here):
Restart Claude Desktop and consult_opencode shows up as an available tool.
Claude Code
Or add it to a project's .mcp.json directly using the same mcpServers block shown above.
Other MCP clients (Cursor, Windsurf, etc.)
Any MCP-compatible client takes the same shape: a command (node) and args (the absolute path to mcp-server.mjs), configured as a stdio server. Check your client's docs for where that config lives — the mcpServers entry above is portable as-is.
The tool takes task (required) and an optional model (defaults to opencode/big-pickle, opencode's free tier), and returns the subagent's response as text.
CLI usage
Or install it globally to get a consult-opencode command:
Pipe a task in instead of passing it as an argument:
Options
From another agent
Most coding agents can just run this as a shell command and read its stdout:
Exit code is non-zero on failure, with the error on stderr; stdout carries only the result text (or the JSON blob with --json), so it composes cleanly in scripts and pipelines.
The Windows gotcha this script works around
opencode's compiled Windows binary (opencode.exe) has been observed to hang indefinitely when its stdout is an anonymous pipe — which is exactly what Node's child_process gives you by default when you capture a child process's output. This reproduced consistently (6/6 runs) across both a direct .exe spawn and a shell-wrapped one.
The fix: redirect the child's stdout/stderr to a real temp file on disk, then read the file back once the process exits, instead of piping. This works reliably on Windows and is harmless on other platforms, so consult-opencode always does it this way regardless of OS.
If you're integrating with opencode from your own Node tooling and see a hang with zero output, this is almost certainly why.
License
MIT
來源:README.md,提交 3da72aa
工具
0版本歷史
1- v0.1.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分