← All articles

Cursor MCP Server Failed to Connect: Causes and Fixes

July 8, 2026·18 min read·MCPForge

Quick Answer

When Cursor reports MCP server failed to connect, it means the client could not complete a working session with the configured server. If the failure affects Cursor itself rather than one MCP server, start with the Cursor connection error guide. The failure can happen at any of eight distinct layers: process launch, configuration parsing, environment/PATH, transport, MCP initialization, authentication, session management, or remote server availability.

Fastest diagnostic path:

  1. Open Cursor Settings → MCP and identify which server shows a red or failed status.
  2. Click the log/output button next to that server and read the first error line.
  3. Match the error to the 60-second checklist below.
  4. Apply the targeted fix — do not guess.

Cursor MCP Server Failed to Connect: 60-Second Fix Checklist

Work through this list top-to-bottom. Stop at the first item that fails.

  • Config file is valid JSON — paste your ~/.cursor/mcp.json (or workspace .cursor/mcp.json) into a JSON validator
  • command field contains a real executable — run which npx / which uvx / which node in your terminal to confirm it exists
  • Package is installednpx -y some-server --version or uvx some-server --version succeeds in a fresh terminal
  • args array is correct — every element is a separate string, flags and values are not merged
  • Required env keys are set — any API key, token, or URL the server needs is present in the env block
  • Transport type matches the serverstdio for local process servers, http (Streamable HTTP) or sse for remote servers
  • Server URL is correct — for remote servers, the exact endpoint path matches the server docs (e.g. /mcp, /sse); for Atlassian, verify the official MCP server URL
  • Full executable path is used — if the server works in terminal but not Cursor, replace the command with its full absolute path
  • Cursor was restarted after the last config change
  • Server is running — for remote servers, confirm the endpoint is reachable with curl

Why Cursor MCP Servers Fail to Connect

Every connection failure belongs to one of these layers. Identifying the layer saves significant time.

Failure LayerCommon SymptomHow to VerifyFirst Fix
Process launchspawn ENOENT, command not foundCheck Cursor MCP log for spawn errorsUse absolute path to executable in command
ConfigurationServer never appears or shows parse errorValidate JSON, check required fieldsFix JSON syntax, correct command/args/url
Environment / PATHWorks in terminal, fails in CursorCompare echo $PATH in terminal vs Cursor DevToolsSet full path in command or add PATH to env
TransportConnection refused, protocol errorCheck if server is stdio vs HTTP, check URL schemeMatch transport type to server implementation
MCP initializationConnects then immediately disconnectsRead stderr in MCP log for handshake errorsFix protocol version, remove stdout contamination
AuthenticationHTTP 401, 403, OAuth errorCheck Authorization header, token expirySet correct bearer token or complete OAuth flow
SessionReconnects repeatedly, tools disappearCheck server logs for session invalidationEnsure server maintains session state, check timeouts
Remote serverHTTP 404, 502, 503, timeoutcurl the endpoint directlyFix URL, confirm server is running, check proxy
Tool discoveryConnected (green) but no tools appearRun tools/list in MCP InspectorFix server tool registration, restart Cursor

Want to analyze your API security?

Import your OpenAPI spec and generate a Security Report automatically.

Check Your Cursor MCP Configuration

Cursor reads MCP configuration from two locations:

  • Global: ~/.cursor/mcp.json
  • Workspace: .cursor/mcp.json in the project root

Workspace config takes precedence for servers defined in both files.

Correct configuration structure

json
{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "@my-org/my-mcp-server"],
      "env": {
        "API_KEY": "sk-..."
      }
    },
    "remote-server": {
      "url": "https://api.example.com/mcp",
      "transport": "http"
    }
  }
}

Common configuration mistakes

Wrong: merging flags and values into one string

json
"args": ["-y @my-org/my-mcp-server"]

Correct: each token is a separate array element

json
"args": ["-y", "@my-org/my-mcp-server"]

Wrong: using a shell alias or short name

json
"command": "my-server"

Correct: full package name with npx, or absolute path

json
"command": "npx",
"args": ["-y", "@my-org/my-mcp-server"]

Wrong: missing transport field for HTTP servers

json
{
  "url": "https://api.example.com/mcp"
}

Correct:

json
{
  "url": "https://api.example.com/mcp",
  "transport": "http"
}

For SSE-based servers (older pattern), use "transport": "sse" and provide the SSE endpoint URL.

