Claude Code — MCP server not loading, tools missing from session
Claude Code has its own MCP configuration system, distinct from Claude Desktop. Servers configured for Desktop do not automatically load in Code — and vice versa.
Quick fix (TL;DR)
.mcp.json in the repo root), local (.claude/settings.local.json), and user (~/.claude/settings.json). Fix missing servers by (a) using claude mcp list to see what is actually loaded, (b) using claude mcp add instead of editing files by hand, and (c) approving the project scope on first entry to the directory.Real error messages you'll see
These are the exact strings returned by the Claude API service and its SDKs when this error occurs. Copy-paste-searching any of them should land on this page.
$ claude mcp list
No MCP servers configured for this project.
(but ~/.claude.json has "mcpServers": {...})$ claude mcp list my-postgres: ✓ connected $ claude > what tables are in my database? (no tools called — Claude answers from parametric knowledge)
$ claude ⚠ New MCP servers found in .mcp.json: - my-analytics - my-postgres Do you trust these servers? [y/N]
Reference
MCP config scopes in Claude Code (highest precedence first)
| Scope | File | Shared? |
|---|---|---|
| project | .mcp.json at repo root | Yes — checked in for the team |
| local | .claude/settings.local.json | No — personal to your checkout |
| user | ~/.claude/settings.json | No — applies to all projects |
<code>claude mcp</code> CLI commands
| Command | Purpose |
|---|---|
claude mcp list | List servers loaded in this project |
claude mcp add <name> --scope [project|local|user] -- <command> | Add a stdio server |
claude mcp add-json <name> <json> | Add a full config JSON |
claude mcp add --transport sse <name> <url> | Add an SSE server |
claude mcp remove <name> --scope ... | Remove a server |
claude mcp reset-project-choices | Re-prompt trust decisions for the current project |
Root causes, ranked by frequency
Based on developer reports across Claude API forums, GitHub issues, and Anthropic community during 2025–2026.
- 26%Server configured for Claude Desktop, not Claude Code. Claude Desktop reads
~/Library/Application Support/Claude/claude_desktop_config.json; Claude Code does not. - 18%Project
.mcp.jsonnot yet trusted. First entry to the directory prompts for trust; declining leaves the servers unloaded silently. - 14%Server loads but does not advertise expected tools. Connection succeeds,
tools/listreturns an empty array — server misconfiguration. - 10%Wrong scope for the config. Added at user scope; project has its own
.mcp.jsonthat overrides. - 8%Command path wrong or missing. Same PATH issue as Claude Desktop — commands added by hand often lack absolute paths.
- 7%Trust decisions cached but user changed scope. Trust choice was made under user scope; new project scope needs re-approval.
- 10%Environment variables not propagated. Server needs
DATABASE_URLor an API key that lives in the user's shell, not in the MCP config. - 7%Server crashes on startup. Silent —
claude mcp listshows connected briefly then disconnects.
Fixes — copy-paste solutions
Add MCP servers using the CLI, not by editing files
Use claude mcp add with an explicit --scope. The CLI writes to the correct file, tests the config, and updates the trust registry.
# Add a stdio server at PROJECT scope (checked into .mcp.json) claude mcp add postgres \ --scope project \ -- /opt/homebrew/bin/uvx mcp-server-postgres \ --connection-string "postgres://user:pass@localhost/mydb" # Add a stdio server at USER scope (all projects, personal) claude mcp add filesystem \ --scope user \ -- /opt/homebrew/bin/uvx mcp-server-filesystem /Users/me/projects # Add an SSE remote server claude mcp add company-tools \ --scope project \ --transport sse \ https://mcp.internal.example.com/sse # Add with a full JSON blob (env vars, args) claude mcp add-json postgres '{ "command": "/opt/homebrew/bin/uvx", "args": ["mcp-server-postgres"], "env": {"DATABASE_URL": "postgres://..."} }' --scope project # Verify claude mcp list # postgres: ✓ connected (project scope) # filesystem: ✓ connected (user scope) # Test each server's tools directly claude mcp inspect postgres # opens the Inspector for that server
.mcp.json at the repo root and is meant to be checked in. Local scope writes to .claude/settings.local.json. User scope writes to ~/.claude.json.Handle project-scope trust prompts intentionally
When a project ships .mcp.json, Claude Code prompts on first entry: "Do you trust these servers?" The answer is stored and never asked again for that project. If you missed the prompt (or misclicked), reset with claude mcp reset-project-choices.
# On first cd into a repo with .mcp.json: $ cd my-repo $ claude ⚠ New MCP servers found in .mcp.json: - postgres - github Do you trust these servers? They will run with your file access. [y/N] # If you answered "y" — trust is recorded, servers load on every future entry. # If you answered "N" — servers stay unloaded silently until you re-prompt. # Re-prompt for the current project: claude mcp reset-project-choices claude # you will be asked again on next start # Check current trust status cat ~/.claude.json | jq '.projects."/absolute/path/to/my-repo".trustedMcpServers'
CLAUDE_TRUST_ALL_MCP=1 to auto-accept trust prompts. Do this only in disposable containers — it accepts arbitrary servers a repo happens to ship.Diagnose loading failures with the Inspector and verbose logs
Use claude mcp inspect to open the MCP Inspector against a specific server. Read Claude Code's per-server log to see startup errors. Cross-check that the server advertises tools.
# 1) List loaded servers and their status claude mcp list # postgres: ✓ connected # github: ✗ startup failed (see log) # custom: ✓ connected (0 tools) ← connected but useless # 2) Read the per-server log ls ~/.claude/logs/mcp/ # mcp-server-github-2026-07-30.log tail -f ~/.claude/logs/mcp/mcp-server-github-*.log # 3) Inspect a specific server (interactive) claude mcp inspect github # opens the MCP Inspector UI at localhost:5173 # 4) Run the server manually to see stderr directly /opt/homebrew/bin/uvx mcp-server-github # (typically errors are clearer here than through the client wrapper) # 5) Enable verbose logging for the whole session CLAUDE_MCP_LOG_LEVEL=debug claude # 6) Confirm the server is advertising tools echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | \ /opt/homebrew/bin/uvx mcp-server-github
tools/list returns a non-empty array.Prevention checklist
Ship these seven safeguards once and this error stops appearing in your logs.
- Configure MCP with
claude mcp add; do not hand-edit config files. - Use project scope (
.mcp.json) for team-wide servers and check the file in. - Use absolute command paths — never rely on the shell PATH inherited by the CLI.
- Verify with
claude mcp listafter every config change. - For CI/headless runs, set
CLAUDE_TRUST_ALL_MCP=1only in disposable containers. - When a server advertises no tools, run it through
claude mcp inspectto confirm the manifest. - Document required env vars in the
.mcp.jsoncomments so teammates set them before first run.
Frequently asked questions
claude_desktop_config.json; Claude Code reads .mcp.json and settings.json files. Servers must be configured separately for each. You can copy the JSON between them but the file locations differ..mcp.json is checked into a repo. A malicious repo could ship an MCP server that reads your files or exfiltrates data. The trust prompt is a one-time gate ensuring you consciously accept servers a repo brings.claude mcp add --scope user .... Written to ~/.claude.json, applies to every project. Project scope overrides user scope for the same server name.claude mcp remove <name> --scope [project|local|user]. Without --scope the CLI removes from local scope by default. Verify with claude mcp list afterwards..env loaded by your shell. Claude Code inherits the shell environment when launched, so MY_KEY defined in ~/.zshrc is available to server processes.Related errors & hubs
Get the weekly AI-error digest
New fixes, provider status recaps, and one deep tutorial — every Tuesday. 8,400+ engineers.