MoonshotAI / MoonshotAI/kimi-code
MCP server routing fails when multiple servers share the same name prefix
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
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-figmaapp-ai-h5-figma-desktopapp-ai-h5-chrome-devtoolsapp-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?
- 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": {
...
}
}
}
-
Start Kimi Code in a project where AGENTS.md explicitly says that ShowDoc MCP must be used for backend/API documentation.
-
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."
-
Observe that Kimi Code may invoke a tool from
app-ai-h5-figma-desktop, such asget_figjam, instead of invoking the ShowDoc MCP. -
Repeat the instruction and explicitly correct the MCP server name.
-
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the MCP configuration and AGENTS.md guidance described here, using several servers that share the app-ai-h5- prefix. Trace the MCP server and tool selection from the explicit app-ai-h5-showdoc request through the actual get_figjam dispatch. Done means exact server requests consistently invoke only that server's tools, with the reproduction no longer selecting app-ai-h5-figma-desktop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100