Agent Mcp Hub

io.github.blackaxgit由 GitHub 账号 blackaxgit 发布v0.6.2更新于 Oct 24, 2026

One MCP server bridging the Codex, Cursor, OpenCode, Claude, and Antigravity CLI agents

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

概览

AI 生成的概览

本地 stdio MCP 服务器,让助手把提示词交给 Codex、Cursor、OpenCode、Claude 和 Antigravity 命令行编码代理执行,或把同一提示词并行分发给全部代理。

可以做什么
  • 把提示词委派给单个命令行编码代理(codex、cursor、opencode、claude、agy),可指定模型、工作目录和超时
  • 把同一提示词并行发送给所有已安装代理,并排比较结果
  • 列出已安装且在 PATH 上的代理命令行,并提供健康检查
  • 让一个代理在 git 工作区中修改代码,抓取 diff 后由另一个代理评审并给出 PASS/WARN/FAIL 结论
  • 对未安装、未登录、未配置、超时或流中断的代理返回分类清晰、可操作的错误
适用场景
适合已经同时使用多个命令行编码代理的用户:希望在一个 MCP 客户端里调用任意一个代理、对比它们的回答,或让不同代理交叉评审代码改动,而无需切换工具。
运行要求
作为 MCP 客户端的子进程在本地通过 stdio 运行(npm 包 agent-mcp-hub,可全局安装或使用 npx)。每个被包装的命令行工具需单独安装并登录;hub 本身未声明任何 API 密钥。可选环境变量:MCP_AGENTS 白名单、MCP_CONFIRM、MCP_AGENT_TIMEOUT_MS 和 MCP_AGENT_IDLE_TIMEOUT_MS。
安装前请注意
代理工具会启动真实的编码命令行工具,可能读取并修改指定工作目录中的文件;review_change 的 runner 代理拥有写权限。评审代理的只读限制仅对 codex 和 claude 真正生效,opencode 完全不受限。评审提示词中会嵌入受外部影响的 diff。启动前的确认默认关闭,建议启用 MCP_CONFIRM。各代理使用你自己的登录凭据,可能产生服务商用量费用。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

agent-mcp-hub

One MCP server that bridges multiple CLI coding agents — Codex, Cursor, OpenCode, Claude, and Antigravity — into any MCP client.

stdio only — by design. The hub ships no Docker image and no HTTP transport (both were removed during the 0.5.x line). A containerised or remote server cannot see the caller's repository path and cannot reuse the caller's CLI logins — it would break the product contract on both halves. The hub runs as a child process of your MCP client, on your machine, as you.

Tools

ToolDescription
codexDelegate a prompt to codex exec (prompt piped via stdin)
cursorDelegate a prompt to cursor-agent -p (prompt piped via stdin)
opencodeDelegate a prompt to opencode run
claudeDelegate a prompt to the Claude Code CLI (prompt piped via stdin)
agyDelegate a prompt to Google Antigravity (agy --print=…, prompt passed as a flag value)
run_allSame prompt to all agents in parallel, results side by side
list_agentsWhich agent CLIs are installed and on PATH
pingHealth check

Agent tools accept prompt (required), model, cwd, timeoutMs (total runtime cap, default 1800000 = 30 min), and idleTimeoutMs (inactivity cap, default 300000 = 5 min). See Long-running tasks & timeouts.

Known limitation: opencode prompts may not start with - (its CLI could parse them as flags); the tool returns an actionable error instead of guessing.

Choosing models per agent

Model ids are agent-specific and do not overlap. o3 means nothing to agy, gemini-3.6-flash-low means nothing to codex, and opencode namespaces its own (opencode/big-pickle). So a single model value is valid for at most one agent in a fan-out.

  • run_all takes models — a per-agent map. Agents you don't list fall back to model, then to their own CLI default.
  • review_change takes runnerModel and reviewerModel, so the agent writing the change and the agent judging it can use different engines and tiers. model remains a fallback for both.
json
{  "tool": "run_all",  "arguments": {    "prompt": "Explain the retry logic in src/exec.ts",    "models": { "codex": "o3", "agy": "gemini-3.6-flash-low", "claude": "haiku" }  }}

An unknown agent name in models is rejected with the list of enabled agents — a typo never silently falls back to the default model.

Where to find valid ids: opencode models, cursor-agent models and agy models list them. codex and claude have no such command — codex reads its default from ~/.codex/config.toml, and claude accepts the documented aliases (opus, sonnet, haiku, fable). Note claude models is not a subcommand: it is treated as a prompt, so its "model list" is generated text, not a source of truth.

