claude-code - 💡(How to fix) Fix claude mcp add --scope user writes to a location claude mcp list does not read [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54803Fetched 2026-04-30 06:35:32
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×2cross-referenced ×1

claude mcp add --scope user <name> ... reports success and writes the entry to ~/.claude.jsonmcpServers.<name>, but the entry is then invisible to claude mcp list, claude mcp get <name>, and the chat REPL's MCP loader. Tools from these servers never become available, even after fully quitting and relaunching Claude Code.

The same servers, defined in a project-scope .mcp.json, load correctly. Only user scope is affected.

Error Message

  1. 2.1.122 then refuses to surface the entry through any read path. claude mcp list, claude mcp get X, and the chat REPL's MCP loader all behave as if it does not exist. No warning, no error, no log.
  • OR claude mcp add --scope user should fail with a clear error if the target schema/location for user-scope has changed in this version. Medium-high. The CLI's write surface for user-scope MCPs has been silently no-op for the read path across at least three minor versions, with no surfaced error. This breaks any workflow that expects claude mcp add --scope user to actually register a server and any setup script that relies on it.

Root Cause

claude mcp add --scope user <name> ... reports success and writes the entry to ~/.claude.jsonmcpServers.<name>, but the entry is then invisible to claude mcp list, claude mcp get <name>, and the chat REPL's MCP loader. Tools from these servers never become available, even after fully quitting and relaunching Claude Code.

The same servers, defined in a project-scope .mcp.json, load correctly. Only user scope is affected.

Fix Action

Workaround

Move definitions to project-scope .mcp.json. Loses the cross-project benefit of user-scope and conflicts with setup scripts that delete project-root .mcp.json to avoid placeholder leaks.

Code Example

Added stdio MCP server X with command: ... to user config
   File modified: /Users/<user>/.claude.json

---

claude mcp add --scope user mcp-probe-test --transport http https://example.com/mcp

---

Added HTTP MCP server mcp-probe-test with URL: https://example.com/mcp to user config
   File modified: /Users/<user>/.claude.json

---

$ python3 -c "import json; print(json.load(open('~/.claude.json'.replace('~','/Users/<user>'))).get('mcpServers',{}).get('mcp-probe-test'))"
   {'type': 'http', 'url': 'https://example.com/mcp'}

---

$ claude mcp list 2>&1 | grep -i probe
   (no output)

   $ claude mcp get mcp-probe-test
   No MCP server found with name: "mcp-probe-test". Configured servers: claude.ai Adobe ...
RAW_BUFFERClick to expand / collapse

claude mcp add --scope user writes to a location claude mcp list does not read — user-scope stdio/http MCP servers silently invisible

Summary

claude mcp add --scope user <name> ... reports success and writes the entry to ~/.claude.jsonmcpServers.<name>, but the entry is then invisible to claude mcp list, claude mcp get <name>, and the chat REPL's MCP loader. Tools from these servers never become available, even after fully quitting and relaunching Claude Code.

The same servers, defined in a project-scope .mcp.json, load correctly. Only user scope is affected.

Key point — write/read inconsistency

This is the core of the bug. The CLI's documented user-scope flow is end-to-end broken in 2.1.122:

  1. claude mcp add --scope user X ... explicitly reports success:
    Added stdio MCP server X with command: ... to user config
    File modified: /Users/<user>/.claude.json
  2. The file is in fact modified — ~/.claude.jsonmcpServers.X is present and JSON-valid afterwards.
  3. 2.1.122 then refuses to surface the entry through any read path. claude mcp list, claude mcp get X, and the chat REPL's MCP loader all behave as if it does not exist. No warning, no error, no log.

The bug is squarely between the write path of claude mcp add and the read paths of claude mcp list / claude mcp get / chat REPL loader. Same code path is hit by:

  • The minimal probe in the Reproduction section below (mcp-probe-test)
  • Any setup script that uses claude mcp add --scope user (e.g. the common pattern envsubst < template.json | python3 register.py --scope user that calls the CLI for each entry)

Setup scripts using the documented CLI are correct; they cannot register working user-scope MCPs in this version regardless of how they are written.

Environment

  • Claude Code: 2.1.122 (also reproduced on 2.1.121, 2.1.119)
  • Platform: macOS, Darwin 25.4.0, arm64
  • Shell: zsh
  • File: ~/.claude.json is JSON-valid, owned by current user, mode 0600

Reproduction

  1. Start with no user-scope MCP entries (or any state).
  2. Register a new HTTP MCP via the official CLI:
    claude mcp add --scope user mcp-probe-test --transport http https://example.com/mcp
    CLI replies:
    Added HTTP MCP server mcp-probe-test with URL: https://example.com/mcp to user config
    File modified: /Users/<user>/.claude.json
  3. Confirm the write landed:
    $ python3 -c "import json; print(json.load(open('~/.claude.json'.replace('~','/Users/<user>'))).get('mcpServers',{}).get('mcp-probe-test'))"
    {'type': 'http', 'url': 'https://example.com/mcp'}
  4. Try to read it back via the same CLI:
    $ claude mcp list 2>&1 | grep -i probe
    (no output)
    
    $ claude mcp get mcp-probe-test
    No MCP server found with name: "mcp-probe-test". Configured servers: claude.ai Adobe ...
  5. Quit Claude Code (IDE extension, fully — not just reload window). Relaunch. The deferred-tool list still does not include any mcp__mcp-probe-test__* tools. The chat REPL's /mcp slash command also does not list it.

Expected

Either:

  • The entry written by claude mcp add --scope user should be visible to claude mcp list, claude mcp get, and the chat REPL.
  • OR claude mcp add --scope user should fail with a clear error if the target schema/location for user-scope has changed in this version.

Actual

The write path and read path operate on different sources. Writes succeed silently to ~/.claude.json. Reads enumerate only:

  • Cloud MCPs (claude.ai *)
  • Plugin MCPs (plugin:*)

User-scope entries in ~/.claude.jsonmcpServers are silently ignored.

Scope

Affects all entry types in mcpServers, including:

  • {"type": "stdio", "command": "...", "args": [...], "env": {...}} (e.g. uvx snowflake-labs-mcp ...)
  • {"type": "http", "url": "..."} (probed with https://example.com/mcp test entry above)
  • Mixed entries (some with env: {} added by CLI, some without — both equally invisible)

Additional observations

  • claude mcp add --scope user X ... correctly detects an existing entry as a duplicate (says "MCP server X already exists in user config"), proving the read path on the write side does see ~/.claude.jsonmcpServers. So the inconsistency is specifically between the add-conflict-check path and the list/get/load paths.
  • Project-scope .mcp.json in the project root works as expected; the same server config that is invisible at user scope shows Status: ✓ Connected when placed at project scope.
  • Disassembly suggests the loader runs each entry through a Zod safeParse and silently drops failures (binary contains the string has invalid mcpServers item: and code shaped like if ($.success) O[T] = $.data). I can't determine without source what schema field is failing, but it's failing for every entry — including ones the CLI itself just wrote — so this is not a user-config issue.
  • File permissions on ~/.claude.json are 0600 owned by the running user (binary contains the suggestion string Check ~/.claude.json permissions but perms appear correct).
  • Reproduces from a trusted directory (hasTrustDialogAccepted: true) and a non-trusted directory equally.

Workaround

Move definitions to project-scope .mcp.json. Loses the cross-project benefit of user-scope and conflicts with setup scripts that delete project-root .mcp.json to avoid placeholder leaks.

Severity

Medium-high. The CLI's write surface for user-scope MCPs has been silently no-op for the read path across at least three minor versions, with no surfaced error. This breaks any workflow that expects claude mcp add --scope user to actually register a server and any setup script that relies on it.

extent analysis

TL;DR

The issue can be worked around by moving user-scope MCP definitions to project-scope .mcp.json files, although this loses the cross-project benefit of user-scope configurations.

Guidance

  • The root cause appears to be a discrepancy between the write and read paths for user-scope MCP configurations in ~/.claude.json.
  • The claude mcp add --scope user command successfully writes to ~/.claude.json but the entry is not visible to claude mcp list, claude mcp get, or the chat REPL loader.
  • Moving definitions to project-scope .mcp.json is a viable workaround, despite its limitations.
  • To verify the workaround, add an MCP server using claude mcp add with the project scope and confirm it is visible through claude mcp list and other read paths.

Example

No code snippet is provided as the issue is related to the behavior of the claude command-line tool rather than a specific code implementation.

Notes

The exact cause of the discrepancy between the write and read paths is not specified, but it is suggested that there may be an issue with the schema validation using Zod safeParse. Further investigation into the claude tool's source code or documentation may be necessary to fully resolve the issue.

Recommendation

Apply the workaround by moving user-scope MCP definitions to project-scope .mcp.json files. This approach, although not ideal, allows for functional MCP configurations until a more permanent fix is available for the user-scope issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING