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.

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

让助手把小型、独立的任务交给 opencode 免费额度模型作为一次性子代理处理,并以文本返回结果。

可以做什么
  • 委派任务:提交必填的任务描述和可选的模型,交给 opencode 处理并取回子代理的文本回复。
  • 分担小任务,例如总结文件、起草正则、编写样板测试或征求第二意见,而不占用主代理自己的回合。
  • 默认使用 opencode 免费额度模型,也可指定已在 opencode 中登录的其他提供方。
适用场景
适合主编码代理成本高或繁忙,而某个小型、独立请求可由更便宜的免费额度模型完成时。也适合在聊天客户端内直接获取独立第二意见。
运行要求
以本地 stdio 进程运行:需要 Node.js 18 或更高版本、已安装并在 PATH 中的 opencode 命令行工具(npm install -g opencode-ai),以及安装本服务器自身依赖。配置时使用 node 命令和服务器脚本的绝对路径;免费额度无需 API 密钥。
安装前请注意
任务文本会发送给 opencode 的模型,请勿粘贴不愿与该提供方共享的密钥或私有代码。选择非默认模型需先在 opencode 中登录该提供方,并可能产生费用。服务器会把子进程输出写入磁盘上的临时文件。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Consult Opencode,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

consult-opencode

[MCP Registry]

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

[consult-opencode 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 native consult_opencode tool, 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

  • Node.js >= 18
  • opencode installed and on your PATH:
    bash
    npm install -g opencode-ai

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.

bash
git clone https://github.com/jayden99236/consult-opencode.gitcd consult-opencodenpm install

Claude Desktop

Add to your claude_desktop_config.json (find it here):

json
{  "mcpServers": {    "consult-opencode": {      "command": "node",      "args": ["/absolute/path/to/consult-opencode/mcp-server.mjs"]    }  }}

Restart Claude Desktop and consult_opencode shows up as an available tool.

Claude Code

bash
claude mcp add consult-opencode -- node /absolute/path/to/consult-opencode/mcp-server.mjs

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

bash
node consult-opencode.mjs "Summarize what this function does: ..."

Or install it globally to get a consult-opencode command:

bash
npm install -g .consult-opencode "Write a regex for US zip codes"

Pipe a task in instead of passing it as an argument:

bash
cat some-file.js | consult-opencode "Explain what this file does"

Options

FlagDescription
--model <provider/model>Model to use (default: opencode/big-pickle, opencode's free tier). Once you've authenticated another provider in opencode (opencode providers login), you can point this at it, e.g. --model anthropic/claude-haiku-4-5.
--jsonPrint { model, text, cost } as JSON instead of plain text.
-h, --helpShow usage.

From another agent

Most coding agents can just run this as a shell command and read its stdout:

bash
node /path/to/consult-opencode.mjs "task description here"

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
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

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

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分