Uh oh!
There was an error while loading. Please reload this page.
fix: preserve custom paths in SSE endpoint URLs - #466
Conversation
ihrpr
commented
May 9, 2025
should we include those filing tests in this PR |
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>
39629e2 to
2f522bfCompare@ihrpr brought the tests over - note, dropped the change to package-lock.json |
onlysyz
commented
May 15, 2025
@ihrpr do you have a plan for this release? |
chrisdickinson
commented
May 16, 2025
As a heads up, this breaks SSE integrations with mcp.run – we were sending the full SSE endpoint down to support the python-sdk and now the endpoint pathname is being rewritten to |
@chrisdickinson thanks for catching - #504 should fix, though it couldn't hurt to verify [edit: not that simple, reverted path preservation and will revisit] |
Summary
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/messagesinstead of/sse. This fixes issues where custom endpoints were getting collapsed to the root path.Problem
The SSE client was not preserving custom paths when constructing endpoint URLs. When a client connected to a server at a custom path like
/api/v1/custom/sse, the endpoint URL would be constructed without preserving the custom path, resulting in POST requests being sent to/messagesinstead of/api/v1/custom/messages.Solution
Modified the endpoint event handler in the SSE client to:
/ssesuffix)/messagessuffixTesting
This PR makes the failing tests from #439 pass. The tests verify that:
Related Issues
Test Plan
🤖 Generated with Claude Code