Claude Code MCP Not Working? Read the Logs and Fix Common Errors

Claude Code MCP Not Working? Read the Logs and Fix Common Errors

An MCP server that will not connect is one of the most annoying problems in Claude Code, because the status often just says “failed”. The good news is that the claude code mcp logs tell you exactly what went wrong, once you know where they live. In this guide we break a tiny test server on purpose, five different ways, and show what each error looks like and how to fix it.

Browse all our Claude Code tutorials for more guides like this one.

Tested with Claude Code v2.1.322 on November 13, 2026, on macOS. Every error below came from a small local test server in a throwaway project. Steps for remote HTTP servers and sign-in problems follow Anthropic’s official docs, and we say so where that applies.

Claude Code MCP Not Working: The Quick Answer

Run claude mcp list in your project folder first. Each server gets a status, and a failed one shows the reason right on the same line. For more detail on one server, run claude mcp get <name> and read the Issue: line.

If the reason is vague, such as CONNECTION_CLOSED, start Claude Code with claude --debug=mcp. It writes a debug log to ~/.claude/debug/<session-id>.txt, and that file holds the error text your server printed before it died.

What you seeWhat it meansFirst fix to try
Pending approvalA project server you have not approved yetRun claude and approve it
ENOENT: Executable not found in $PATHThe command does not exist on your machineFix the spelling or install the program
CONNECTION_CLOSED: Connection closedThe server started and then quitRead its error in the debug log
MCP config is not a valid JSONA syntax error in .mcp.jsonFix the comma, quote or bracket
connection timed out after ...msThe server was too slow to startRaise MCP_TIMEOUT
Needs authenticationA remote server wants you to sign inOpen /mcp and sign in

Where the Claude Code MCP Logs Live

There are three places to look, and they go from quick to detailed. Most problems are solved at the first or second one. The debug log is for the stubborn cases.

Flow diagram showing how to debug an MCP server in Claude Code: check the status, read the Issue line, open the debug log, fix the cause and reconnect
The debugging path we follow in this guide, from the quickest check to the full debug log

1. The Status Line

claude mcp list runs from your normal shell, so you do not even need to open a session. Inside a session, the /mcp command shows the same servers in a panel, with a check mark, a warning sign or a red cross next to each one.

2. The Issue Line

claude mcp get <name> prints one server’s full setup: its scope, command, arguments and environment variables. When the connection failed, it adds an Issue: line. According to the official MCP docs, that detail is the error code plus any error text the server returned.

3. The Debug Log

The debug log is the full story. You turn it on when you start Claude Code, using one of the flags from the CLI reference.

CommandWhat it does
claude --debugTurns on debug mode for everything
claude --debug=mcpLogs only the MCP category, so the file stays short
claude --debug-file ./mcp-debug.logTurns on debug mode and writes to the file you name

By default the log goes to ~/.claude/debug/<session-id>.txt. On our Mac, Claude Code also kept a shortcut called ~/.claude/debug/latest that points at the newest log, which saves you from hunting for the session ID.

The filter matters. Our unfiltered log from a short session was 311 lines long, while the --debug=mcp log held only the MCP lines. Note that the filter only works in the = form, so write --debug=mcp with no space.

Our Test Setup: A Tiny Server We Can Break

To show real errors, we wrote a small MCP server called notes. It is one Node.js file with no packages to install, and it offers a single tool that lists the files in a notes folder. It refuses to start unless a NOTES_DIR environment variable is set, which gives us an easy way to make it crash.

The server is registered in a project-level .mcp.json file. If you are not sure where that file belongs, our guide to the MCP config file covers every location.

{
  "mcpServers": {
    "notes": {
      "command": "node",
      "args": ["/Users/you/claude-code-demos/sandbox/mcp-logs/project/notes-server.js"],
      "env": { "NOTES_DIR": "/Users/you/claude-code-demos/sandbox/mcp-logs/project/notes" }
    }
  }
}

A failed status tells you that something broke. The log tells you what broke.

Error 1: Pending Approval

The very first check did not show “Connected”. It showed Pending approval. This is not a bug: Claude Code asks before it uses any server that comes from a project’s .mcp.json file, because that file could have been written by someone else.

Terminal showing the .mcp.json file and claude mcp list reporting the notes server as Pending approval
A new project server shows Pending approval until you approve it in a session

The fix is to run claude in the project folder. A prompt appears that names the new server, and you choose to use it.

Claude Code prompt saying a new MCP server was found in this project, with the option Use this MCP server selected
The one-time approval prompt for a server defined in .mcp.json

If you dismissed that prompt earlier, the server stays off. The docs say you can approve it later from /mcp, or reset all your choices for the project with claude mcp reset-project-choices.

Error 2: ENOENT, Executable Not Found