Always validate your JSON before restarting Cursor. A single trailing comma or missing brace silently prevents all servers from loading.


Cursor MCP Server Failed to Start

If the MCP log shows a spawn error, ENOENT, command not found, or the process exits immediately with a non-zero code, the server never started.

spawn ENOENT — executable not found

This is the single most common Cursor MCP error. It means the OS cannot locate the binary specified in command. For a detailed walkthrough of this specific error, see the Cursor MCP spawn npx ENOENT guide.

Quick fix:

bash
# Find the absolute path
which npx        # e.g. /usr/local/bin/npx
which uvx        # e.g. /home/user/.local/bin/uvx
which node       # e.g. /usr/local/bin/node

Then use the absolute path in your config:

json
{
  "command": "/usr/local/bin/npx",
  "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"]
}

Package not installed or unavailable

npx -y will attempt to download the package if it is not cached. If the download fails (network issue, private registry, wrong package name), the process exits immediately. Test independently:

bash
npx -y @my-org/my-mcp-server --version

For Python-based servers using uvx:

bash
uvx my-mcp-server --version

Process exits immediately

The server starts but crashes before the MCP handshake. Causes:

  • Missing required environment variable (server throws on startup)
  • Dependency not installed
  • Wrong args causing the CLI to print help and exit

Check the env block in your config. If the server requires DATABASE_URL or OPENAI_API_KEY, it must be present:

json
"env": {
  "OPENAI_API_KEY": "sk-...",
  "DATABASE_URL": "postgresql://localhost/mydb"
}

Read stderr in the Cursor MCP log — the crash reason is almost always printed there.


MCP Server Works in Terminal but Fails in Cursor

This is the second most reported Cursor MCP connection problem. The server runs fine when you execute it manually, but Cursor cannot start it.

Why it happens: Cursor is a GUI application. On macOS and Linux, GUI apps do not source .bashrc, .zshrc, or .profile. They start with a minimal system PATH that typically does not include:

  • /usr/local/bin (Homebrew, nvm, Node.js)
  • ~/.local/bin (pip, uv, uvx)
  • ~/.nvm/versions/node/.../bin (nvm-managed Node)
  • ~/.cargo/bin (Rust tools)
  • Conda/pyenv shims

Diagnostic flow

Terminal: `which npx` → /usr/local/bin/npx  ✓
Cursor MCP log: spawn ENOENT for 'npx'       ✗
Conclusion: PATH problem
Fix: use /usr/local/bin/npx in command field

Solutions ranked by reliability

  1. Use full absolute path (most reliable):
json
{ "command": "/usr/local/bin/npx" }
  1. Set PATH explicitly in the env block:
json
"env": {
  "PATH": "/usr/local/bin:/usr/bin:/bin"
}
  1. Use a wrapper shell script that sources your profile before launching the server (useful for version managers like nvm or pyenv).

For nvm users, the Node.js binary path changes with each version. Find yours with:

bash
node -e "console.log(process.execPath)"
# e.g. /Users/you/.nvm/versions/node/v20.11.0/bin/node

Cursor Cannot Connect to a Remote MCP Server

For remote MCP servers accessed over HTTP, failures fall into distinct categories.

Wrong endpoint URL

Different servers expose different paths. Common patterns:

  • /mcp — Streamable HTTP (current standard)
  • /sse — legacy SSE transport
  • /message — legacy HTTP+SSE transport

Always verify the exact path in the server's documentation. A 404 almost always means the URL path is wrong, not that the server is down.

Transport mismatch

Streamable HTTP (the current MCP transport standard) and SSE are not interchangeable. If you connect with "transport": "http" to an SSE-only server, the connection will fail. Check the server docs and set the transport to match:

json
// Streamable HTTP server
{ "url": "https://api.example.com/mcp", "transport": "http" }

// SSE server (legacy)
{ "url": "https://api.example.com/sse", "transport": "sse" }

HTTP error codes

CodeMeaningLikely Fix
401Missing or invalid bearer tokenCheck Authorization: Bearer <token> header in your config
403Valid token but insufficient permissionsVerify token scopes, check IP allowlist
404Endpoint path is wrongConfirm the exact URL path from server docs
429Rate limitedAdd retry delay, check your request rate
500Server-side crashCheck remote server logs
502/503Proxy or gateway issueConfirm the reverse proxy is routing correctly

Authentication and OAuth

