Skip to content

MCP Server Connection Issues

You added the Postgres MCP, restarted Cursor, and the tool list is still empty with a red dot next to the server. Or Claude Code prints spawn npx ENOENT the moment it tries to launch the server. Or the connection works on your machine but a teammate gets Client closed every single time. MCP connection failures are almost always one of four things: the binary cannot be found, an environment variable is missing, an auth token is wrong or expired, or the transport never completes a handshake.

This guide walks the diagnosis in order, gives you paste-ready prompts that make the agent itself surface the real error, and covers the OS-specific fixes (PATH, Gatekeeper, firewalls) that the official docs gloss over.

  • A five-step diagnostic order that isolates the failure before you start guessing
  • Copy-paste prompts that make Cursor, Claude Code, or Codex report the exact stderr from a failing server
  • The real fixes for spawn ENOENT, stale npx caches, and missing PATH entries
  • Where each tool writes its MCP logs and how to read them
  • Platform-specific fixes for macOS Gatekeeper, Windows execution policy, and Linux permissions

Connection problems feel random until you check them in the right sequence. Each step rules out a whole class of causes.

  1. Can the server start at all? Run the exact launch command from your config in a plain terminal. If it fails there, it will fail inside the client.
  2. Is the binary on PATH? GUI apps (Cursor) and login shells often have a different PATH than your interactive terminal. spawn ENOENT almost always means the client cannot find npx/node/uvx.
  3. Are the credentials present and valid? Missing env vars and expired OAuth tokens both surface as “connected but no tools” or “permission denied.”
  4. Did tool registration complete? A server can connect and still advertise zero tools if it crashed during init. Read the stderr.
  5. Is the transport healthy? For remote/HTTP servers, check the URL, the firewall, and any corporate proxy.

”No Tools Found” or Server Not Visible

Section titled “”No Tools Found” or Server Not Visible”

The most common symptom: the server appears in your config but shows a red/error dot and contributes no tools.

Symptoms: red indicator next to the server, “No tools found”, server missing from the tool list.

Terminal window
# 1. Validate the config JSON (a trailing comma silently breaks the whole file)
cat ~/.cursor/mcp.json # global, or .cursor/mcp.json in the project
# 2. Run the server's launch command manually to see real errors
npx -y postgres-mcp
# 3. Fully quit and reopen Cursor (Cmd/Ctrl+Q, not just close the window)

A minimal, valid stdio entry — Cursor’s schema supports only command/args/env for stdio and url/headers for remote servers:

{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "postgres-mcp"],
"env": { "DATABASE_URL": "${DATABASE_URL}" }
}
}
}

These errors mean the server process never started. The launcher binary is missing from the client’s PATH, or the package failed to resolve.

Terminal window
# Clear a poisoned npx cache, then re-resolve
npx clear-npx-cache
# Confirm the launcher binaries the client will use
node --version # active Node LTS, e.g. 22.x
npx --version
# Run the server command directly — the fastest way to see the real error
npx -y postgres-mcp

The PATH mismatch is the usual culprit: a GUI app inherits the OS login PATH, not your shell’s .zshrc/.bashrc additions.

Terminal window
# Find where node actually lives, then make sure the client can see it
which node # e.g. /Users/you/.nvm/versions/node/v22.14.0/bin/node
# If you use nvm/asdf, point the config at the absolute path instead of bare "npx":
# "command": "/Users/you/.nvm/versions/node/v22.14.0/bin/npx"

Version-manager installs are the #1 cause of spawn ENOENT in GUI clients, because the shim is only on PATH inside an interactive shell. Either launch the GUI from a terminal that has the version manager loaded, or hard-code the absolute path to npx/node in the config.

A connected server with zero tools, or “permission denied” on every call, is almost always a credential problem: a missing env var, an expired OAuth token, or a token whose scope is too narrow.

Reference secrets from your environment instead of hardcoding them. Export the variable in your shell profile, then interpolate it:

{
"mcpServers": {
"api-server": {
"command": "npx",
"args": ["-y", "@example/server"],
"env": { "API_KEY": "${MY_API_KEY}" }
}
}
}

For OAuth-backed remote servers, Cursor opens a browser flow on first connect — check that no popup blocker is swallowing it, and that the server’s redirect URL is whitelisted.

Terminal window
# macOS quarantines downloaded binaries; clear the flag if a server is blocked
xattr -d com.apple.quarantine /path/to/mcp/server
# Check whether a local server's port is already taken
lsof -i :3845
Terminal window
# Allow locally-created scripts to run (per-user, no admin needed)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Terminal window
# Never install global npm packages with sudo — fix the prefix instead
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# Use a version manager and an active LTS (Node 18 is EOL)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
nvm install 22
nvm use 22

Remote and local HTTP-transport servers add a network layer that stdio servers do not have.

Terminal window
# Confirm a local server is actually listening on its port
curl http://127.0.0.1:3845/mcp
# If 127.0.0.1 is blocked but the server binds 0.0.0.0, target that host:
# "url": "http://0.0.0.0:3845/mcp"

When the agent’s own report is not enough, go to the logs directly:

Open the Output panel (Cmd/Ctrl+Shift+U) and select MCP Logs from the dropdown. Look for connection attempts, authentication failures, and tool-registration errors.

It works in your terminal but the client still fails. The client is using a different PATH or a stale cache. Hard-code the absolute path to npx/node in the config, and run npx clear-npx-cache.

The server connects but loads zero tools. It crashed during initialization — usually a missing env var. Run the launch command directly and read the stderr; that is where the real message is.

It works for you but not a teammate. You almost certainly have an env var or a globally-installed dependency that they do not. Pin the server version in args and document every required environment variable in your project’s contributing guide.

A remote server worked yesterday and 401s today. The OAuth token expired. Re-run the browser flow: /mcp in Claude Code, codex mcp login <name> for Codex, or reconnect from Cursor’s MCP settings.

Stuck or orphaned server processes. Find and kill them, then let the client respawn:

Terminal window
# macOS / Linux
pkill -f "mcp"
# Windows
tasklist | findstr "node"
taskkill /F /PID <pid>

For protocol-level questions, the spec and its discussion forum live at github.com/modelcontextprotocol and the MCP GitHub Discussions. For tool-specific help, use the Cursor Community Forum and the Anthropic Discord.