How to Fix MCP Server Connection Errors: A Troubleshooting Guide
A practical guide to fixing remote MCP server connection errors: what common HTTP and JSON-RPC errors mean, a layer-by-layer checklist, testing with curl and MCP Inspector, and fixing missing tools.

Kelis Shekhaliya

TL;DR
Most MCP connection errors come from a wrong URL, wrong transport, bad credentials, an unpublished server, a cached client, or CORS. Test in layers: endpoint, auth, handshake, then tools, and read the exact status code and server logs.
Most remote MCP server connection errors come from a short list of causes: the wrong URL or path, the wrong transport, missing or badly formatted credentials, a server that is not published or not running, a client that cached old settings, or a browser request blocked by CORS. The fastest way to find which one is to test in layers: first check that the endpoint answers at all, then check authentication, then check the MCP handshake, and only then look at tools. Read the exact status code or error message, because it usually points straight at the layer that failed.
This guide is for SaaS founders, CTOs, and API teams who run a remote MCP server for their API and need to work out why a customer's AI client cannot connect, or why it connects but shows no tools. It covers the common error messages, what each one usually means, a step-by-step checklist, and how to test the endpoint directly with curl and MCP Inspector.
What happens when an MCP client connects
Knowing the steps of a connection makes errors much easier to place. With a remote server over Streamable HTTP, a client typically:
Reaches the endpoint. DNS resolves, TLS succeeds, and the HTTP request arrives at the right path.
Authenticates. The client sends an API key header, a bearer token, or completes an OAuth flow, depending on what the server requires.
Completes the MCP handshake. Client and server agree on a protocol version and capabilities.
Discovers capabilities. The client requests the tool list (and resources or prompts if supported) and shows them to the user and the model.
Calls tools. Each tool call is forwarded to your API, and the result is returned to the model.
A failure at step 1 or 2 shows up as "failed to connect" or an HTTP error. A failure at step 3 shows up as a protocol or transport error. A failure at step 4 looks like a successful connection with missing tools. A failure at step 5 is a tool error, not a connection error. Work out which step failed before you change anything.
Common MCP connection errors and what they mean
404 Not Found
The request reached a web server, but nothing is listening at that path. The usual causes are a wrong hostname, a missing or extra path segment such as /mcp, a typo copied from documentation, or a server that has been removed or renamed. Copy the endpoint again from its source rather than retyping it.
On servers that use MCP sessions, a 404 can also mean the session has expired. A well-behaved client then starts a new session automatically; if yours does not, reconnecting the server in the client usually fixes it.
401 Unauthorized
The server did not accept the credentials. Common reasons:
No credential was sent at all, often because an environment variable in the client config is empty or misnamed.
The token or key is invalid, expired, or revoked.
The header is malformed, for example a bearer token without the
Bearerprefix, or a pasted value with hidden leading or trailing spaces.The client expected to run an OAuth flow but the server's OAuth metadata is missing or misconfigured.
For OAuth-protected servers, the MCP authorization specification has the server answer an unauthenticated request with 401 and a WWW-Authenticate header that points the client to its protected resource metadata. If that metadata is wrong or unreachable, the client cannot start the sign-in flow. For a deeper look at the options, see API authentication for MCP: API keys, bearer tokens, and OAuth.
403 Forbidden
The credential was recognised but does not have permission. A 401 is usually about who you are; a 403 is about what you are allowed to do. Check token scopes, roles, IP allowlists, and any per-tenant access rules in your upstream API.
405, 406, or 415 responses
These usually mean the client and server disagree about the transport. Streamable HTTP clients send JSON-RPC messages with POST and an Accept header that lists both application/json and text/event-stream. A 405 Method Not Allowed often means the client is using a method the endpoint does not support, a 406 Not Acceptable points at the Accept header, and a 415 Unsupported Media Type points at the Content-Type. They also show up when an older client tries the legacy HTTP+SSE transport against a server that only speaks Streamable HTTP, or the other way round.
MCP error -32000: Connection closed
This message comes from the MCP SDKs when the connection ends while the client is still waiting for an answer. With a local stdio server it almost always means the server process exited, so run the exact command from the config in a terminal and read its error output. With a remote server, look for a proxy or load balancer closing long-running connections, a server crash, or a network drop, and check your server logs for the same moment.
Timeouts
A timeout means the client gave up before the server replied. Slow upstream API calls, cold starts, and proxies that buffer streamed responses are common causes. Check how long the matching request took in your server logs and your API logs, and make sure nothing between the client and the server buffers text/event-stream responses.
JSON-RPC error codes
Once the connection works, errors inside the protocol use standard JSON-RPC codes:
Code | Meaning | Typical cause |
|---|---|---|
| Parse error | The body was not valid JSON |
| Invalid request | The message was not a valid JSON-RPC request |
| Method not found | The server does not support that MCP method or capability |
| Invalid params | Arguments do not match the expected shape, such as an unknown tool name or bad input |
| Internal error | Something failed inside the server |
A step-by-step troubleshooting checklist
Work through these in order. Each step rules out one layer.
1. Confirm the server is live
Make sure the server is actually deployed and serving. On hosted platforms, check that the version you expect is published and that the server is not paused. A saved draft or an unpublished change does not update the live endpoint.
2. Recheck the exact endpoint URL
Compare the URL in the client config character by character with the documented endpoint, including the scheme, hostname, and full path. Watch for http versus https, trailing slashes, and old URLs ending in /sse left over from the legacy transport.
3. Use the right transport and config field
A remote server needs a URL-based entry, not a local command. Putting a hosted URL into a field that expects a command, or setting the type to stdio, fails before any request leaves the machine. Each client names these fields differently; our setup guides for Cursor, Claude Code, and VS Code show the exact format for each.
4. Check credentials and header names
Header names must match exactly, including spelling and dashes. Confirm environment variables referenced in the config are set in the environment the client actually runs in, not just in your terminal. Never put secrets in the endpoint URL itself; use headers or the client's OAuth flow.
5. Restart or reconnect the client
Many clients read their MCP config only at startup and cache the tool list. After any change to the URL, credentials, or published tools, restart the client or reconnect the server, and start a new conversation if tools still look stale.
6. Read the server logs
Look for a log entry at the exact time you tried to connect. If one exists, the request reached the server and its status code or error tells you what to fix. If none exists, the request never arrived, so the problem is in the client config, DNS, network, a firewall, or the URL, not in your tools or API.
7. Check CORS for browser-based clients
Web-based MCP clients and inspectors running in a browser need the server to answer CORS preflight requests and allow the headers MCP uses, such as Authorization, Content-Type, and the session header. If a browser client fails before anything appears in your logs, open the browser's developer tools and check the network tab for a blocked preflight.
Test the endpoint directly
Taking the AI client out of the picture is the quickest way to tell a server problem from a client problem.
Test with curl
Send an initialize request to the endpoint with the same credentials your client uses:
curl -sS -D - -X POST "https://mcp.example.com/mcp" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer $TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl-test","version":"1.0"}}}'Use a protocol version your server supports. The -D - flag prints the response headers, so you can see the status code, any WWW-Authenticate challenge, and a session ID if the server issues one. A JSON-RPC result with server capabilities means the endpoint, transport, and authentication all work, and the problem is in the client config. An HTTP error tells you which layer to fix using the list above.
Test with MCP Inspector
MCP Inspector connects to your server the way a real client does and shows the raw handshake, the tool list, and the result of each call. If tools appear and run in Inspector but not in a particular client, the server is fine and the issue is that client's config, cache, or support for your input schemas. See how to test an MCP server with MCP Inspector for a full walkthrough.
Connected, but tools are missing
If the client says it is connected but shows no tools, or old ones, check:
Publishing. New or edited tools only appear once the version containing them is live.
Enabled state. Disabled tools are not advertised to clients.
Duplicate or invalid names. Two tools with the same name, or names with unsupported characters, can stop a client from listing them.
Complex input schemas. Some clients skip tools whose schemas they cannot handle. Simplify deeply nested or unusual schemas.
Client cache. Reconnect, refresh the tool list, or remove and re-add the server.
Tool limits. Some clients limit how many tools they load at once. Exposing fewer, well-chosen tools helps; see how to choose which API endpoints to expose as MCP tools.
How 0mcp helps
0mcp hosts your existing API as a remote MCP server over Streamable HTTP. Its Setup page gives you the endpoint and generated client configuration to copy, its Logs show whether a request reached the server along with the status code, response time, and safe error details, and it keeps upstream credentials and request and response bodies out of storage. The 0mcp connection troubleshooting docs walk through the same checks for servers hosted on 0mcp. For client-specific setup, start with how to connect a remote MCP server to Claude and ChatGPT.
Summary
Treat every MCP connection error as a question of which layer failed: endpoint, authentication, handshake, discovery, or tool call. Read the exact status code, check the server logs for a matching entry, and test the endpoint directly with curl or MCP Inspector before changing your tools or API. Most problems turn out to be a wrong URL, a wrong transport field, a credential that never reached the server, or a client that needs a restart.
FAQ
01Why does my MCP client say "failed to connect"?+-
The client could not complete a request to the server. Check that the server is live, the URL and path are exact, the config uses a URL-based remote entry rather than a local command, and the credentials are valid. Then check the server logs for a matching request.
02What does MCP error -32000 Connection closed mean?+-
The connection ended while the client was waiting for a reply. With a local stdio server, the server process usually exited, so run its command in a terminal and read the error output. With a remote server, check for crashes, proxies closing connections, or network drops.
03What is the difference between a 401 and a 403 from an MCP server?+-
A <code>401</code> means the server did not accept the credential: it is missing, malformed, invalid, or expired. A <code>403</code> means the credential was recognised but lacks permission for the request.
04Why does my MCP server connect but show no tools?+-
The tools may not be published or enabled, may have duplicate or invalid names, may use input schemas the client does not support, or the client may have cached an old tool list. Reconnect the server and confirm the tool list in MCP Inspector.
05How can I test a remote MCP server without an AI client?+-
Send a JSON-RPC <code>initialize</code> request with <code>curl</code> using the same headers your client uses, or connect with MCP Inspector to see the handshake, tool list, and tool results.
06Should I use SSE or Streamable HTTP for a remote MCP server?+-
Streamable HTTP is the current remote transport in the MCP specification and replaced the older HTTP+SSE transport. Configure clients with the server's Streamable HTTP endpoint unless the server documents otherwise.