[BUG] /doctor v2.1.122 mislabels home-scope .mcp.json parse error path with cwd-template, masking actual file location

Status Fixed / completed
Reported on v2.1.122
Maintainer reply ✓ Yes — localden
Activity 5 comments · opened Apr 29, 2026 · closed May 8, 2026
💡 Likely answer: A maintainer (localden, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

/doctor MCP Config Diagnostics section reports parse errors against <cwd>/.mcp.json even when the actual broken file lives at ~/.mcp.json or ~/.claude/.mcp.json. The reported Location: field is templated from the current working directory, NOT derived from the file actually being parsed.

Three /doctor invocations from three different cwd values, all reading the SAME actual broken file at ~/.mcp.json, reported three different paths in this session:

# cwd = ~/.claude/plugins/local/
Location: /Users/<user>/.claude/plugins/local/.mcp.json
# cwd = ~/code/ogham-mcp/  (after cd + claude restart)
Location: /Users/<user>/code/ogham-mcp/.mcp.json
# cwd = ~/  (after cd + claude restart)
Location: /Users/<user>/.mcp.json

ls -la confirmed the first two paths did NOT exist on disk — they were phantom paths derived from cwd. Only the third was a real file. find ~ -maxdepth 4 -name '.mcp.json' was the only way to locate the actual broken file.

Makes debugging unnecessarily hard — users chase the diagnostic-reported path, find nothing there, and have to manually find the real file across all possible scopes (home, ~/.claude/, project, etc.).

What Should Happen?

Either:

  1. Report the actual file location parsed (e.g. Location: /Users/<user>/.mcp.json (resolved via cwd tree-walk)), OR
  2. Distinguish two cases in the output:
  • "Expected at <cwd>/.mcp.json (file does not exist — no project config)"
  • "Parsed from ~/.mcp.json (parse error: ...)"

Right now both cases collapse into the same Location: template, so users can't tell whether the reported path is where the bad file actually is, or just where Claude Code expected to find one. A small label change ("Location: <actual-file-path>") would eliminate this entire class of false leads.

Error Messages/Logs

Three real /doctor outputs from a single session, three different cwd values, all reading the SAME actual file at ~/.mcp.json:

# cwd = ~/.claude/plugins/local/
[Failed to parse] Project config (shared via .mcp.json)
Location: /Users/<user>/.claude/plugins/local/.mcp.json
 └ [Error] mcpServers.ogham: Does not adhere to MCP server configuration schema

# cwd = ~/code/ogham-mcp/  (after cd + claude restart)
[Failed to parse] Project config (shared via .mcp.json)
Location: /Users/<user>/code/ogham-mcp/.mcp.json
 └ [Error] mcpServers.ogham: Does not adhere to MCP server configuration schema

# cwd = ~/  (after cd + claude restart)
[Failed to parse] Project config (shared via .mcp.json)
Location: /Users/<user>/.mcp.json
 └ [Error] mcpServers.ogham: Does not adhere to MCP server configuration schema

ls -la confirmed paths 1 and 2 do not exist on disk; only path 3 was real.

Steps to Reproduce

  1. Have a broken .mcp.json at ~/.mcp.json or ~/.claude/.mcp.json. Example broken entry (deprecated bare-url schema): {"mcpServers": {"foo": {"url": "http://127.0.0.1:8742/sse"}}} (missing type discriminator).
  2. From any directory that does NOT contain a .mcp.json, run claude then /doctor.
  3. Observe MCP Config Diagnostics output — Location field shows <cwd>/.mcp.json (a path that does not exist on disk).
  4. cd to a different directory, restart claude, run /doctor again — Location field now shows the new <cwd>/.mcp.json (still phantom).
  5. The actual broken file remains at ~/.mcp.json — only find ~ -maxdepth 4 -name '.mcp.json' reveals where it actually is.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.122 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Workaround: always run find ~ -maxdepth 4 -name '.mcp.json' 2>/dev/null first to locate the real file before trying to fix anything reported by /doctor.

A /mcp config-paths command listing all scopes Claude Code parses (project, home ~/.mcp.json, home-scope ~/.claude/.mcp.json, etc.) would also help users understand the resolution order independent of /doctor errors.

Discovered during yolo-labz/claude-mac-chrome plugin install on macOS Apple Silicon. Spent ~30 minutes chasing two phantom paths before running find to locate the real file. For users less familiar with shell tree-walks and MCP config scopes, this could be much longer.

View original on GitHub ↗

5 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/40481
  2. https://github.com/anthropics/claude-code/issues/16022
  3. https://github.com/anthropics/claude-code/issues/18714

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

0xbrainkid · 5 months ago

This is diagnostic-integrity failure.

If /doctor mislabels a home-scope .mcp.json parse error as a cwd-template path, then the tool that is supposed to shorten debugging is actively pointing users at the wrong location. That turns diagnosis into misdirection.

Why it matters:

  • users will inspect and edit the wrong file
  • parse errors already create uncertainty; a false path compounds it immediately
  • trust in the doctor command drops because it no longer acts as a reliable witness to config state

I would want clarity on:

  1. whether the wrong path is coming from a templated display layer or from the underlying resolver itself
  2. whether only home-scope .mcp.json errors are affected or any non-cwd config source
  3. whether the command can surface both resolved source and display source until the mapping bug is fixed

A diagnostic tool has to be more precise than the problem it is diagnosing. If it misstates file location, users lose the shortest path to recovery.

pablo-brown-rodriguez · 5 months ago

Updating with prior-art context plus a reply to @0xbrainkid's three questions.

Prior reports of this same root-cause bug (credit due):

  • #16022 (Jan 2026, @zz5678) — framed as "misleading error when project-level .mcp.json doesn't exist". 3 thumbs-up. Closed not_planned by stale-bot 2026-04-10.
  • #18714 (Jan 2026, @dshouzhi) — same root cause, closed as duplicate.
  • #40481 (Mar 2026, @OmicMD) — primary scope is claude mcp add writing invalid schema, but the issue body explicitly notes as a side observation: "/doctor walks up the directory tree merging .mcp.json files from parent directories, but reports errors against the project-level .mcp.json path even when the error is from a parent directory's config". OPEN, stale-labeled.

Keeping #54495 open as the only issue where this mislabel behavior is the primary scope (vs. side note in #40481, vs. closed in #16022/#18714). The 3-cwd repro evidence here may also help Anthropic triage faster than the prior framings did.

Re @0xbrainkid's questions, based on the 3-cwd repro:

  1. Display layer vs resolver? Speculative without source access, but the 3-cwd evidence suggests display-layer: each /doctor invocation found and parsed the correct file (~/.mcp.json), surfaced the actual schema error from it, then templated the Location: label from <cwd>/.mcp.json instead of the actual resolved path. The resolver appears to work; the label format is the bug.
  1. Only home-scope, or any non-cwd config source? I only tested home-scope ~/.mcp.json (which Claude Code finds via cwd tree-walk). I did NOT test custom paths via env vars, symlinks, or mid-tree .mcp.json files between project root and home. Worth widening the test to confirm scope.
  1. Surface both resolved and display source? Yes, that's effectively my "Expected behavior" suggestion (option 1) — Location: /Users/<user>/.mcp.json (resolved via cwd tree-walk from <cwd>) would solve this without any underlying resolver change. Two-line label format would let users know both where Claude Code looked and where it actually found the bad file.

Filing a follow-up cross-link on #40481 to consolidate the open-issue surface area for Anthropic.

localden collaborator · 5 months ago

Thank you for your report. We've shipped a fix — /doctor's MCP Config Diagnostics section now reports the actual file path of the broken .mcp.json instead of templating from the current working directory. It'll be in the next Claude Code release. If you still see issues after updating, please reopen this issue.

github-actions[bot] · 3 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.