HTTPS/SEE Connections Ignore TCP Port Numbers in URLs
Describe the bug
The inspector seems to always attempt connecting over port 80 even when the protocol is https: or a specific port number is specified in the HTTPS URL.
To Reproduce Steps to reproduce the behavior:
- Use an SSE URL such as
https://foobar.net/mcp/sseorhttps://foobar.net:443/mcp/sse
Expected behavior Uses the default protocol port number, or the port number specified in the URL.
Logs
New SSE connection
Query parameters: {
transportType: 'sse',
url: 'https://foobar.net/mcp'
}
SSE transport: url=https://foobar.net/mcp, headers=Accept
Error in /sse route: SseError: SSE error: TypeError: fetch failed: Connect Timeout Error (attempted address: con-dev-cips-api.tailnet-ce56.ts.net:80, timeout: 10000ms)
at _eventSource.onerror (file:///Users/moloch/.npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:69:31)
at EventSource.scheduleReconnect_fn (file:///Users/moloch/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:248:53)
at file:///Users/moloch/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:98:174
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
code: undefined,
event: {
type: 'error',
message: 'TypeError: fetch failed: Connect Timeout Error (attempted address: foobar.net:80, timeout: 10000ms)',
code: undefined,
defaultPrevented: false,
cancelable: false,
timeStamp: 199759.002416
}
}
Additional context Add any other context about the problem here.
Wanted to clarify, are you seeing this issue in CLI mode?
So far I'm unable to repro this in either the Inspector UI or in CLI mode. Since this issue has been open for a few weeks I'm wondering if this was resolved in a PR since then, or if this is still happening.
Could have been, I was using the UI at the time, I'll try again.
Closing this since I wasn't able to repro, but please re-open if you're still having this issue.