For the first real break, we changed the command from node to nod. This stands in for any case where the program is misspelled or not installed, such as a missing npx, uvx or python.

Terminal output of claude mcp list and claude mcp get notes showing Failed to connect with the issue ENOENT executable not found in PATH
A wrong command gives a clear ENOENT message on the Issue line

This one is easy because the status line already names the problem: ENOENT: Executable not found in $PATH: "nod". You do not need the debug log at all.

To fix it, correct the spelling in command, or install the missing program. A quick test is to type the command by itself in your terminal. If your shell cannot find it, Claude Code cannot find it either.

Error 3: CONNECTION_CLOSED, the Server Crashed

Next we put the command back and removed the env block, so the server starts and then quits with an error. This is the most common kind of failure, and the least helpful one at first glance.

Inside a session, /mcp showed a red cross next to notes, and the server’s detail screen said only “failed”. We started this session with --debug=mcp, so the top of the screen also shows where the log is being written.

Claude Code /mcp panel listing the notes server with a red cross, with the debug log path shown at the top of the session
The /mcp panel flags the failed server, and debug mode prints the log path

From the shell, claude mcp get notes reported CONNECTION_CLOSED: Connection closed. That tells you the server process ended, but not why. This is where the debug log earns its place.

Terminal showing the Issue line CONNECTION_CLOSED, then the debug log lines for the notes server including the server stderr message that NOTES_DIR is not set
The debug log contains the server’s own error: NOTES_DIR is not set

We searched the newest log for our server’s name with this command:

grep '"notes"' ~/.claude/debug/latest

The log had six lines for the server. The key one starts with [ERROR] and says Server stderr: notes-server: NOTES_DIR is not set. That is the message our server printed before it quit, word for word.

The Shortcut: Run the Command Yourself

The docs suggest another check for local servers: run the configured command directly in your terminal. We ran node notes-server.js and got the same error at once, as the last lines of the screenshot show.

If the command starts and then sits there waiting for input, the server itself is fine and the problem is in your config. If it prints an error, that error is your answer. In our case the fix was to put the env block back.

Error 4: Bad JSON in .mcp.json

For the fourth break we deleted one comma from .mcp.json. Hand-edited JSON breaks like this all the time: a missing comma, an extra comma after the last item, or a quote that never closes.

Terminal showing a .mcp.json file with a missing comma and claude mcp list reporting Failed to parse, MCP config is not a valid JSON
One missing comma, and the whole project config fails to parse

This failure looks different. The server does not show as failed, because it never loads at all. Instead, claude mcp list prints a diagnostics block at the end of its output that names the file and says MCP config is not a valid JSON.

When we then ran claude mcp get notes, it answered No MCP server named "notes". So if a server you know you added has vanished, check the bottom of claude mcp list for a parse error before anything else.

The Wrong Key Name

A close cousin of this error is using the wrong top-level key. Some other tools, such as VS Code, store servers under servers. Claude Code wants mcpServers.

Terminal showing a .mcp.json file that uses the key servers and the Claude Code error saying mcpServers is missing and servers was found instead
Claude Code spots the wrong key and tells you which one it expects

The message here is unusually friendly. It says the mcpServers key is missing, that it found servers instead, and which key Claude Code reads. Rename the key and the server loads.

Error 5: Connection Timed Out

Some servers are just slow to start. The docs give the default startup limit as 30 seconds, and note that a first run through npx can be slow while the package downloads.

We made a copy of our server that waits four seconds before it starts, then set the limit to one second to force the error.

Terminal showing claude mcp list with MCP_TIMEOUT set to 1000 reporting that the notes server connection timed out after 1000ms, then connecting with the default limit
The same slow server fails with a one-second limit and connects with the default

The status line read MCP server "notes" connection timed out after 1000ms. With the default limit, the same server connected. To give a slow server more time, set the limit in milliseconds when you start Claude Code:

MCP_TIMEOUT=60000 claude

Bonus: The Relative Path Trap

One more failure is worth showing because it comes and goes. We changed the server path to a relative one, ./notes-server.js.

From the project root it connected. From a subfolder of the same project, it failed with CONNECTION_CLOSED.

Terminal showing a relative path in args connecting from the project root and failing with CONNECTION_CLOSED when claude mcp list is run from a subfolder
A relative path works from one folder and fails from another

Anthropic’s debugging guide explains why: relative paths resolve against the folder you launched Claude Code from, not the location of .mcp.json. Use absolute paths for local scripts. Programs on your PATH, like npx, work as they are.

Fix It and Reconnect Without Restarting

Once you have fixed the config, you do not have to quit your session. We started a session with the crashing config, repaired .mcp.json from inside it, then opened /mcp, selected notes and chose Reconnect.

Claude Code session showing the message Reconnected to notes and the /mcp panel listing notes with a green check mark and 1 tool
After Reconnect, the server shows a green check and its tool count

