[BUG] /doctor v2.1.122 mislabels home-scope .mcp.json parse error path with cwd-template, masking actual file location
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:
- Report the actual file location parsed (e.g.
Location: /Users/<user>/.mcp.json (resolved via cwd tree-walk)), OR - 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
- Have a broken
.mcp.jsonat~/.mcp.jsonor~/.claude/.mcp.json. Example broken entry (deprecated bare-url schema):{"mcpServers": {"foo": {"url": "http://127.0.0.1:8742/sse"}}}(missingtypediscriminator). - From any directory that does NOT contain a
.mcp.json, runclaudethen/doctor. - Observe MCP Config Diagnostics output — Location field shows
<cwd>/.mcp.json(a path that does not exist on disk). - cd to a different directory, restart
claude, run/doctoragain — Location field now shows the new<cwd>/.mcp.json(still phantom). - The actual broken file remains at
~/.mcp.json— onlyfind ~ -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.
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is diagnostic-integrity failure.
If
/doctormislabels a home-scope.mcp.jsonparse 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:
I would want clarity on:
.mcp.jsonerrors are affected or any non-cwd config sourceA 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.
Updating with prior-art context plus a reply to @0xbrainkid's three questions.
Prior reports of this same root-cause bug (credit due):
.mcp.jsondoesn't exist". 3 thumbs-up. Closed not_planned by stale-bot 2026-04-10.claude mcp addwriting 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:
/doctorinvocation found and parsed the correct file (~/.mcp.json), surfaced the actual schema error from it, then templated theLocation:label from<cwd>/.mcp.jsoninstead of the actual resolved path. The resolver appears to work; the label format is the bug.~/.mcp.json(which Claude Code finds via cwd tree-walk). I did NOT test custom paths via env vars, symlinks, or mid-tree.mcp.jsonfiles between project root and home. Worth widening the test to confirm scope.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.
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.jsoninstead 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.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.