MCP Shipyard
← Guides

MCP tool name collisions: how clients handle them and how to name yours

Two servers both expose search. What the MCP spec says about collisions, how Claude Code builds full tool names, the length limits that apply, and naming rules plus a CI check for server authors.

tool-namescollisionsnamingclaude-codecursorci
<!-- Evidence of demand (checked 2026-12-03 via WebSearch "MCP tool name collision multiple servers prefix tool names"): Cursor forum thread "MCP Tools Name Collision Causing Cross-Service Tool Call Failures" (opened and read: March 27, 2025, a user reports get_file_contents from one server being routed to another; no staff answer shown); several more Cursor threads on tools routed to the wrong server (seen in search results, not opened); openai-agents-python issue #1167 and docker/mcp-gateway issue #186 on the same problem (seen in search results, not opened); a DEV Community post about eight servers where three pairs shared a tool name (not opened). Spec and client facts are from the pages cited inline. -->

MCP tool name collisions: how clients handle them and how to name yours

A user connects your server next to a GitHub server and a notes server. All three have a tool called search. Depending on the client, the model calls the wrong one, a tool silently disappears, or the client adds a prefix and your tool survives. You cannot control the client. You can control how likely your names are to collide, and whether a prefix pushes them over a limit.

What the spec says

Names are unique per server, not across servers. The 2026-07-28 tools page says it directly:

Tool name uniqueness is scoped to a single server. Clients or proxies that aggregate tools from multiple servers MAY encounter naming collisions (for example, two servers each exposing a search tool) and SHOULD implement a disambiguation strategy such as prefixing tool names with a server identifier.

The same note says the server name from serverInfo is not guaranteed to be unique and SHOULD NOT be relied on for disambiguation. So the spec leaves the fix to clients, and does not tell you what they will do.

The naming rules, identical in 2025-11-25 and 2026-07-28, are all SHOULD: 1 to 128 characters, case-sensitive, only A-Z, a-z, 0-9, _, - and ., no spaces or commas, unique within a server.

What clients do

Claude Code prefixes. A tool is addressed as mcp__<server>__<tool>, where <server> is the name the user gave the server. Its MCP docs show this form and add that Claude Code leaves an MCP tool out of the tools it sends to Claude when the full name is over 128 characters, because the Claude API rejects a request that includes one. So a long server key plus a long tool name can make a tool vanish while the rest of your server works. For servers bundled in plugins the form is longer: mcp__plugin_<plugin-name>_<server-name>__<tool-name>, with any character outside A-Z, a-z, 0-9, _ and - replaced by _. The same page says permission rules, skill allowed-tools lists and hook matchers use this full name.

Claude directory review is stricter than the spec: tool names must be 64 characters or fewer.

Cursor. We found user reports, not documentation. In one forum thread (March 2025, Cursor 0.48.2) a user reported that get_file_contents from a GitHub server won the routing over an Obsidian server's tool of the same name, and a reply argued that Cursor did not namespace tools by server. That is two replies from users and no staff answer on the page, and the behavior may have changed since. Treat "last or first registration wins" as a possible failure, not a documented rule.

VS Code. The MCP configuration reference asks for "a descriptive, unique name for each server you use together" and does not say how a tool name conflict is resolved.

ChatGPT and the OpenAI API. We found no documented collision rule. The Responses API MCP guide lets you restrict imported tools by name with allowed_tools, which is a way for a developer to avoid a clash, not a rule for your server.

Summary: the only client with a documented prefix scheme in what we checked is Claude Code. Assume the others may not prefix.

Naming rules for your server

  1. Never ship a bare generic verb. search, get, query, fetch, list and run are the names that collide. Use verb plus your noun: search_orders, get_invoice. This works with every client because it needs no prefix at all.
  2. Do not add your own brand prefix by default. Claude Code already adds mcp__<server>__, so acme_search_orders becomes mcp__acme__acme_search_orders. A noun that is specific to your product (orders, invoices, shifts) disambiguates without repeating the server key. This is our judgment, not a spec rule.
  3. Budget the length. The full name in Claude Code is mcp__ (5 characters) + server key + __ (2) + your tool name, and must stay at or under 128. The directory limit on your own name is 64. If your tool names are 40 characters, a user's 90-character server key breaks them. Keep names under 40.
  4. Use only [A-Za-z0-9_-]. The spec also allows ., but Claude Code's plugin form replaces other characters with _, so a dot can turn two distinct names into one. Underscores are the safe choice.
  5. A rename is a breaking change. Permission rules and hook matchers in Claude Code reference the full name, so renaming search to search_orders silently breaks a user's allow rule. Add the new tool, keep the old one for a release or two, and say in the old description that it is deprecated. See writing tool descriptions for how the description steers the model.

Check collisions before users do

Run this over every server your users are likely to combine with yours. It reports names that more than one server exposes and names that would exceed a length limit once prefixed. We ran it on sample data and it flagged search as shared by two servers and threw on a 70-character name.

export function findCollisions(servers) {
  const seen = new Map();
  for (const [server, tools] of Object.entries(servers)) {
    for (const t of tools) seen.set(t.name, [...(seen.get(t.name) ?? []), server]);
  }
  return [...seen].filter(([, owners]) => owners.length > 1);
}

// Claude Code form: mcp__<server>__<tool>, at most 128 characters
export function fullName(serverKey, tool) {
  const full = `mcp__${serverKey}__${tool}`;
  if (full.length > 128) throw new Error(`${full.length} chars: ${full}`);
  return full;
}

console.log(findCollisions({
  github: [{ name: 'search' }, { name: 'get_file_contents' }],
  notes:  [{ name: 'search' }, { name: 'create_note' }],
})); // [ [ 'search', [ 'github', 'notes' ] ] ]

Feed it the tools/list result of each server. In CI, fail the build when your own list contains a name from a short blocklist of generic verbs, and when fullName('a-realistic-server-key', name) throws for any tool. A realistic server key is your product name plus the longest suffix a user is likely to add, so test with a 40-character key.

When you are the one aggregating

If you run a gateway that merges servers, the spec says to disambiguate and suggests a server-identifier prefix. Because the server name is not guaranteed unique, take the identifier from configuration you control, not from serverInfo. Keep the prefix stable, since changing it breaks anything that stored the old name. Log a warning for duplicates at startup instead of picking one silently.

Checklist

  • No tool named only search, get, query, fetch, list or run
  • Names use [A-Za-z0-9_-] and stay under 40 characters
  • Renames ship as add-then-deprecate
  • CI checks the 128-character Claude Code form with a long server key
  • You tested your server next to at least two others

Check your server

Run the free scan at /scan for your tool list and descriptions. It does not check name collisions with other servers yet, so run the snippet above against the servers your users combine with yours.

Check your server against these rules

Scan runs the checks from this guide against a live URL and lists each failing rule with its fix.

Scan a server