Skip to content

MCP server routing fails when multiple servers share the same name prefix #3704

Description

@ifelseboyxx

What version of Kimi Code is running?

0.41.0

Which open platform/subscription were you using?

Kimi Code subscription

Which model were you using?

k3

What platform is your computer?

macOS

What issue are you seeing?

Kimi Code appears to route MCP tool calls to the wrong MCP server when multiple MCP servers share the same name prefix.

In my configuration, several MCP servers use the common prefix app-ai-h5-, for example:

  • app-ai-h5-figma
  • app-ai-h5-figma-desktop
  • app-ai-h5-chrome-devtools
  • app-ai-h5-showdoc

When I explicitly ask Kimi Code to use app-ai-h5-showdoc, it may repeatedly invoke tools from app-ai-h5-figma-desktop instead.

This happens even when the instruction is explicit and the project AGENTS.md also states that ShowDoc MCP should be used for backend/API documentation.

For example, Kimi Code correctly reasons that it should call the ShowDoc MCP:

The user wants to read a ShowDoc page. Per AGENTS.md, use ShowDoc MCP. The URL: item 664394860, page 206610030. Use get_page with page_id 206610030.

However, the actual tool invocation is:

Used get_figjam
MCP/app-ai-h5-figma-desktop

which fails with:

get_figjam is only available for FigJam files.

Even after repeatedly telling Kimi Code to use app-ai-h5-showdoc, it continues selecting app-ai-h5-figma-desktop.

This makes it look like MCP server selection/routing may be matching or confusing servers based on their common name prefix.

What steps can reproduce the bug?

  1. Configure multiple MCP servers with the same prefix, for example:

{
"mcpServers": {
"app-ai-h5-figma": {
"type": "http",
"url": "https://mcp.figma.com/mcp"
},
"app-ai-h5-figma-desktop": {
"type": "http",
"url": ...
},
"app-ai-h5-chrome-devtools": {
"command": "npx",
"args": [
"-y",
"chrome-devtools-mcp@1.8.0"
]
},
"app-ai-h5-showdoc": {
...
}
}
}

  1. Start Kimi Code in a project where AGENTS.md explicitly says that ShowDoc MCP must be used for backend/API documentation.

  2. Ask Kimi Code to read a ShowDoc page, and explicitly mention that it should use app-ai-h5-showdoc.

Example:

"Use app-ai-h5-showdoc to read ShowDoc page 206610030."

  1. Observe that Kimi Code may invoke a tool from app-ai-h5-figma-desktop, such as get_figjam, instead of invoking the ShowDoc MCP.

  2. Repeat the instruction and explicitly correct the MCP server name.

  3. The wrong MCP server may still be selected repeatedly.

What is the expected behavior?

When an MCP server is explicitly specified by name, Kimi Code should invoke tools from that exact MCP server.

For example, when the user requests:

"Use app-ai-h5-showdoc"

Kimi Code should only select tools exposed by app-ai-h5-showdoc, and should not invoke tools from app-ai-h5-figma-desktop merely because the MCP servers share the app-ai-h5- prefix.

MCP server routing should use an exact server identity rather than an ambiguous or fuzzy prefix-based match.

Additional information

The issue seems correlated with MCP servers sharing the same prefix.

Current naming pattern:

app-ai-h5-figma
app-ai-h5-figma-desktop
app-ai-h5-chrome-devtools
app-ai-h5-showdoc

The model's reasoning appears to identify the correct MCP server and even the expected ShowDoc tool (get_page), but the actual tool dispatch goes to another MCP server.

Example session output:

The user wants to read a ShowDoc page. Per AGENTS.md, use ShowDoc MCP.
The URL: item 664394860, page 206610030.
Use get_page with page_id 206610030.

Actual invocation:

Used get_figjam
MCP/app-ai-h5-figma-desktop

Error:

get_figjam is only available for FigJam files.

This suggests the problem may be in MCP tool/server resolution or dispatch rather than in model intent alone.

As a workaround, renaming the MCP servers so they do not share the same prefix appears worth testing, but ideally exact MCP server names should remain unambiguous regardless of naming similarity.

The important point is that the model appears to understand that app-ai-h5-showdoc should be used, but the actual dispatched tool belongs to app-ai-h5-figma-desktop.

Contribution

  • I am willing to submit a PR for this bug fix myself (please wait for maintainer approval in this issue first)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions