-
Notifications
You must be signed in to change notification settings - Fork 757
Description
Describe the bug
Currently, proxy server prints Connection refused. Is the MCP server running?
under two circumstances:
- Error message contains
Error POSTing to endpoint (HTTP 404)
OR - Error message contains
ECONNREFUSED
.
The term "Connection Refused" usually means it could not make connections at all.
I think it makes sense to print the error message in case of ECONNREFUSED
because that's how node defines it.
I don't think it makes sense to print that when the connection was successful but a 404 was returned by the server.
It took me some time to figure out why it kept saying "Connection Refused" when the server was clearly running.
See:
inspector/server/src/mcpProxy.ts
Lines 8 to 18 in a7336cd
function onServerError(error: Error) { | |
if ( | |
(error?.message && | |
error.message.includes("Error POSTing to endpoint (HTTP 404)")) || | |
(error?.cause && JSON.stringify(error.cause).includes("ECONNREFUSED")) | |
) { | |
console.error("Connection refused. Is the MCP server running?"); | |
} else { | |
console.error("Error from MCP server:", error); | |
} | |
} |
To Reproduce
Steps to reproduce the behavior:
- Have a MCP running.
- Open Inspector. Confirm it's accessible at
/mcp
. - Change endpoint to
/mcp1
.
Expected behavior
In case the server returns a 404, either print the error as-is or handle it differently if required.
Logs
If applicable, add logs to help explain your problem.
Additional context
Add any other context about the problem here.