MCP Config Connection error 5 min read

MCP Server Connection Failed — How to Diagnose and Fix It

"Could not connect to MCP server" almost never means the server itself is broken — it's usually the config file, the JSON syntax, or the fact that GUI apps can't find npx on your system PATH. This guide walks through every real cause in Claude Desktop, Claude Code, and Cursor.

Not sure if it's your config or an outage?

Prismix tracks live status for Anthropic, OpenAI, and 80+ AI services · Check live AI status →

Check now →

What causes "MCP server connection failed"?

The error message is generic on purpose — the client (Claude Desktop, Claude Code, or Cursor) tried to spawn or connect to your MCP server process and it didn't come up cleanly. The actual cause is almost always one of these:

Cause How common Fix
command not found (PATH) Very common Use absolute path to npx/uvx/node
Invalid JSON Very common Validate config, remove trailing commas
Wrong config file path Common Confirm the OS-specific path
Server crashes on startup Common Read the server's stderr log
Missing env var Common Add "env" block to server config
Port already in use Occasional (SSE/HTTP servers) Free the port or change it

5 steps to fix MCP connection failures

1

Confirm you edited the right config file

Each client reads MCP server config from a specific, OS-dependent location. Editing a copy in the wrong folder is the single most common reason a change "does nothing":

Claude Desktop config path

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Claude Code reads project-level MCP config from .mcp.json in the repo root, or user-level config via claude mcp add.
  • Cursor reads from .cursor/mcp.json (project) or the global Cursor settings MCP panel.

If the file doesn't exist yet, create it — the app will not generate it for you automatically in most versions.

2

Validate the JSON — syntax errors fail silently

A single trailing comma or a smart quote pasted from a doc site breaks the entire config file, and most clients give no error dialog — the server list just silently fails to load. Correct shape:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/Documents"]
    }
  }
}

Common mistakes to check for:

  • A trailing comma after the last entry in an object or array (invalid in strict JSON).
  • Curly "smart" quotes (“ ”) instead of straight " — common when pasting from a website or Word doc.
  • Missing the top-level "mcpServers" key — server blocks placed at the root are ignored.
  • Backslashes in Windows paths not escaped — use "C:\\\\Users\\\\you\\\\file" or forward slashes instead.

Paste the file into any JSON validator (or run python -m json.tool claude_desktop_config.json) before restarting the app.

3

Use absolute paths — GUI apps don't inherit your shell PATH

This is the most common gotcha and the one people miss the longest. When you type npx in your terminal, your shell (bash/zsh/PowerShell) resolves it using PATH entries set up by nvm, Homebrew, pyenv, etc. Claude Desktop and similar GUI apps are launched by the OS directly — they get a minimal system PATH and often can't find npx or uvx at all, even though they work fine in your terminal.

Fix: find the absolute path and use it

# macOS / Linux
which npx
# -> /Users/you/.nvm/versions/node/v20.11.0/bin/npx

# Windows (PowerShell or cmd)
where npx
# -> C:\Users\you\AppData\Roaming\npm\npx.cmd

Then use that full path as "command" in the config instead of the bare name:

{
  "mcpServers": {
    "filesystem": {
      "command": "/Users/you/.nvm/versions/node/v20.11.0/bin/npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/Documents"]
    }
  }
}
4

Read the server's actual startup error

If the path and JSON are both correct, the server process may be starting and then crashing immediately — missing an environment variable, a missing dependency, or a bug in the server itself. Don't guess — read the log:

  • Claude Desktop (macOS): ~/Library/Logs/Claude/mcp-server-{name}.log
  • Claude Desktop (Windows): %APPDATA%\Claude\logs\mcp-server-{name}.log
  • Claude Code: server stderr is printed directly in your terminal session — scroll up after the connection failure.
  • Cursor: Settings → MCP → click the failed server to expand its error output.

If a required environment variable is missing (common with API-key-based servers), add it to the server's config block:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
      }
    }
  }
}
5

Fully quit and relaunch — not just reload

MCP config is read once at process startup. Closing a window or hitting reload does not re-spawn the server processes. You need a true full quit:

  • macOS: Cmd+Q, or Claude menu → Quit Claude (closing the window with the red dot leaves it running in the background).
  • Windows: right-click the icon in the system tray and choose Quit, or end the process in Task Manager.
  • Cursor / Claude Code: for locally-running MCP servers, restart the editor or run the client's MCP reload command if one is exposed in the command palette.

If it still fails after a clean restart with a valid config and absolute paths, it's almost certainly a bug or missing dependency in the server itself — check the server's own GitHub issues for your exact error string.

FAQ

Why does my MCP server show "connection failed" in Claude Desktop, Claude Code, or Cursor?

The most common causes are a wrong config file path, invalid JSON syntax, the server command not being found because GUI apps don't inherit your shell PATH, the server crashing on startup, or a missing environment variable. Check the client's own logs first — they usually show the exact spawn error.

Why does npx work in my terminal but not when the app launches the server?

GUI apps are launched by the OS, not your shell, so they don't inherit PATH additions from nvm, Homebrew, pyenv, etc. Use the absolute path to the binary (find it with `which npx` or `where npx`) in the config's "command" field instead of the bare name.

Do I need to restart the app after editing the MCP config?

Yes — a full quit, not just closing the window. On macOS use Cmd+Q or Claude menu → Quit; on Windows quit from the system tray icon or end the process in Task Manager. MCP config is only read at process startup.

How do I check MCP server logs?

Claude Desktop writes per-server logs to ~/Library/Logs/Claude/mcp-server-{name}.log on macOS and %APPDATA%\Claude\logs\mcp-server-{name}.log on Windows. Claude Code prints stderr in the terminal. Cursor shows errors under Settings → MCP when you click a failed server.

Can a port conflict cause this error?

Yes, for MCP servers running over SSE or HTTP transport on a fixed local port. Check with `lsof -i :PORT` (macOS/Linux) or `netstat -ano | findstr PORT` (Windows) and free the port or reconfigure the server.

Related guides