Skip to content
AI Agent How-To

Home ›Fixes

Fix: MCP Server Not Connecting (Claude Desktop or Cursor MCP)

Beginner ~5 min read Last tested November 2026

Updated 2026-11-25

Almost every “MCP server not connecting” problem is one of six causes. The usual ones are the wrong config file, a command the GUI cannot find on PATH, or logs written to stdout. Work through the checks in order before you change the server code. For a hosted OAuth server to sanity-check your client, try the steps in Notion MCP server after the JSON validates. After any server starts, call the same tools from your own Python MCP client.

Prerequisites

Steps

1. Confirm you edited the right config file

ClientConfig file
Claude Desktop (macOS)~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows)%APPDATA%\Claude\claude_desktop_config.json
Cursor (project).cursor/mcp.json in the project root
Cursor (global)~/.cursor/mcp.json

In Claude Desktop on macOS, open Claude → Settings from the menu bar (not the in-window gear), go to Developer, then Edit Config. That opens the correct file.

2. Validate the JSON

One trailing comma breaks everything silently:

python -m json.tool "$HOME/Library/Application Support/Claude/claude_desktop_config.json"

The top-level key must be mcpServers (camelCase).

3. Fully restart the client

Closing the window isn’t enough. On macOS press Cmd+Q; on Windows quit from the system tray. In Cursor, toggle the server off and on from Settings → Tools & Integrations → MCP Tools (disable and re-enable the server). For MCP connection errors in Cursor, open Output (Cmd+Shift+U), choose MCP Logs, and read the latest lines.

4. Read the logs

  • Claude Desktop macOS: ~/Library/Logs/Claude/mcp*.log
  • Claude Desktop Windows: %APPDATA%\Claude\logs\mcp*.log
tail -n 50 -f ~/Library/Logs/Claude/mcp*.log

The server-specific log (mcp-server-NAME.log) shows its stderr, which usually contains the real error.

5. Fix PATH problems (spawn ... ENOENT)

GUI apps don’t load your shell profile, so npx, uv or python from nvm/pyenv/Homebrew often aren’t found. Use absolute paths:

which npx uv python3
{
  "mcpServers": {
    "filesystem": {
      "type": "stdio",
      "command": "/Users/me/.nvm/versions/node/v22.11.0/bin/npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/Documents"]
    }
  }
}

Likewise, env vars from .zshrc aren’t visible. Put them in the server’s "env": {} block.

For Cursor project and global configs (.cursor/mcp.json and ~/.cursor/mcp.json), stdio servers also need "type": "stdio" on each entry, as in the example above.

6. Run the server by hand

Copy the exact command and args into a terminal. If it crashes, you’ll see why. A healthy stdio server just waits silently for input. Better: test with the Inspector:

npx @modelcontextprotocol/inspector <command> <args...>

7. Check stdout pollution

Stdio servers must write only JSON-RPC to stdout. A stray print() or a startup banner causes errors like Unexpected token ... is not valid JSON in the log. Log to stderr instead.

Common error messages (Claude Desktop and Cursor MCP not working)

spawn npx ENOENT / spawn uv ENOENT: step 5.

Server disconnected right after start: the server crashed. Run it by hand (step 6).

Unexpected token / is not valid JSON: stdout pollution (step 7).

Server shows connected but no tools: the server registered no tools, or an older client needs a restart after code changes.

Windows: npx not found even with Node installed: use "command": "cmd", "args": ["/c", "npx", "-y", "..."].

FAQ

Where is the MCP config file?

Claude Desktop on macOS uses ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows it uses %APPDATA%\Claude\claude_desktop_config.json. Cursor uses .cursor/mcp.json in the project, or ~/.cursor/mcp.json for every project.

What does spawn npx ENOENT mean?

The desktop app cannot find npx on PATH. Run which npx in a terminal and put that absolute path in the server’s command field.

Why does the log say Unexpected token?

The server wrote something other than JSON-RPC to stdout. A print statement or a startup banner will do that. Write logs to stderr.