Error handling

When a wrapped CLI fails, the hub classifies the failure and returns a clean, ANSI-free, actionable isError result — never a raw terminal dump — naming the class and the exact fix:

ClassExample remediation
not_installedinstall the CLI (e.g. npm i -g @openai/codex) / fix PATH
not_authenticatedcodex login · cursor-agent login · opencode auth login · claude → /login · agy → sign in on first run (or set the matching API key)
not_configuredset a model/provider in the CLI's config
timed_outraise timeoutMs, or check the agent/model is responsive
stream_stalledthe agent reached the network but its stream keeps dropping (e.g. cursor behind a TLS-intercepting proxy) — treat that agent as unavailable; raising timeoutMs will not help
server_busyretry shortly (upstream rate-limit, or the local agent-spawn queue is full)
tool_failuregeneric non-zero exit — the message includes (exit N) and a trimmed output tail

For example, an unauthenticated cursor no longer returns its ANSI "press any key to sign in" banner — it returns cursor is not authenticated … Fix: run cursor-agent login``.

Review a change (review_change)

Runs a runner agent in a git cwd to make a change, captures the actual git diff of what changed, then has a reviewer agent judge that diff. Returns the runner's output, the diff (--stat), and a PASS / WARN / FAIL verdict with findings.

Inputs: runner, reviewer (agent names), prompt, cwd (must be a git worktree), optional runnerModel, reviewerModel, model (fallback for both), timeoutMs.

Key notes:

  • Cross-agent by design — e.g. codex writes, claude reviews.

  • Returns the concrete diff that the plain agent tools don't expose.

  • Newly-created (untracked) files are surfaced to the reviewer with their contents (bounded: 64 KiB per file, 50 files; excess is truncated and flagged). git diff alone would omit them entirely.

  • If the worktree was already dirty, the diff may include pre-existing changes (noted in the output).

  • Complements — does not replace — client-side stop-hooks or PR-time CI review.

  • The confirm gate (MCP_CONFIRM) applies.

  • The reviewer runs least-privilege — but how much that guarantees depends on the agent. The reviewer's prompt embeds an attacker-influenced diff, so it is run read-only rather than with the write grant the runner gets. Only two of the five are real restrictions:

    ReviewerRead-only mechanismEnforced?
    codex-s read-onlyYes — OS-level sandbox
    claude--disallowedTools Write,Edit,…,BashYes — harness-level deny
    cursor--trust --mode plan (no --force)No — model-advisory only
    agypermission grant withheldPartly — headless auto-deny, not a sandbox
    opencodenone availableNo — unrestricted

    Pick codex or claude as the reviewer if you want the restriction to be real. This is defense-in-depth alongside the nonce-fenced diff and the throwaway temp cwd; none of it is a sandbox.

json
{  "tool": "review_change",  "arguments": {    "runner": "codex",    "reviewer": "claude",    "prompt": "Add retry with exponential backoff to the API client",    "cwd": "/Users/you/projects/my-app"  }}

Prerequisites

Install and authenticate the CLIs you want to use (any subset works):

  • Codex: npm i -g @openai/codex && codex login
  • Cursor: curl https://cursor.com/install -fsS | bash && cursor-agent login
  • OpenCode: npm i -g opencode-ai && opencode auth login
  • Claude Code: npm i -g @anthropic-ai/claude-code && claude (first run logs in)
  • Antigravity: install the Antigravity CLI (e.g. brew install --cask antigravity-cli), then run agy once and sign in — it has no login subcommand and stores credentials in the OS keyring, so there is no API-key env var to set

Install

Recommended — global install (fast, reliable startup): install the pinned version once, then point your client at the agent-mcp-hub binary. Startup is instant and the client connects reliably.

bash

Claude Code

bash
claude mcp add agent-hub -- agent-mcp-hub

Cursor / generic mcp.json

json
{  "mcpServers": {    "agent-hub": {      "command": "agent-mcp-hub"    }  }}

Zero-install alternative (npx)

No global install, but npx re-resolves the package on every launch, so first start is slower and can occasionally trip a client's connection-probe timeout (the server itself is fine — just retry). Prefer the global install for a persistent setup.

bash
claude mcp add agent-hub -- npx -y [email protected]# mcp.json:  "command": "npx", "args": ["-y", "[email protected]"]

Pre-release / fallback: To test an unreleased commit, run directly from GitHub: npx -y github:blackaxgit/agent-mcp-hub#<tag-or-sha>. This builds from source on first fetch, so under npm v12+ you must allow the prepare script.

