mcp-agent-hub
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-agent-hubI'm the master; assign coder-1 the login task and track progress."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-agent-hub
让多个 Agent 客户端(Claude Code、Cursor、MiMo、Aider 等,可 2 个以上)在本机或局域网互通协作的 MCP 服务。
协作模型:手动设主 + 其余全是子代理
手动指定一个主理人(master):在某个客户端启动时
--role-type master,或调用set_master其余全部是子代理(subagent):数量不限;入网时自动挂靠到当前主理人
支持本地(多个 stdio 进程共享一个 SQLite)和局域网(Streamable HTTP,多客户端接入同一 Hub)
┌─────────────────────┐
│ 主理人 master │ ← 手动指定(--role-type master / set_master)
│ 拆解 · 派单 · 盯进度 │
└──────────┬──────────┘
dispatch_task │ report / escalate
┌──────────────────┼──────────────────┐
▼ ▼ ▼
┌────────────┐ ┌────────────┐ ┌────────────┐
│ 子代理 A │ │ 子代理 B │ │ 子代理 C │ ← 可任意多个
│ coder │ │ reviewer │ │ tester │
└────────────┘ └────────────┘ └────────────┘
│ │ │
└──────────────────┼──────────────────┘
▼
共享黑板 remember/recall
任务看板 · 消息收件箱 (SQLite)Related MCP server: Project Relay
安装
依赖:Python 3.12+,推荐 uv。
git clone <repo-url> mcp-agent-hub
cd mcp-agent-hub
uv sync
# 或仅运行时
uv pip install -e .快速开始(Linux 示例)
场景 1:本机多客户端(stdio + 共享 DB)
所有客户端指向同一个 AGENT_HUB_DB 即可互通。主理人手动设在其中一个客户端上。
export AGENT_HUB_DB=/tmp/agent-hub.db
# ① 手动设主:这一端是主理人
mcp-agent-hub stdio --name boss --role-type master --role orchestrator
# ② 其余全是子代理(可开任意多个)
mcp-agent-hub stdio --name coder-1 --role-type subagent --role implementer --capabilities code,test
mcp-agent-hub stdio --name reviewer-1 --role-type subagent --role reviewer --capabilities review,docs
mcp-agent-hub stdio --name tester-1 --role-type subagent --role tester --capabilities test主理人客户端配置(examples/01-master.json):
{
"mcpServers": {
"agent-hub": {
"command": "mcp-agent-hub",
"args": ["stdio", "--name", "boss", "--role-type", "master", "--role", "orchestrator"],
"env": { "AGENT_HUB_DB": "/tmp/agent-hub.db" }
}
}
}子代理客户端配置(换 --name / --role 即可再开 N 个,见 examples/02-04):
{
"mcpServers": {
"agent-hub": {
"command": "mcp-agent-hub",
"args": ["stdio", "--name", "coder-1", "--role-type", "subagent", "--role", "implementer", "--capabilities", "code,test"],
"env": { "AGENT_HUB_DB": "/tmp/agent-hub.db" }
}
}
}场景 2:局域网 / 跨机器(Streamable HTTP)
一台机器起 Hub,其他机器的 Agent 客户端都连上来:
mcp-agent-hub serve --host 0.0.0.0 --port 8765 --db /var/lib/agent-hub/hub.db
# 或
./scripts/run-serve.sh 0.0.0.0 8765客户端配置:
{
"mcpServers": {
"agent-hub": {
"url": "http://192.168.1.10:8765/mcp"
}
}
}HTTP 模式下多个客户端共享一个服务进程。各方先 join_hub 登记身份(主理人可 set_master),工具也可带 agent 参数指定身份。
手动设主的两种方式
启动时指定:
mcp-agent-hub stdio --name boss --role-type master运行时指定:任意 Agent 调用
set_master(name="boss")(exclusive=true会把其他人降为子代理,并改挂汇报线)
之后 join_hub(role_type="subagent") 的新 Agent 会自动挂靠到当前主理人。
协作流程(1 主 + N 子)
步骤 | 主理人 | 子代理(×N) |
1. 设主 |
|
|
2. 派单 |
| 收到 order 消息 |
3. 领会 | — |
|
4. 执行 |
|
|
5. 同步 |
|
|
6. 沉淀 |
|
|
7. 交付 | 收到 report |
|
多个子代理可同时干活;任务池模式用 claim_task 抢占,避免重复劳动。
MCP 工具一览
分组 | 工具 | 说明 |
身份 |
| 登记与在场 |
设主 |
| 手动指定谁是主理人 |
主理人 |
| 派单、盯全员负载 |
子代理 |
| 领活、认领、汇报、交付、上报 |
任务 |
| 看板与改派(支持 |
消息 |
| 点对点、全员广播、房间 |
房间 |
| 频道协作 |
黑板 |
| 跨 Agent 共享记忆(带版本) |
诊断 |
| 总览与事件流 |
环境变量
变量 | 默认 | 说明 |
|
| SQLite 路径(多客户端务必同一文件) |
| — | 默认 Agent 名(也可用 |
|
|
|
| — | 职责描述 |
| — | 能力标签,逗号分隔 |
| — | 子代理汇报的主理人名字(不填则自动挂靠) |
开发
uv sync
uv run ruff check src tests
uv run ruff format src tests
uv run pyright src
uv run pytest
uv run python tests/e2e_mcp_handshake.py设计说明
手动设主:
--role-type master/set_master/join_hub(role_type=master)三种入口。自动挂靠:子代理入网时若未指定
reported_to,自动指向当前主理人。派单:
dispatch_task建任务并给子代理发order消息;可派给任意多个子代理。回报:
report_progress/complete_task自动给主理人发report;escalate标blocked并发escalation。抢占:
claim_task事务内抢占,失败会提示当前持有者。存储:SQLite + WAL,多进程/多客户端并发安全。
传输:
stdio(本机多客户端共享 DB);serve(局域网 Streamable HTTP)。
参考与联调示例(Reference)
本仓库 reference/ 目录收录真实联调中沉淀的问题总结与可直接复用的客户端测试脚本,覆盖通讯、派发、执行、响应、深度探针等完整链路:
reference/hub-integration-reference.md— 安装与联调问题总结:dispatch_task 的 assignee 注册前置约束、streamable_http 客户端 API 差异、轮询按 task_id 精确匹配、真实客户端行为修正、serve 进程生命周期、stdio 与 serve 为独立 Hub 等。reference/test_comm.py— 双客户端 HTTP 全链路通讯(派单→领活→回报→共享黑板 remember/recall→私信)。reference/test_dispatch.py— 向真实子代理派单并验证 order 派令抵达;结束自动取消清理。reference/test_exec.py— 受控子代理 执行→响应 闭环 + 真实客户端轮询。reference/test_probe.py— 针对真实客户端的派发+响应深度探针(order / 私信 / 广播三种触发)。reference/test_dowork.py— 「响应 + 实际做任务」终验:受控子代理真实计算并回报真实产出;真实客户端执行并回报。
运行前置
pip install "mcp[cli]" # 提供 mcp.client.streamable_http
python reference/test_comm.py提示:脚本默认
URL="http://127.0.0.1:8765/mcp",需先mcp-agent-hub serve --host 0.0.0.0 --port 8765起 Hub。dispatch_task 要求 assignee 已join_hub注册(详见reference/hub-integration-reference.md第一节)。
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared space for agents and humans: hubs of live pads, threads and tasks any agent can join.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Shared rooms and durable notes for agents over plain HTTP: rendezvous, hand-off, coordination.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables agents and users to collaborate across rooms with shared tasks, messages, blackboards, documents, search, plugin registration, visualizations, OAuth helpers, and quantum-circuit simulation plus collaborative model training. It runs over STDIO by default, with optional HTTP/SSE deployment for container-based hosting.-
- AlicenseNot gradedqualityBmaintenanceEnables coding agents in different editors and MCP clients to share messages, project context, notes, task ownership, handoffs, and advisory file claims through a local SQLite-backed coordination server. Supports MCP stdio, MCP Streamable HTTP, a JSON HTTP API, and a local CLI for multi-project agent collaboration.MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding-agent sessions on the same machine to collaborate locally and durably by exchanging requests, replies, and task results through an authenticated loopback server with SQLite-backed storage, joined via CLI or an MCP stdio bridge. It also handles message delivery by priority and wait time, deduplicates idempotent sends, enforces task versioning, and preserves artifacts by content hash.30 npmApache 2.0
- AlicenseBqualityAmaintenanceLets multiple AI agents and parallel coding sessions share one memory and task ledger, so they can claim work instead of duplicating it, resume each other's handoffs and reasoning, and use credentials without ever seeing the keys. Connects assistants such as Claude Code, Codex, Cursor, Gemini, ChatGPT and custom agents over MCP, backed by a single local SQLite file or a self-hosted Postgres hub.35MIT