-
Notifications
You must be signed in to change notification settings - Fork 474
Incorrect URL in sse.js when providing a custom path #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect URL in sse.js when providing a custom path #313
Comments
When an SSE client connects with a custom path (e.g., /api/v1/custom/sse), ensure the endpoint URL maintains the same base path structure but with /messages instead of /sse. This fixes issues where custom endpoints were getting collapsed to the root path. Should fix issues reported in modelcontextprotocol/inspector#313 and #296 Tests demonstrating the issue were added in PR #439 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
When an SSE client connects with a custom path (e.g., /api/v1/custom/sse), ensure the endpoint URL maintains the same base path structure but with /messages instead of /sse. This fixes issues where custom endpoints were getting collapsed to the root path. Should fix issues reported in modelcontextprotocol/inspector#313 and #296 Tests demonstrating the issue were added in PR #439 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Hey I had a quick dig into this issue. We'd originallly suspected a bug in the typescript SDK I wrote some tests that I would expect to fail if it were an issue with the typescript sdk client implementation (draft pr here). However, they don't fail, which leads me to suspect that you have an MCP server that doesn't set the endpoint SSE event correctly:
@AbdullatifGhajar are you able to provide more information on the MCP server you're using to hit this bug? (i.e. is it in typescript/python, how did you set the custom path, source code would be amazing) |
I made custom paths in an SSE server for the initial connection AND for the subsequent messages, ran it, then connected to it with the latest version of the Inspector. No issues. ![]() Screen.Recording.2025-05-21.at.1.57.23.PM.movPlease noteThe Inspector has a proxy server to which it connects and sends messages via the normal endpoints. So even though my server is receiving connections at ![]() |
@AbdullatifGhajar I'm going to close this since it doesn't seem like its a bug with Inspector, as mentioned in the latest comments. Feel free to re-open if you're still having issues and can share the server code where you're running into this. |
Summary
When adding an sse server using a custom path (e.g.
http://localhost:3001/custom/path/sse
), the server sends messages requests tohttp://localhost:3001
instead ofhttp://localhost:3001/custom/path
.Steps to reproduce
Steps to reproduce the behavior:
http://localhost:3001/custom/path
)http://localhost:3001/custom/path/sse
in the URL field)http://localhost:3001
Issue
this._endpoint = new URL(messageEvent.data, this._url);
insse.js
ignores custom path, which is needed for the upcoming requests.Impact
No connection is possible
The text was updated successfully, but these errors were encountered: