MCP server not connecting? Six checks, in this order
An MCP server that fails to connect is almost never a broken server. It is writing a log line to stdout, or it is missing an env var your shell had. Here are the six checks I run, in the order that finds it fastest.


An MCP server that fails to connect is almost never a broken server. It is writing a log line to stdout, or it is missing an env var your shell had. Here are the six checks I run, in the order that finds it fastest. In this deep dive, we explore actionable strategies, real-world engineering blueprints, and future-proof patterns to elevate your digital operations.
- Why "not connecting" hides so much
- Symptom to cause, quickly
- Check 1: does the command start outside the client?
- Check 2: is anything else writing to stdout?
- Check 3: environment variables are not inherited
- Check 4: the working directory is not what you expect
- Check 5: version and capability mismatch
- Check 6: for remote servers, the endpoint and headers
- Once it connects, the next bottleneck is not technical
- Related Reading
You add an MCP server to your agent, restart it, and nothing appears — no tools, no error, or a one-line failure with no detail. Your instinct is that the server is broken. It almost never is.
I have wired a lot of these, and the same six things are behind nearly every failed connection. Each one has a distinct symptom, which is why the order below matters: you can skip straight to the right check instead of restarting the client repeatedly and hoping.
Why "not connecting" hides so much
MCP over stdio is simple underneath: the client launches your command as a subprocess, then speaks newline-delimited JSON-RPC over that process's standard input and output. "Connecting" therefore means three separate things worked — the process started, the first message on the pipe was valid JSON, and both sides agreed on a protocol version and capabilities.
Only the middle one is silent. A process that fails to start usually says so. A stream that gets corrupted fails after startup, so the client reports a vague "server disconnected" and you go looking in the wrong place.
Symptom to cause, quickly
| What you see | Most likely cause | Check |
|---|---|---|
spawn … ENOENT, or a server that never appears | The command is not on the client's PATH | 1 |
| Server shows as connected, zero tools listed | It wrote something to stdout | 2 |
| Works when you run it by hand, fails in the client | Missing environment variable or wrong working directory | 3 and 4 |
UnsupportedProtocolVersionError (-32022) | Client and server are on different protocol revisions | 5 |
Invalid params (-32602) on every call | A required _meta field is missing from the request | 5 |
| HTTP server returns 401, or the call hangs | Wrong endpoint path, missing auth header, or wrong Accept header | 6 |
Check 1: does the command start outside the client?
Copy the exact command and args from your config and run them in a terminal. If the entry is a bare npx, uvx or node, that is your first suspect: a GUI-launched client does not inherit your shell's PATH the way a terminal does. The same words that resolve in your shell can be genuinely not found by the app.
Use the absolute path to the interpreter or launcher. On Windows that is the difference between node and C:\Program Files\nodejs\node.exe; on macOS, a Homebrew node under /opt/homebrew/bin is invisible to an app started from Finder.
Check 2: is anything else writing to stdout?
This is the one that costs people the most time, so it gets its own section. On the stdio transport, the server's stdout is the protocol channel. One print("Server started"), one banner, one progress bar, and the JSON-RPC stream contains something that is not JSON. The client's parser hits it and drops the connection — after startup succeeded, so nothing reports a start-up problem.
The rule: log to stderr, always. Clients capture stderr and show it in their logs. Python: configure logging to stderr or use print(..., file=sys.stderr). Node: console.error. Anything you would normally print for a human goes there.
To prove it, run the server with stdin closed and capture the streams separately:
node server.js < /dev/null > out.txt 2> err.txt
out.txt should contain nothing, or only JSON-RPC messages. If it contains prose, you found the bug. Vendor SDKs are not exempt — some print a version banner on import, so check before assuming your own code is clean.
Check 3: environment variables are not inherited
Clients launch stdio servers with only a limited subset of the environment, and the subset is platform-dependent. A token you exported in your shell, or that lives in a .env your terminal picks up, is simply not there. The server then fails on its first API call — or exits during startup with a stack trace that lands in a log file you have not opened yet.
Pass values explicitly in the server's env block:
{
"mcpServers": {
"my-reports": {
"command": "/usr/local/bin/node",
"args": ["/Users/me/mcp/reports/build/index.js"],
"env": { "MYAPP_API_KEY": "the-actual-key" }
}
}
}
Do not assume $VAR interpolation works in that block. Many clients pass the string through literally, so "${MYAPP_API_KEY}" arrives as those exact characters and the server authenticates with a variable name. Put the literal value in, and only use interpolation if the client's own documentation says it expands.
Check 4: the working directory is not what you expect
A stdio server launched by a client may start with a working directory of / on macOS, because the client itself was started from anywhere. Any relative path — a ./data argument, a .env the server reads on import, a SQLite file — resolves against that.
The fix is boring and total: absolute paths in args, and absolute paths inside whatever config file the server reads. Once I stopped shipping relative paths, this category of failure disappeared entirely.
Check 5: version and capability mismatch
Recent MCP revisions carry protocol metadata per request, not only in a one-time handshake: every request must include io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities inside _meta. Leave either out and the server rejects the request with -32602 (Invalid params) — the same code used for other malformed input, which is why it reads like a schema bug in your tool definition rather than a protocol problem.
Two more codes worth recognising:
-32022,UnsupportedProtocolVersionError: the server'sdatafield lists the versions it does support. Compare that against your client's version.-32021,MissingRequiredClientCapabilityError: the server needs a capability your client did not declare. It names the missing one.
Older revisions used an initialize handshake instead. Clients and servers from different eras are supposed to detect each other and fall back, and mostly they do — but a pre-release SDK against a released client is where that fallback gets tested in public. Pin your SDK rather than chasing it.
Check 6: for remote servers, the endpoint and headers
Streamable HTTP servers take every message as a POST to a single MCP endpoint. The reply is either a JSON object or a request-scoped SSE stream. So the mistakes are structural, not network-level:
- Wrong path.
/sse,/messagesand/mcpare not interchangeable. A wrong path returns 404, or hangs waiting for a stream that will never open. - Missing auth. The server logs a 401 while the client shows a generic connection failure. Read the server's log, not the client's status dot.
- Wrong
Acceptheader. The spec requires clients to sendAccept: application/json, text/event-stream, and some servers enforce it. A hand-writtencurlwith onlyapplication/jsongets rejected, which is how people conclude the server is down.
Test with curl against the endpoint before touching client configuration. If you cannot get a sane JSON-RPC error back from curl, no client setting will fix it.
Once it connects, the next bottleneck is not technical
Every one of these six checks is about getting an agent to reliably use your systems. When they are all green, the interesting failure has already moved: the agent can do things, but the customer is still waiting on a channel it cannot reach.
For most small and mid-sized businesses, that channel is WhatsApp — and the hard part there is not the API call, it is templates, the 24-hour service window, and who owns the number. BNex is the product I build for exactly that layer, and if you are starting from an unverified business, the WhatsApp Business API access guide walks the onboarding in the order that avoids rework. When the question is whether to wire a conversation with a flow builder or from code, this comparison covers the trade-off honestly.
One thing I would say from experience: start the automation small. A single tool that answers one real question beats a platform diagram, and it is far easier to tell whether it connected for the right reason.
Stuck on a specific error right now? Send me the exact message on WhatsApp at +91 73587 22745 and I will tell you which of the six it is. If you want the longer version of how agents find and read your site in the first place, this post on making your website readable by AI agents is the companion piece.
Get more insights like this
Join our list for practical automation, web engineering, and growth strategy — written by builders, for builders.

Manikandan S
Founder & Technical Lead at ZiyncFounder and technical lead at Ziync. I build high-performance websites and web applications for startups and mid-market teams: React, Next.js, Firebase. Based in Chennai, working with clients worldwide.