For servers requiring bearer tokens, pass the token in the headers field if your Cursor version supports it, or in the env block if the server reads it from the environment. For OAuth-based servers, Cursor initiates the OAuth flow automatically when the server advertises it during initialization — ensure your callback URL and client credentials are correctly configured on the server side.

TLS and certificate failures

If the server uses a self-signed certificate or an internal CA, Cursor's embedded Chromium may reject the TLS handshake. Use a publicly trusted certificate in production. For development, test with a tool like curl -k to confirm the server is otherwise reachable, but avoid disabling TLS verification in production configs.

Reverse proxies

Streamable HTTP requires that the proxy correctly forwards chunked transfer encoding and does not buffer responses. Nginx requires proxy_buffering off. Verify your proxy config is passing through streaming responses.


Cursor MCP Server Connects and Immediately Disconnects

The server process starts (no ENOENT), the transport connects, but the session drops within seconds.

stdout contamination (stdio servers)

For stdio-based MCP servers, the MCP protocol uses stdout exclusively for JSON-RPC messages. If anything — a console.log, a debug print, a startup banner — writes non-JSON text to stdout before or between protocol messages, Cursor will fail to parse the stream and close the connection.

js
// WRONG — breaks the stdio MCP protocol
console.log('Server starting...');

// CORRECT — use stderr for all diagnostic output
console.error('Server starting...');

Check the MCP log for JSON parse errors. If you see Unexpected token or Invalid JSON, stdout contamination is the cause.

Protocol version mismatch

During initialization, the client and server exchange initialize / initialized messages that include the protocol version. If the server requires a version Cursor does not support (or vice versa), initialization fails. Update the server package to the latest version.

Initialization failure

The server may crash during the initialization handler — for example, trying to connect to a database that is not available. The error will be in stderr. Read it in the Cursor MCP log.

For detailed help with connection-closed errors, see how to fix MCP error -32000 connection closed.


Cursor MCP Server Connected but No Tools Appear

A green status in Cursor Settings → MCP means the transport connected and initialization completed. But tools still may not appear.

This is a tool discovery failure, not a connection failure. The causes are distinct:

  1. Server returns empty tools/list — the server connected successfully but has no tools registered. Check the server implementation.

  2. Server did not declare tools capability — during initialization, the server must include "tools" in its capabilities response. If missing, Cursor will not request the tool list.

  3. Cursor cache — after fixing a config issue, Cursor sometimes shows a stale state. Fully restart Cursor (not just reload window) to force a fresh initialization.

  4. Wrong server connected — if you have multiple servers with similar names, confirm you are looking at the right one.

Verify with MCP Inspector:

bash
npx @modelcontextprotocol/inspector npx -y @my-org/my-mcp-server

Navigate to the Tools tab. If tools appear in Inspector but not in Cursor, the issue is Cursor's cache or config. If no tools appear in Inspector either, fix the server implementation.

For more on diagnosing connection problems versus tool discovery failures, see the MCP server failed to connect causes and fixes guide.


How to Find and Read Cursor MCP Logs

Cursor exposes server output directly in the settings UI:

  1. Open Cursor Settings (Cmd/Ctrl + Shift + J, then navigate to MCP, or via the gear icon)
  2. Find the MCP section — each configured server is listed with a status indicator
  3. Click the log or output button next to the failing server
  4. Read the output — it contains stdout, stderr, and connection lifecycle events

For deeper diagnostics, open Help → Toggle Developer Tools and check the Console tab. Filter by MCP to isolate relevant messages.

What to look for in the logs

Log PatternWhat It Means
spawn ENOENTExecutable not found — wrong command or PATH problem
ECONNREFUSEDServer process isn't listening on expected port/socket
SyntaxError, Unexpected tokenstdout contamination or malformed JSON-RPC message
initialize failedServer crashed during MCP handshake
Unsupported protocol versionServer/client version mismatch
401 UnauthorizedMissing or invalid bearer token
404 Not FoundWrong endpoint URL
Process exited with code NServer crashed — check stderr for reason
Connection closedTransport-level disconnect — see stderr for cause

Test the MCP Server Outside Cursor

Before debugging Cursor-specific behavior, confirm the server itself works.

For stdio servers

bash
# Replicate exactly what Cursor runs
API_KEY="sk-..." npx -y @my-org/my-mcp-server

# Then manually send an initialize request via stdin

Or use MCP Inspector (easiest):

