magpie
magpie copied to clipboard
[feat] MCP 路由器按需加载白名单(hubSearchers)加入 cindy,避免双层延迟加载
现象
在 internal/gateway/hub_ondemand.go 中,目前原生支持延迟加载 MCP 的 Agent 白名单为:
var hubSearchers = []string{"claude", "claude-desktop", "codex", "pi", "droid", "omp", "agy", "antigravity"}
其中没有包含 "cindy"。当给 Cindy 接入的 MCP 工具数超过 hubOnDemandOver(10 个)时,Magpie 会对 /mcp/magpie/hub/cindy 将工具折叠为 find_tools + call_tool。
原因分析
Cindy 自身内置的三个运行时都已经原生做了 MCP 延迟加载 / 渐进披露:
- Pi 运行时(Cindy 默认引擎):通过
cindy-bridge.ts提供cindy_mcp_list_tools+cindy_mcp_call_tool(按需查询 schema 并持久化mcp-disclosure-<sessionId>.json),且 Pi 原生 MCP 本身也已在hubSearchers中("pi"); - Codex 运行时:支持
tool_search(已在hubSearchers中作为"codex"); - Claude Code 运行时:支持
ENABLE_TOOL_SEARCH(已在hubSearchers中作为"claude")。
因此未把 "cindy" 加入 hubSearchers 会导致超过 10 个工具时出现双层套娃延迟加载(先走 Cindy 侧按需披露,再调 Magpie 的 find_tools / call_tool 搜一遍),与此前 antigravity / droid / omp 加入 hubSearchers 的原因一致。
建议
将 "cindy" 加入 internal/gateway/hub_ondemand.go 的 hubSearchers 白名单,由 Cindy 自身负责 MCP 工具的按需加载。
环境
- Magpie:
0.1.4862(Windows) - Cindy:
0.1.146