Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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,296 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #1309 来自 @helpcodeai —— 已合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
api, backend, databases

调研方向

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 内容生成。

描述

bug
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
  1. Create two or more DATABASE connectors in one workspace (reproduced with: mysql-domeos-beta MySQL, service-mesh-rw MySQL, context-forge-pg PostgreSQL).
  2. Assign all of them to one MCP server.
  3. Call tools/list on /mcp/{serverId} with a valid X-API-Key:
{"jsonrpc":"2.0","id":1,"method":"tools/list"}
  1. Result: 4 tools — execute_query, get_database_schema, get_example_queries (all with the first connector's flavor; MySQL in my case) plus kg_how_to_obtain. Expected 9 DB tools (3 per connector).
  2. Call execute_query with any SQL — it is always executed against the first-registered connector's database (registration order is orderBy: { id: 'asc' } in mcp-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 McpServer instance, 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) }) in connectors.controller.ts) is to namespace DATABASE builtins per connector, e.g. context_forge_pg_execute_query or similar.
  • At minimum, assigning a second DATABASE connector should surface a visible warning, since silent tool dropping is hard to notice.
Actual Behavior
  • tools/list returns 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_query returns 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

HelpCode-ai/anythingmcp 的其他 Issue

查看 HelpCode-ai/anythingmcp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。