bash
npx @modelcontextprotocol/inspector \
  npx -y @my-org/my-mcp-server

For remote HTTP servers

bash
# Test the endpoint directly
curl -X POST https://api.example.com/mcp \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-..." \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'

A valid MCP server returns a JSON-RPC response with serverInfo and capabilities.

Key principle: Use the exact same command, args, environment variables, URL, and transport that Cursor uses. If it works here and fails in Cursor, the problem is Cursor's config or environment — not the server.


Debug Cursor MCP Connection Failures with MCP Inspector

MCP Inspector is the official diagnostic tool for MCP servers. It provides an interactive UI that tests the full connection lifecycle independently of Cursor.

bash
# Install and run in one step
npx @modelcontextprotocol/inspector <command> [args...]

# Examples
npx @modelcontextprotocol/inspector npx -y @modelcontextprotocol/server-filesystem /tmp
npx @modelcontextprotocol/inspector uvx my-python-server
npx @modelcontextprotocol/inspector node /absolute/path/to/server.js

Inspector opens at http://localhost:5173 and shows:

  • Connection status — whether the transport connected
  • Initialize result — server capabilities and protocol version
  • Tools tab — full tools/list response
  • Resources and Prompts tabs — additional capability inspection
  • Request/Response log — raw JSON-RPC message trace

Using Inspector to isolate the failure layer

Inspector ResultConclusionWhere to Fix
Cannot connect at allServer startup or transport failureFix server command, args, or transport
Connects but initialize failsProtocol or initialization errorFix server initialization handler or version
Initialize succeeds, no toolsTool registration or capabilities issueFix server tool registration
Everything works in InspectorCursor config or environment problemFix Cursor MCP config

For a full Inspector walkthrough, see the MCP Inspector complete guide. You can also test any publicly accessible MCP server directly at MCPForge MCP Server Tester.


Cursor MCP Server Failed to Connect: Troubleshooting Table

SymptomLikely CauseHow to VerifyFix
spawn ENOENTExecutable not foundwhich npx / which nodeUse absolute path in command
Server process exited immediatelyMissing env var, crash on startRead stderr in MCP logAdd required vars to env block
Works in terminal, fails in CursorPATH not inherited by GUI appCompare which output vs Cursor logUse absolute path or set PATH in env
Connection refusedWrong port/socket, server not runningcurl the endpoint or check processStart the server, fix URL/port
Connection closed immediatelystdout contamination, version mismatchCheck log for JSON parse errorsUse stderr for logs, update server package
Request timed outSlow server startup, network latencyIncrease timeout, check server loadOptimize server startup, check network
initialize failedServer crash during handshakeRead stderr for crash detailsFix server initialization handler
Unsupported protocol versionClient/server version mismatchCheck protocol version in initialize messageUpdate server or client to compatible version
401 UnauthorizedInvalid or missing bearer tokencurl with the same Authorization headerFix token value in config or env
403 ForbiddenInsufficient permissionsCheck token scopes, IP allowlistUpdate token scopes or allowlist
404 Not FoundWrong endpoint URL pathcurl the URL directlyCorrect URL path in config
OAuth failureMissing client credentials, wrong callbackCheck OAuth flow in server logsFix client ID/secret, verify callback URL
Invalid sessionServer lost session stateCheck reconnect behavior in logsEnsure server maintains session, restart
Connected (green) but no toolsEmpty tools/list, missing capabilityRun Inspector, check Tools tabFix server tool registration

For a broader reference on MCP error codes and their meanings, see the MCP error codes guide.


Official Sources

How to Confirm the Fix

After applying a fix, verify each layer in sequence:

  1. Config is valid — JSON validates without errors, required fields are present
  2. Server starts — status indicator in Cursor Settings → MCP turns green
  3. No immediate disconnect — server remains connected for more than a few seconds
  4. Initialization completed — no initialization errors in the MCP log
  5. Authentication passed — no 401/403 errors in the log (for remote servers)
  6. Tools appear — the expected tools are listed in the Cursor AI panel or Settings → MCP tool list
  7. Tool call succeeds — invoke a simple tool (e.g. list files, ping) and confirm it returns a result

If any step fails, return to the troubleshooting table and address that specific layer.


How to Prevent Cursor MCP Connection Failures

Most connection failures are preventable with good configuration hygiene:

Use absolute paths. Never rely on PATH resolution working the same in Cursor as in your terminal. Always find and use the full path to executables.

