Multiple DATABASE connectors on one MCP server: tools/list silently exposes only the first connector's tools, and execute_query always routes to the first database
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #1309 来自 @helpcodeai —— 已合并
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
Start with mcp-server.service.ts around lines 109–112, where connectors are ordered, and trace how the MCP endpoint builds tools/list and routes execute_query. The issue also points to the GraphQL and OData prefixing in connectors.controller.ts as an example to compare. Done means all three database tools are exposed per assigned connector and each executes against its own database; add or run endpoint tests for multiple connectors to verify this.
由索引模型根据 Issue 内容生成。
描述
Description
Assigning two or more DATABASE connectors to the same MCP server silently drops all but the first connector's auto-generated tools from tools/list, and every call to the shared tool names (execute_query, get_database_schema, get_example_queries) is executed against the first-registered connector's database. The other databases are not just unlisted — they are completely unreachable through the per-server MCP endpoint, with no error or warning anywhere in the UI.
Multi-connector assignment is a core feature of AnythingMCP (mcp_server_connectors), so a legitimate server configuration serves the wrong (or incomplete) data silently.
Reproduced on self-hosted v0.29.0 (18aa018), and I verified the same code paths are unchanged on current main (6d1d895c, post-0.51.0), so this is not fixed yet.
Steps to Reproduce
- Create two or more DATABASE connectors in one workspace (reproduced with:
mysql-domeos-betaMySQL,service-mesh-rwMySQL,context-forge-pgPostgreSQL). - Assign all of them to one MCP server.
- Call
tools/liston/mcp/{serverId}with a validX-API-Key:
{"jsonrpc":"2.0","id":1,"method":"tools/list"}
- Result: 4 tools —
execute_query,get_database_schema,get_example_queries(all with the first connector's flavor; MySQL in my case) pluskg_how_to_obtain. Expected 9 DB tools (3 per connector). - Call
execute_querywith any SQL — it is always executed against the first-registered connector's database (registration order isorderBy: { id: 'asc' }inmcp-server.service.ts:109-112).
GET /api/mcp-servers/{id} confirms all 3 connectors are assigned (_count.connectors: 3), while /mcp/{id} serves only one connector's tools.
Expected Behavior
- All 9 database tools are exposed (3 per connector), and each routes to its own connector's database.
- Since the SDK requires unique tool names per
McpServerinstance, the natural design (already used elsewhere in the codebase — GraphQL and OData builtins prefix tools with the connector slug, e.g.buildGraphqlBuiltinTools({ prefix: slugifyForPrefix(dto.name) })inconnectors.controller.ts) is to namespace DATABASE builtins per connector, e.g.context_forge_pg_execute_queryor similar. - At minimum, assigning a second DATABASE connector should surface a visible warning, since silent tool dropping is hard to notice.
Actual Behavior
tools/listreturns 4 tools instead of 9+1; six tools silently vanish.- All calls to the shared names route to the first-registered connector — the other databases' data is unreachable, and
execute_queryreturns plausible data from the wrong database, which is worse than an error: nothing suggests anything is missing. - The only trace is a rate-limited (once/hour) backend warn log:
Duplicate tool name "execute_query" on server <id> — skipping the extra copy (check for duplicate connector assignments).
Connector Type
Database
Deployment Method
Docker Compose
Version
No response
Relevant Logs
WARN [McpEndpointController] Duplicate tool name "execute_query" on server <mcpServerId> — skipping the extra copy (check for duplicate connector assignments).
WARN [McpEndpointController] Duplicate tool name "get_database_schema" on server <mcpServerId> — skipping the extra copy (check for duplicate connector assignments).
WARN [McpEndpointController] Duplicate tool name "get_example_queries" on server <mcpServerId> — skipping the extra copy (check for duplicate connector assignments).
Environment
- AnythingMCP v0.29.0, self-hosted
- Connectors: 3× DATABASE (2× MySQL, 1× PostgreSQL)
- MCP client: raw Streamable HTTP with
X-API-Key
- 主要语言
- TypeScript
- 星标
- 856
- 派生
- 82
- 平均合并
- 7 小时 49 分钟
- 30 天内合并 PR
- 302
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
HelpCode-ai/anythingmcp 的其他 Issue
-
enhancement good first issue hacktoberfest help wanted
难度 2/5 1-3 小时 新手友好度 78/100
HelpCode-ai/anythingmcp#982 · 10 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 30/100
HelpCode-ai/anythingmcp#1284 ·
维护者通常 1 天内回复
-
Translate the rest of the admin UI (DE, IT)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 38/100
HelpCode-ai/anythingmcp#1271 ·
维护者通常 1 天内回复
-
DATABASE connectors keep a connection-string password in plaintext and return it to the browser可能已有人在做 @Riteesh-2k6 于 4 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
HelpCode-ai/anythingmcp#1245 · 2 条评论 ·
维护者通常 1 天内回复
-
🎃 New adapter: SonarQube (code quality, Server or Cloud)可能已有人在做 @aj-codespy 于 2 天前认领。 未关闭enhancement hacktoberfest help wanted
难度 3/5 半天 新手友好度 85/100
HelpCode-ai/anythingmcp#1240 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 HelpCode-ai/anythingmcp 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
gnosis/gnosis_vpn#661 ·
维护者通常 1 天内回复
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)未关闭triage:bug-verified
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
fix: reject sourceStorage/packagedStorage bucket that differs from the stack default (fail loud)未关闭
难度 2/5 1-3 小时 新手友好度 82/100
Eyevinn/open-videocore#1300 ·
维护者通常 1 天内回复
-
nextjs-tracking
难度 2/5 1-3 小时 新手友好度 67/100
cloudflare/vinext#4390 ·
维护者通常 1 天内回复
-
kind/bug
难度 2/5 1-3 小时 新手友好度 82/100
kubernetes-sigs/headlamp#8175 ·
维护者通常 2 天内回复