Transport · troubleshooting record
MCP client cannot connect: connection refused
A TCP connection was attempted to a host and port where nothing is listening, or the listener is bound to a different interface. For local servers this usually means the server is not running or the URL uses the wrong port; for remote servers it can be a deployment or network problem.
Symptoms
- Client reports ECONNREFUSED, connection refused, or fetch failed.
- The MCP server is configured with a localhost URL but no process is running.
- A remote endpoint works from another machine but not from the client host.
Confirmed causes
These causes have a documented basis. They may not be the cause of your specific failure.
No process is listening on the configured port
A refused connection means the TCP handshake received a refusal, not a timeout or an HTTP error.
The server is bound to 127.0.0.1 while the client connects to another interface or container
Binding to loopback only exposes the service to processes that share that network namespace.
The URL has the wrong port or scheme
A server listening for plain HTTP will not be reachable at an HTTPS URL and vice versa.
Possible causes
- The server crashed after starting.
- Container port mapping is missing or maps to the wrong internal port.
- A firewall silently drops the packet, producing a timeout instead of a refusal.
- The client caches a stale server process or URL.
What still needs verification
- Whether anything listens on the port (`lsof -i :PORT` or `netstat`).
- The exact bind address and port printed by the server.
- Whether a proxy or VPN changes name resolution.
Affected environments
Fixes
Confirm the listener and URL
- Start the server and read its startup log for the bound address and port.
- Check the port with an OS networking tool.
- Make the client URL match the scheme, host, port, and path exactly.
Fix container or interface binding
- Bind to the interface the client can reach, not only loopback, when crossing a container boundary.
- Publish the container port to the host and use the host mapping in the client URL.
- Restart the client after changing the endpoint.
Verify the fix
- A basic HTTP request reaches the endpoint from the client host.
- The MCP endpoint responds with the expected protocol behavior rather than a network error.
- The client shows a connected server and tool list.
Paste the configuration into the Config Doctor. It runs in your browser, never uploads the file, and can show structural issues and safe fixes.
Why we believe this
- modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-httpOfficial documentation · checked Oct 23, 2026 · documented
The specification defines the single Streamable HTTP endpoint, protocol headers, Accept requirements, and Origin validation.