Claude Code replied Reconnected to notes. and the panel showed a green check with 1 tool. Reconnect picked up the edited file in our test, with no restart.

The docs also describe /mcp reconnect all, which retries every server that failed or needs sign-in. It needs Claude Code v2.1.284 or later.

A green check is good, but the real proof is a tool call. We asked Claude to list the notes, and the server answered.

Claude Code session where the prompt asks to list notes, the notes tool is called and the reply shows meeting.txt and todo.txt
The repaired server answers a real request with the two note files

What About Remote Servers?

Our test server runs locally, so we did not reproduce remote failures. These steps come from Anthropic’s docs for HTTP servers.

  • Needs authentication means the server wants a sign-in. Open /mcp and sign in from the server’s menu, or run claude mcp login <name> in your shell.
  • Failed to connect on a remote server comes with an HTTP status or error code on the same line, which often names the cause, such as a rejected token.
  • To check that a URL is reachable, run curl -I against it. A 401 or 403 means the server is up and wants a sign-in. No response at all points to the URL or your network.
  • Claude Code warns about hidden spaces or line breaks in config values, a common result of pasting a token.

Remote servers also retry in ways local ones do not. The docs say a dropped HTTP server gets up to five reconnect attempts, while a local server that exits is simply marked failed until you reconnect it.

Diagram matching five MCP error messages to their first fix: Pending approval, ENOENT, CONNECTION_CLOSED, Not a valid JSON and Connection timed out
Match the message you see to the first thing to check

Try It Yourself

You can practice on your own setup without breaking anything. Open a project that has at least one MCP server, start Claude Code with claude --debug=mcp, and paste this prompt:

Read the newest file in ~/.claude/debug and tell me, for each MCP server,
whether it connected, how long it took, and any error lines. Do not change anything.

You will get a plain summary of what each server did at startup. It is a safe way to learn what a healthy log looks like before you need it in a hurry.

Common Mistakes

  • Putting the config in the wrong place. The docs list the right files as ~/.claude.json and .mcp.json at the project root. Paths such as ~/.claude/mcp.json are not read.
  • Adding mcpServers to settings.json. The docs say settings files do not read that key.
  • Running claude mcp add in one project and expecting the server in another. Local scope is tied to the project where you added it.
  • Reading only the status and stopping at CONNECTION_CLOSED. The cause is one step further, in the log.
  • Writing --debug mcp with a space. Only the = form applies the filter.

Pro Tips

  • Have your own servers print a clear message before they exit. Ours named the missing variable, and that exact line showed up in the log.
  • Use --debug-file when you want to share a log, since you choose where it lands.
  • The docs list a /debug command that turns on debug logging mid-session and asks Claude to help diagnose the problem.
  • If you suspect a server is hurting your whole setup, the docs suggest claude --safe-mode, which starts with MCP servers and other add-ons turned off. Our guide to the /doctor command covers more checks.
  • On our Mac we also found a per-server log folder under ~/Library/Caches/claude-cli-nodejs/. It held the same lines for notes, but it is not in the docs we read, so treat it as a bonus that may change.
  • Too many servers can crowd your context. See how MCP tool search keeps that in check.

New to all this? Start with our MCP basics guide, pick a server from our Claude MCP Servers Directory, or see the best MCP servers we have tested. You can read more about the assistant itself on our Claude AI page.

Cheat Sheet

Cheat sheet of Claude Code MCP log commands: status checks, debug flags, common errors and how to reconnect
Every command from this guide on one card

Frequently Asked Questions

Where are the Claude Code MCP logs stored?

Start Claude Code with claude --debug or claude --debug=mcp and it writes a debug log to ~/.claude/debug/<session-id>.txt. You can pick another file with --debug-file.

Why does my MCP server say Failed to connect?

Claude Code could not start or reach the server. Run claude mcp get <name> and read the Issue: line. In our tests it was a wrong command, a crash on startup or a slow start.

What does CONNECTION_CLOSED mean?

The server process started and then ended before it finished connecting. Open the debug log and look for the Server stderr line, or run the server’s command yourself to see its error.

Do I need to restart Claude Code after fixing .mcp.json?

Not in our test. We fixed the file, opened /mcp, chose Reconnect on the server, and it connected in the same session.

Why did my MCP server disappear from the list?

A syntax error or a wrong key in .mcp.json stops the file from loading, so its servers are not listed. Look for a “Failed to parse” block at the end of the claude mcp list output.

Conclusion

When Claude Code MCP is not working, resist the urge to reinstall things and read the evidence instead. Check the status with claude mcp list, read the Issue: line with claude mcp get, and open the debug log with claude --debug=mcp when the status is vague. In our five deliberate breaks, every cause was named in one of those three places, and the fix took a minute once we could see it.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top