Configuration

MCP_AGENTS — comma-separated allowlist of the agents to expose (codex,cursor,opencode,claude,agy). Unset or empty exposes all agents. Disabled agents get no tool and are absent from list_agents/run_all. An unknown name fails at startup with an error listing the valid names, so typos never silently disable an agent.

For stdio, set it in the client's mcp.json:

json
{  "mcpServers": {    "agent-hub": {      "command": "npx",      "args": ["-y", "[email protected]"],      "env": { "MCP_AGENTS": "codex,claude" }    }  }}

Confirm before running an agent — MCP_CONFIRM

Set MCP_CONFIRM=1 (values 1/true/on/all; default off) to require a confirmation before any agent tool — and run_all — actually spawns a CLI. The server sends a brief summary (agent · prompt · cwd · model) and waits: accept runs the agent, decline runs nothing and returns a terminal cancellation.

This uses the standard MCP elicitation capability, so it is client/IDE-agnostic — it works with any MCP client that supports form elicitation (Claude Code, Cursor, VS Code, Zed, Windsurf, custom SDK clients, …); the gate keys on the protocol capability, never a product name. Clients that don't support elicitation transparently run without a prompt (no hang, no error).

json
{  "mcpServers": {    "agent-hub": {      "command": "npx",      "args": ["-y", "[email protected]"],      "env": { "MCP_CONFIRM": "1" }    }  }}

Long-running tasks & timeouts

A complex agent task can run for many minutes. The hub bounds each run with two independent timers so a productive long run survives while a genuinely stuck one fails fast:

  • Idle (inactivity) timeout — idleTimeoutMs (per call) / MCP_AGENT_IDLE_TIMEOUT_MS (env), default 300000 (5 min). The timer resets on every chunk of output the CLI produces, so an agent that keeps working (streaming output) never trips it. An agent that goes silent — e.g. opencode stuck on an unreachable model backend — is killed after the idle window with an actionable "no output — the agent may be hung or its model/backend is unreachable" error, instead of burning the full cap.
  • Total runtime cap — timeoutMs (per call) / MCP_AGENT_TIMEOUT_MS (env), default 1800000 (30 min). A hard upper bound regardless of activity.

Whichever fires first kills the agent's process group. Tradeoff: the idle reset assumes the CLI streams intermediate output. codex and opencode do; claude -p, cursor-agent -p and agy --print may emit only the final result, so a long silent task on those can be idle-killed at 5 min — raise idleTimeoutMs / MCP_AGENT_IDLE_TIMEOUT_MS for such tasks, or rely on the total cap.

agy is the strongest case here: it emits its entire answer in one flush at the end (measured — every line of a 12-line reply arrived at the same instant), and the hub raises its internal --print-timeout to 48h so that agy's own 5-minute default can never truncate a run. The idle timer is therefore agy's only protection against a genuine hang; budget idleTimeoutMs accordingly for long autonomous agy tasks.

While an agent runs, the hub emits MCP progress notifications to clients that request them (_meta.progressToken) — live feedback during long runs. Note: on Claude Code (stdio) the per-server request timeout in .mcp.json (or the MCP_TOOL_TIMEOUT env var it honors) is a hard wall-clock that progress does not reset (default ~28h) — raise it if you lowered it below your longest run.

Upgrading

Global install: install the new version — the pinned agent-mcp-hub command in your MCP config picks it up on the next client start:

bash

npx (pinned): bump the pinned version in your MCP config — e.g. change [email protected] to [email protected] everywhere.

Always-latest (not recommended for shared configs): use agent-mcp-hub@latest instead of a pinned version. Note that npx caches by version — it may serve a stale copy. Force a fresh fetch with npx --prefer-online agent-mcp-hub or npx clear-npx-cache.

Pinning is reproducible and recommended for team-wide or checked-in mcp.json files.

Development

bash
npm installnpm test           # vitestnpm run typecheck  # strict TS over src + testsnpm run dev        # run from source over stdionpm run build      # emit dist/

Architecture

Pure adapters (src/adapters/* — prompt → {args, stdin?}, no I/O) → one subprocess boundary (src/exec.ts) → MCP stdio server (src/server.ts). Adding an agent = one ~15-line adapter file + one line in src/registry.ts.

License

Mozilla Public License 2.0 (MPL-2.0).

Versions before 0.5.2 were released under the MIT license; that grant stands for those versions. MPL-2.0 applies from 0.5.2 onward.

来源:README.md,提交 fb1e46a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.6.2最新Oct 1, 2026
  2. v0.6.1Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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