René's URL Explorer Experiment


Title: Python MCP SDK: Incorrect handling of absolute paths in SSE endpoint URLs leads to incorrect URL construction. · Issue #585 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Python MCP SDK: Incorrect handling of absolute paths in SSE endpoint URLs leads to incorrect URL construction. · Issue #585 · modelcontextprotocol/python-sdk

X Title: Python MCP SDK: Incorrect handling of absolute paths in SSE endpoint URLs leads to incorrect URL construction. · Issue #585 · modelcontextprotocol/python-sdk

Description: Describe the bug When the MCP server, connected via SSE, returns an endpoint event with a data value that starts with / (e.g., /mcp/message?sessionId=...), the SDK appears to be using this absolute path directly without considering the b...

Open Graph Description: Describe the bug When the MCP server, connected via SSE, returns an endpoint event with a data value that starts with / (e.g., /mcp/message?sessionId=...), the SDK appears to be using this absolute...

X Description: Describe the bug When the MCP server, connected via SSE, returns an endpoint event with a data value that starts with / (e.g., /mcp/message?sessionId=...), the SDK appears to be using this absolute...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python MCP SDK: Incorrect handling of absolute paths in SSE endpoint URLs leads to incorrect URL construction.","articleBody":"**Describe the bug**\nWhen the MCP server, connected via SSE, returns an endpoint event with a data value that starts with / (e.g., /mcp/message?sessionId=...), the SDK appears to be using this absolute path directly without considering the base URL of the initial SSE connection. This results in the client attempting to access an incorrect URL.\n\n\n\n**To Reproduce**\nSteps to reproduce the behavior:\n\n1. Establish an SSE connection to an MCP server with a URL like: http://my.mcp-server.com/weather/sse.\n2. Observe the server sending an SSE event with event: endpoint and data: /mcp/message?sessionId=your_session_id.\n3. The client, using the Python MCP SDK, constructs the endpoint URL as http://my.mcp-server.com/mcp/message?sessionId=your_session_id.\n4. The expected behavior, based on the MCPEx specification (clients should use the same origin as the SSE connection and append the received path), is that the URL should be http://my.mcp-server.com/weather/mcp/message?sessionId=your_session_id.\n\n\n\n\n**Expected behavior**\nThe expected URL should be http://my.mcp-server.com/weather/mcp/message?sessionId=your_session_id.\n\n**Possible Root Cause:**\nRelevant Code Snippet (from langchain-mcp-adapters/client.py - for context):\n\n![Image](https://github.com/user-attachments/assets/607988a9-f818-4b04-bd21-08c01ac4a4bb)\n\n \nurllib.parse.urljoin treats paths starting with / as absolute paths, causing it to discard the path component of the base URL (http://my.mcp-server.com/weather/sse) and only use the hostname.\n\n**Suggested Solution**\nWhen the server returns an endpoint URL starting with /, the SDK should treat it as a path to be appended to the path of the initial SSE connection URL, rather than a completely new absolute path relative to the server root. This might involve checking if sse_data starts with / and adjusting the base URL used in the URL joining process accordingly.\n\n![Image](https://github.com/user-attachments/assets/2e48c143-4555-4aea-b0ec-32a0b8b59241)\n\n\n\n","author":{"url":"https://github.com/footuser","@type":"Person","name":"footuser"},"datePublished":"2025-04-25T02:05:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/585/python-sdk/issues/585"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:34d8051c-ba18-2f67-650d-f452b8b76b96
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAFBC:153B16:1C5EC6:26925E:6A626D81
html-safe-nonce60f54986ac7a3568f200b1d8edbbd146129dc3196c57184ac507f874cbb0207d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRkJDOjE1M0IxNjoxQzVFQzY6MjY5MjVFOjZBNjI2RDgxIiwidmlzaXRvcl9pZCI6IjM0MDE2ODc1Nzg1MTczMzU0MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1ff38b892c1ecaf1dcb5bf083466bfabe2e10199c3d3185389d85f5eb0aa7d5b
hovercard-subject-tagissue:3018808246
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/585/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1c34098e1469351ec4334aa2172ec8631e854468e5420214f74e66f2694df2c8/modelcontextprotocol/python-sdk/issues/585
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1c34098e1469351ec4334aa2172ec8631e854468e5420214f74e66f2694df2c8/modelcontextprotocol/python-sdk/issues/585
og:image:altDescribe the bug When the MCP server, connected via SSE, returns an endpoint event with a data value that starts with / (e.g., /mcp/message?sessionId=...), the SDK appears to be using this absolute...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefootuser
hostnamegithub.com
expected-hostnamegithub.com
None19769ef9d383a84eeab48bb9b309078c20f4532b73eae2f9713b18406513e0ad
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
release76dc6b11f13eaeec1329217c9f16c262ade27a1e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/585#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F585
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%2F585
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/585
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/585
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/585
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/issues/585
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 315 https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
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
Security and quality https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Python MCP SDK: Incorrect handling of absolute paths in SSE endpoint URLs leads to incorrect URL construction.https://github.com/modelcontextprotocol/python-sdk/issues/585#top
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/footuser
footuserhttps://github.com/footuser
on Apr 25, 2025https://github.com/modelcontextprotocol/python-sdk/issues/585#issue-3018808246
http://my.mcp-server.com/weather/ssehttp://my.mcp-server.com/weather/sse
http://my.mcp-server.com/mcp/message?sessionId=your_session_idhttp://my.mcp-server.com/mcp/message?sessionId=your_session_id
http://my.mcp-server.com/weather/mcp/message?sessionId=your_session_idhttp://my.mcp-server.com/weather/mcp/message?sessionId=your_session_id
http://my.mcp-server.com/weather/mcp/message?sessionId=your_session_idhttp://my.mcp-server.com/weather/mcp/message?sessionId=your_session_id
https://private-user-images.githubusercontent.com/7700392/437262518-607988a9-f818-4b04-bd21-08c01ac4a4bb.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODQ4MzU3NTcsIm5iZiI6MTc4NDgzNTQ1NywicGF0aCI6Ii83NzAwMzkyLzQzNzI2MjUxOC02MDc5ODhhOS1mODE4LTRiMDQtYmQyMS0wOGMwMWFjNGE0YmIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA3MjNUMTkzNzM3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWNiNzUzMTIwYzJmMDBkOWYwNWNiOWZmZWI5NDZlNTNiOGU4ZjRlNDQ0M2QwOTM2ODg0YzM5ZmI4MTAzMjc5OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.4O-iDqleeyJz4BUxGkZph68vAYLb4s1dfcMViPoLVMg
http://my.mcp-server.com/weather/ssehttp://my.mcp-server.com/weather/sse
https://private-user-images.githubusercontent.com/7700392/437259866-2e48c143-4555-4aea-b0ec-32a0b8b59241.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODQ4MzU3NTcsIm5iZiI6MTc4NDgzNTQ1NywicGF0aCI6Ii83NzAwMzkyLzQzNzI1OTg2Ni0yZTQ4YzE0My00NTU1LTRhZWEtYjBlYy0zMmEwYjhiNTkyNDEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA3MjNUMTkzNzM3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmRiN2EwN2ZkZjZiYjNiZjg1ZDFkNjE3OGM0NjIxNmNjZGQ1MTcyYjZjMmVjMjBmYzlhNjZhMTc4MWZhOTZjOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.Rp7zjm5xxVEaLp9hRCqlAKnuOZ1m6qheiSfa6KYgq7g
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
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.