Skip to content

FastMCP discovery ignores Claude Code's local-over-user server precedence #5517

Description

@mikamikasuki

What happened?

Problem

When a Claude Code user-scope MCP server and a project-local MCP server use the same name, fastmcp discover returns both entries as claude-code:<name>. A bare fastmcp list <name> or fastmcp call <name> ... fails as ambiguous and prints the same qualified alternative twice. Using that qualified name selects the user-scope entry because FastMCP scans user entries first.

Claude Code documents that local definitions override user definitions with the same name. This means FastMCP's suggested disambiguation both fails to distinguish the entries and can silently choose a different server than the active Claude Code configuration.

Reproduction

In a project directory, configure ~/.claude.json with a top-level user server named weather that runs user-weather, plus projects[<resolved-project-path>].mcpServers.weather that runs local-weather. With the current FastMCP CLI:

  1. fastmcp list weather exits with an ambiguous-name error.
  2. The error suggests 'claude-code:weather' twice.
  3. fastmcp list claude-code:weather resolves to user-weather, although Claude Code's documented precedence selects local-weather.

The same underlying name resolver is used by list, call, and other client commands. Three isolated fresh-process reproductions against current main returned the same results; unique user-only and local-only controls both resolved successfully. The local MRE uses a temporary home and does not read or modify the real user's Claude configuration.

Expected behavior

Discovery should apply Claude Code's scope precedence when the same server name appears in multiple Claude Code scopes. The effective local entry should be selected, or the CLI should expose distinct scope-qualified identifiers that can actually select each entry. A repeated identical claude-code:<name> suggestion should not be presented as a disambiguation.

Related work

Open issue #5094 reports a Windows path-format mismatch that hides project-scoped Claude Code servers. This report is separate: it reproduces on the supported path layout and concerns same-name scope precedence and resolution.

Example Code

Version Information

- FastMCP main: `5baeacfe20eca735cb949564b4915f93a622b916`
- Python: 3.12.15
- OS: macOS 15.0.1 arm64

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. Reports of errors, unexpected behavior, or broken functionality.cliRelated to FastMCP CLI commands (run, dev, install) or CLI functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions