René's URL Explorer Experiment


Title: sse_app() ignores mount prefix, resulting in 404 from client · Issue #412 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: sse_app() ignores mount prefix, resulting in 404 from client · Issue #412 · modelcontextprotocol/python-sdk

X Title: sse_app() ignores mount prefix, resulting in 404 from client · Issue #412 · modelcontextprotocol/python-sdk

Description: Describe the bug When mounting sse_app() from FastMCP with a URL prefix using Starlette’s Mount, the SSE stream still returns the default /messages/ endpoint without the prefix. This causes the MCP client to resolve an incorrect URL (e.g...

Open Graph Description: Describe the bug When mounting sse_app() from FastMCP with a URL prefix using Starlette’s Mount, the SSE stream still returns the default /messages/ endpoint without the prefix. This causes the MCP...

X Description: Describe the bug When mounting sse_app() from FastMCP with a URL prefix using Starlette’s Mount, the SSE stream still returns the default /messages/ endpoint without the prefix. This causes the MCP...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/412

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sse_app() ignores mount prefix, resulting in 404 from client","articleBody":"**Describe the bug**\n\nWhen mounting sse_app() from FastMCP with a URL prefix using Starlette’s Mount, the SSE stream still returns the default /messages/ endpoint without the prefix. This causes the MCP client to resolve an incorrect URL (e.g., /messages/ instead of /mcp/messages/), resulting in a 404 error.\n\n**To Reproduce**\n\nSteps to reproduce the behavior:\n\n1. Define an MCP server as below:\n\n```python\nfrom mcp.server.fastmcp import FastMCP\nfrom starlette.applications import Starlette\nfrom starlette.routing import Mount\n\nmcp = FastMCP(\n    # sse_path=\"/sse\",  # default\n    # message_path=\"/messages/\",  # default\n)\n\n\napplication = Starlette(\n    routes=[\n        Mount(\"/mcp\", app=mcp.sse_app()),  # HERE !!!\n    ]\n)\n```\n\n2. Start the server and navigate to http://127.0.0.1:8000/mcp/sse in your browser\n3. Observe the response in the browser. You will receive an SSE event like:\n\n```\nevent: endpoint\ndata: /messages/?session_id=...\n```\n\nAt this point, the MCP client performs a `urljoin` operation between the SSE URL (http://127.0.0.1:8000/mcp/sse) and the endpoint path (/messages/). This causes the resolved endpoint URL to become http://127.0.0.1:8000/messages/.\n\n4. The client tries to connect to http://127.0.0.1:8000/messages/, which results in a 404.\n\n**Expected behavior**\n\nThe SSE stream should return the correct full path reflecting the prefix, e.g.:\n\n```\ndata: /mcp/messages/?session_id=...\n```\n\nThis would allow the client to connect to the actual valid message endpoint.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**Desktop (please complete the following information):**\n\n - OS: macOS\n - Browser : Arc\n - Version : 1.87.1 (60573)\n\n**Smartphone (please complete the following information):**\n - Device: N/A\n - OS: N/A\n - Browser : N/A\n - Version : N/A\n\n**Additional context**\n\nThis behavior seems to originate from hardcoded endpoint generation inside sse_app():\n\nhttps://github.com/modelcontextprotocol/python-sdk/blob/c2ca8e03e046908935d089a2ceed4e80b0c29a24/src/mcp/server/sse.py#L98\n\nIt would be great to have support for specifying a prefix in sse_app() or for the prefix to be auto-detected from the ASGI scope.\n\nThank you!","author":{"url":"https://github.com/allieus","@type":"Person","name":"allieus"},"datePublished":"2025-04-02T16:00:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/412/python-sdk/issues/412"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6ceec25c-56fb-1568-13d2-a16af62b07aa
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8844:211BBA:41CF85:5A9FBD:6A62986B
html-safe-nonce87c49b641634766a76425ee84331206243d132256517ed6667f7e4bde3fba8af
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODQ0OjIxMUJCQTo0MUNGODU6NUE5RkJEOjZBNjI5ODZCIiwidmlzaXRvcl9pZCI6IjMxMDI3MDUzODczOTUyNTg0NzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac3ee63d43b7067e392d92d3238d4cd2b93ced7dd706e9a19b9337a302442f16dc
hovercard-subject-tagissue:2966900247
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/412/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e637629cc6490ac69457c8b25730e515217cac90e458a6c092b52f343e661ce1/modelcontextprotocol/python-sdk/issues/412
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e637629cc6490ac69457c8b25730e515217cac90e458a6c092b52f343e661ce1/modelcontextprotocol/python-sdk/issues/412
og:image:altDescribe the bug When mounting sse_app() from FastMCP with a URL prefix using Starlette’s Mount, the SSE stream still returns the default /messages/ endpoint without the prefix. This causes the MCP...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameallieus
hostnamegithub.com
expected-hostnamegithub.com
None10ffaff7e212112a3b4eeb224665f909dff951514db9af4f00de33b681024427
turbo-cache-controlno-preview
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee470e2fc66e1ac7f528caec0fd8825047788d563
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/412#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F412
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F412
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/412
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/412
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/412
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/issues/412
modelcontextprotocol https://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Notifications https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Fork 3.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Star 23.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://github.com/modelcontextprotocol/python-sdk
Issues 269 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 316 https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality 6 https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Code https://github.com/modelcontextprotocol/python-sdk
Issues https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
sse_app() ignores mount prefix, resulting in 404 from clienthttps://github.com/modelcontextprotocol/python-sdk/issues/412#top
P2Moderate issues affecting some users, edge cases, potentially valuable featurehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P2%22
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
ready for workEnough information for someone to start working onhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
Mount / Routing questionshttps://github.com/modelcontextprotocol/python-sdk/milestone/23
https://github.com/allieus
allieushttps://github.com/allieus
on Apr 2, 2025https://github.com/modelcontextprotocol/python-sdk/issues/412#issue-2966900247
http://127.0.0.1:8000/mcp/ssehttp://127.0.0.1:8000/mcp/sse
http://127.0.0.1:8000/mcp/ssehttp://127.0.0.1:8000/mcp/sse
http://127.0.0.1:8000/messages/http://127.0.0.1:8000/messages/
http://127.0.0.1:8000/messages/http://127.0.0.1:8000/messages/
python-sdk/src/mcp/server/sse.pyhttps://github.com/modelcontextprotocol/python-sdk/blob/c2ca8e03e046908935d089a2ceed4e80b0c29a24/src/mcp/server/sse.py#L98
c2ca8e0https://github.com/modelcontextprotocol/python-sdk/commit/c2ca8e03e046908935d089a2ceed4e80b0c29a24
P2Moderate issues affecting some users, edge cases, potentially valuable featurehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P2%22
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
ready for workEnough information for someone to start working onhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
Mount / Routing questionsNo due datehttps://github.com/modelcontextprotocol/python-sdk/milestone/23
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.