Skip to content

Redirect "/mcp" to "/mcp/" - #314

Merged
alexbainter merged 1 commit into
mainfrom
287-mcp-trailing-slash-fix
Aug 3, 2026
Merged

Redirect "/mcp" to "/mcp/"#314
alexbainter merged 1 commit into
mainfrom
287-mcp-trailing-slash-fix

Conversation

@alexbainter

Copy link
Copy Markdown
Collaborator

Closes #287.

Just ensures that the URL path /mcp redirects to /mcp/. A small thing but almost certainly would trip people up.

@alexbainter
alexbainter requested review from aaronjae22 and lisad July 29, 2026 20:45

@lisad lisad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems an unusual way to achieve it rather than just a path in urls.py?

@alexbainter

Copy link
Copy Markdown
Collaborator Author

@lisad We could handle this in Django, but since we don't have a way to transfer requests from Django to our MCP server, once the request is actually in Django the only thing we can do is issue an HTTP 307/308 redirect to /mcp/. That would rely on MCP clients to handle it correctly and forces another round trip, which is probably fine, but with the current approach we just rewrite the original request in place and send it to the intended server right away (the title of this PR is kind of a misnomer, should be "rewrite"). Happy to change it if you'd prefer!

@alexbainter
alexbainter merged commit 8084030 into main Aug 3, 2026
11 checks passed
@alexbainter
alexbainter deleted the 287-mcp-trailing-slash-fix branch August 3, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make /mcp/ route trailing slash optional

3 participants