Validate JSON before saving. A single syntax error silently disables all your MCP servers. Keep a JSON validator in your workflow.

Keep environment variables in the env block. Never assume Cursor will inherit your shell environment. Explicitly declare every variable the server requires.

Pin package versions. Using npx -y package@latest can break unexpectedly when a new version ships a breaking change. Pin to a specific version in production configs.

Use stderr for all server-side logging. This applies to stdio servers you control. Anything written to stdout must be valid JSON-RPC. Move all debug output to stderr.

Test with MCP Inspector before adding to Cursor. If a server works in Inspector, it should work in Cursor. This catches server-side issues before they become Cursor debugging sessions.

Keep Cursor updated. MCP protocol support improves with each Cursor release. Protocol version compatibility issues are often resolved by updating.

Document your MCP configs. Keep a commented version of your mcp.json in a secure location (without secrets) so you can quickly restore a working configuration.

For general MCP connection failure patterns that apply across all MCP clients, the MCP failed to connect guide covers client-agnostic diagnostics that complement this Cursor-specific guide.

Frequently Asked Questions

Why does Cursor say MCP server failed to connect?

Cursor reports this when it cannot establish a working MCP session with a configured server. The root cause can be anywhere from a missing executable or wrong command, to a PATH difference, transport mismatch, authentication failure, or the remote server being unreachable. The error message alone does not tell you which layer failed — you need to read the Cursor MCP logs to narrow it down.

How do I fix an MCP server connection in Cursor?

Start by opening Cursor Settings → MCP and checking whether the server shows a red status. Then read the output in Cursor's MCP log panel or DevTools console. The most common fixes are: correcting the command or args in your MCP config, using an absolute path to the executable, setting missing environment variables like API keys, and confirming the transport type matches the server (stdio vs Streamable HTTP).

Where can I find Cursor MCP logs?

Go to Cursor Settings → MCP. Each configured server has a log or output button next to its status indicator. Click it to view the server's stdout/stderr output and connection lifecycle messages. For deeper diagnostics, open Help → Toggle Developer Tools and check the Console tab for MCP-related errors.

Why does my MCP server work in the terminal but not in Cursor?

Cursor launches as a GUI application and does not inherit your shell's PATH, shell aliases, or environment variables set in .bashrc / .zshrc. This means executables like npx, uvx, node, or python may not be found even though they work fine in your terminal. The fix is to use the full absolute path to the executable in the command field of your MCP config, or to set the PATH explicitly in the env block.

Why does Cursor show spawn ENOENT for an MCP server?

ENOENT means the operating system could not find the executable specified in the command field. This happens when: the executable is not installed, the executable name is wrong, or the directory containing the executable is not in the PATH that Cursor uses. Check that the package is globally installed (npm install -g or pip install), then use the full absolute path to the binary in your config.

Why does the MCP server connect and immediately disconnect?

The most common reasons are: the server process crashes on startup (missing required environment variable or dependency), the server writes non-JSON text to stdout before the MCP handshake (stdout contamination), a protocol version mismatch, or an authentication failure during initialization. Read the server's stderr output in the Cursor MCP log panel — the crash reason is almost always printed there.

Why is my remote MCP server returning 401 or 404?

A 401 means your bearer token or API key is missing, expired, or being sent to the wrong header. Check the Authorization header value in your config. A 404 usually means the endpoint URL is wrong — confirm you are using the correct path (e.g. /mcp, /sse, or /message) as specified in the server's documentation. Also verify the server is actually running and accessible from your machine.

Why is the MCP server connected but no tools appear in Cursor?

A successful connection does not guarantee tool discovery. After connecting, Cursor sends a tools/list request. If the server returns an empty list or fails to declare tools in its capabilities during initialization, no tools will appear. Verify the server is actually registering tools in its implementation, restart Cursor after any config change, and use MCP Inspector to confirm tools/list returns the expected results.

Can MCP Inspector diagnose Cursor MCP connection problems?

Yes. MCP Inspector lets you test the exact same command, args, environment, URL, and transport that Cursor uses — without Cursor being involved. If the server works in Inspector but fails in Cursor, the problem is in your Cursor config or environment. If it also fails in Inspector, the problem is in the server itself. See the MCP Inspector Complete Guide for detailed usage.

Check your MCP security posture

Generate a Security Score, detect risky tools, and review permissions before exposing APIs to AI agents.