cli: allow custom URL endpoints for HTTP/SSE URLs #578
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current CLI implementation for HTTP Transport re-writes any CLI URL argument that does not end in
/mcp
. This limits the functionality of the CLI to support other paths like/mcp/:uuid
or/mcp/http
and doesn't seem to conform to the spec which only suggests the path of/mcp
as an example but does not require it.https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http
Motivation and Context
Applications may reasonably wish to support multiple transports (including custom transports like SSE and websockets) under paths like
/mcp/http
,/mcp/sse
,/mcp/websockets
or nest under other URL paths for any other technical or business reason.How Has This Been Tested?
Breaking Changes
It is possible that a CLI user could be providing URL like
https://example.com/mcp/sse-not-at-end
that is currently getting re-written tohttps://example.com/sse
and maybe the remote backend was configured to serve on/sse
so while this had previously been working, it would now break that user's CLI invocation -- but they are simply passing the wrong URL. I would view this as a bug myself.Types of changes
Checklist
Additional context
We are adding HTTP Streamable support to django-mcp and are considering the use of an endpoint pattern like
/mcp/sse
,/mcp/http
,/mcp/health
etc (and possibly websockets as a custom transport in the future). This library already supports launching the web UI forinspector
using the Django management commandpython manage.py mcp_inspector
and I want to make sure we conform to the actualinspector
URL endpoint patterns. Thanks!