Skip to content

MCP server names containing '__' break all native MCP tool calls (server not found) #1731

Closed

Description

@myk1yt

Summary

An MCP server whose name contains a double underscore (e.g. my__server) — a legal name per sanitizeMcpName — becomes completely unusable: every native MCP tool call for that server fails with "server not found".

Mechanism

buildMcpToolName("my__server", "do_thing") → mcp--my__server--do_thing (the sanitizer preserves _, collapses only --). But normalizeMcpToolName (src/utils/mcp-name.ts:55) splits on /__|--/, treating every __ as a separator, so the name parses to serverName: "my", toolName: "server--do_thing". The server lookup (findServerNameBySanitizedName) misses and the call deterministically fails; consecutiveMistakeCount increments each attempt.

Repro

  1. Configure an MCP server named my__server (valid — it connects fine, tools are advertised).
  2. Have the model call any of its advertised tools.
  3. Result: "server not found" every time.

Suggested fix

Prefer the canonical -- separator when present (a raw -- can only be a separator since the sanitizer collapses it, while __ may be part of a legal name): split on -- if the name contains it, else fall back to the legacy __ split. Existing tool-name shapes keep working.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions