René's URL Explorer Experiment


Title: fix for SSE URL handling when a server name is specified by aarora79 · Pull Request #597 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: fix for SSE URL handling when a server name is specified by aarora79 · Pull Request #597 · modelcontextprotocol/python-sdk

X Title: fix for SSE URL handling when a server name is specified by aarora79 · Pull Request #597 · modelcontextprotocol/python-sdk

Description: Add custom URL join function for SSE endpoints This PR adds a custom URL join function to properly handle SSE endpoint URLs by correctly managing path segments regardless of trailing slashes. Motivation and Context When connecting to SSE endpoints, we need to reliably join base URLs with endpoint paths. For example if my SSE server lives at https://mcp.example.com/weather/sse/ then I want to join the SSE event URL such as /messages/?session_id=616df71373444d76bd566df4377c9629 to create https://mcp.example.com/weather/messages/?session_id=616df71373444d76bd566df4377c9629 i.e. it includes the server name weather, the existing implementation does not include the server name. This custom function ensures paths are correctly joined including a server name if present in the path. How Has This Been Tested? Added comprehensive unit tests covering multiple base URL patterns: https://mcp.example.com/weather/sse/ https://mcp.example.com/weather/clarksburg/sse/ https://mcp.example.com/sse/ Tested with and without trailing slashes Tested with session ID query parameters Verified behavior with actual SSE connection endpoints Breaking Changes None. This is a new utility function that doesn't affect existing functionality. Types of changes Bug fix (non-breaking change which fixes an issue) New feature (non-breaking change which adds functionality) Breaking change (fix or feature that would cause existing functionality to change) Documentation update Checklist I have read the [MCP Documentation](https://modelcontextprotocol.io) My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed Additional context The function uses urlparse and urlunparse to properly handle all URL components, which ensures query parameters and fragments are preserved. We specifically handle the path joining logic to accommodate both trailing and non-trailing slash cases in base URLs. Resolves #585

Open Graph Description: Add custom URL join function for SSE endpoints This PR adds a custom URL join function to properly handle SSE endpoint URLs by correctly managing path segments regardless of trailing slashes. Moti...

X Description: Add custom URL join function for SSE endpoints This PR adds a custom URL join function to properly handle SSE endpoint URLs by correctly managing path segments regardless of trailing slashes. Moti...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/597

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:2807dcaf-2754-99b4-d042-4a9549a469b4
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEB2C:15675C:A21DF1:E78683:6A632120
html-safe-nonce8b7a4a28442a1e897e30d9bd10f4cc1b97c0209dad5efc67ce9c6a7a9d43a6bf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjJDOjE1Njc1QzpBMjFERjE6RTc4NjgzOjZBNjMyMTIwIiwidmlzaXRvcl9pZCI6IjIwODMxNTMxNTI4ODQwMjM1ODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac277f61b01ec866499d2bc7cde5d89b0ddd9443f22721634e599959bbbd72187d
hovercard-subject-tagpull_request:2486497928
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/597/files
twitter:imagehttps://avatars.githubusercontent.com/u/14024481?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/14024481?s=400&v=4
og:image:altAdd custom URL join function for SSE endpoints This PR adds a custom URL join function to properly handle SSE endpoint URLs by correctly managing path segments regardless of trailing slashes. Moti...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None1a6c056e02f174fffc096c521ec0ff6fb83e40a2ec8cb8875466ec1524872dd6
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release6a93e25585f487ddff9e3996c06d5b869d6e1828
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/597/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F597%2Ffiles
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%2Fpull%2F597%2Ffiles
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%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/597/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/597/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/597/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/597/files
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 270 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 317 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
Sign up for GitHub https://github.com/signup?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
aarora79https://github.com/aarora79
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
aarora79:mainhttps://github.com/aarora79/python-sdk/tree/main
Conversation 5 https://github.com/modelcontextprotocol/python-sdk/pull/597
Commits 5 https://github.com/modelcontextprotocol/python-sdk/pull/597/commits
Checks 0 https://github.com/modelcontextprotocol/python-sdk/pull/597/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/597/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/597/files
fix for SSE URL handling when a server name is specified https://github.com/modelcontextprotocol/python-sdk/pull/597/files#top
Show all changes 5 commits https://github.com/modelcontextprotocol/python-sdk/pull/597/files
283f43c fix for SSE URL handling when a server name is specified aarora79 Apr 28, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/597/commits/283f43cf1e6b2e8aa06215a1eb741bac9d72209c
ec9dcc1 ruff formatting changes aarora79 Apr 28, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/597/commits/ec9dcc1f35e63f480f642b8df3a0ee45a6547baf
f7d9e88 ruff formatting changes aarora79 Apr 28, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/597/commits/f7d9e8817bb39c190bb2db732b0290f8e6e7b00e
4eb8521 make ruff happy aarora79 Apr 28, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/597/commits/4eb85218121e43a6e8b0b9c4e39cd96022586f31
851c34b Merge branch 'main' into main aarora79 May 4, 2025 https://github.com/modelcontextprotocol/python-sdk/pull/597/commits/851c34b353e260b15cc169a55329452665ccf29d
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/597/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/597/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/597/files
sse.py https://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
test_sse.py https://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-9a8db10695291f4f17da4fd3bde36db62460a5f356a1eb752a7b9eb58babca7c
src/mcp/client/sse.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
View file https://github.com/aarora79/python-sdk/blob/851c34b353e260b15cc169a55329452665ccf29d/src/mcp/client/sse.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/597/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
https://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
https://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
https://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-41ed2e8548ae223801c0a37a6b50ce913e24f0e660bbbc2ddd91686820c86336
tests/client/test_sse.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/597/files#diff-9a8db10695291f4f17da4fd3bde36db62460a5f356a1eb752a7b9eb58babca7c
View file https://github.com/aarora79/python-sdk/blob/851c34b353e260b15cc169a55329452665ccf29d/tests/client/test_sse.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/597/{{ revealButtonHref }}
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.