René's URL Explorer Experiment


Title: Serve the 2026-07-28 era over stdio and other stream-pair transports by maxisbey · Pull Request #3038 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Serve the 2026-07-28 era over stdio and other stream-pair transports by maxisbey · Pull Request #3038 · modelcontextprotocol/python-sdk

X Title: Serve the 2026-07-28 era over stdio and other stream-pair transports by maxisbey · Pull Request #3038 · modelcontextprotocol/python-sdk

Description: Motivation A modern client over stdio had no path to the 2026-07-28 protocol. The stream-pair loop driven by Server.run only understood the initialize handshake: a server/discover probe was rejected, so Client(mode='auto') silently fell back to the legacy era, and a pinned-2026 client failed outright. The modern per-request-envelope path existed only on the single-exchange HTTP entry. What this does Server.run now drives a new serve_dual_era_loop driver — the stream-pair counterpart of the HTTP era router. Era is a property of the connection, decided by how the client opens it; mid-stream switching is undefined, so the first era-distinctive message locks it (matching the typescript-sdk): initialize locks legacy. The connection runs the existing loop runner byte-identically for its lifetime. Modern envelope traffic afterwards is rejected with INVALID_REQUEST. The modern _meta envelope triple (or server/discover, a modern-only method) locks modern. Every request is validated by the existing transport-agnostic classify_inbound_request ladder and served single-exchange via serve_one with a born-ready per-request Connection — the same dispatch model as the modern HTTP entry, so -32022 version negotiation comes for free. A later initialize gets UNSUPPORTED_PROTOCOL_VERSION naming the supported modern versions (mirroring the HTTP modern entry). A rejected classification never locks, so a failed probe leaves the legacy handshake available. Modern stream-pair connections get a notify-only standalone outbound: server notifications ride the duplex pipe (something stateless HTTP can't offer), while server-initiated requests are refused on both the standalone and request-scoped channels, as 2026-07-28 requires. Client-side cancellation works unchanged — notifications/cancelled is consumed at the dispatcher layer, so the stdio-only cancellation path works at the modern era for free. The streamable-HTTP manager calls serve_loop directly and is untouched. Note that Server.run also serves SSE and in-memory stream pairs, so those entries are dual-era too — deliberate, since the era doctrine is transport-class-generic for duplex pipes, and SDK SSE clients always run mode='legacy'. Interop Zero client changes. The server/discover probe has always carried the envelope triple in the request body (not just the HTTP header), so released auto-negotiating clients silently upgrade to 2026-07-28 against this server. The released fallback predicate keys on the error code alone (only -32022 is special-cased), so the new rejection shapes cannot strand older clients; a test pins this. Known gap (follow-up) subscriptions/listen is rejected with METHOD_NOT_FOUND on the stream-pair modern path for now: the registered listen handler assumes the HTTP entry's stream semantics and would misbehave over a duplex pipe. Capability derivation is handler-keyed and transport-blind, so server/discover still advertises subscription capabilities — wiring listen over stdio (and reconciling that advertisement) is follow-up work. Tests Driver-level (era lock, both cross-era rejections, -32022 round-trip, bare-probe rejection, ping neutrality, listen containment, notify-over-pipe, server-initiated request refusal), client end-to-end over a real Server.run stream pair (auto, pinned-modern, and legacy modes), and a process-stdio test driving MCPServer.run("stdio") through the full probe → feature-request exchange. The pre-existing run("stdio") tests closed stdin immediately after writing the request, racing the dispatcher's EOF-time cancellation of in-flight handlers (a latent flake). They now gate stdin EOF on the responses having arrived, like a real client; the family passes a 30x stress run. Note: the conformance suite currently has no stdio scenarios (it is HTTP-only), so SDK tests carry the coverage here — worth a conformance-repo issue for stdio-modern scenarios. AI Disclaimer

Open Graph Description: Motivation A modern client over stdio had no path to the 2026-07-28 protocol. The stream-pair loop driven by Server.run only understood the initialize handshake: a server/discover probe was rejecte...

X Description: Motivation A modern client over stdio had no path to the 2026-07-28 protocol. The stream-pair loop driven by Server.run only understood the initialize handshake: a server/discover probe was rejecte...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:8819bbe0-5f3f-229d-7018-7434f1350bdf
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA7CE:392B7D:1FAC87A:2A3FC48:6A5BC6AF
html-safe-nonce3f2dacbda96c023f8c2a68b0d737072e4dbdf7b6a50bf9f8ba1366da0b178577
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0NFOjM5MkI3RDoxRkFDODdBOjJBM0ZDNDg6NkE1QkM2QUYiLCJ2aXNpdG9yX2lkIjoiODQzODEyNzYzMDM4MjUxNTg4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac01270e7922b59795ee602d59944e72b14c25ba8b83d585905c2ea3aaa0f9efe5
hovercard-subject-tagpull_request:3966801317
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/3038/files
twitter:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
og:image:altMotivation A modern client over stdio had no path to the 2026-07-28 protocol. The stream-pair loop driven by Server.run only understood the initialize handshake: a server/discover probe was rejecte...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
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
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3038%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
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%2F3038%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/3038/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3038/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.6k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://github.com/modelcontextprotocol/python-sdk
Issues 259 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 306 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
maxisbeyhttps://github.com/maxisbey
mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
stdio-2026-autohttps://github.com/modelcontextprotocol/python-sdk/tree/stdio-2026-auto
Conversation 0 https://github.com/modelcontextprotocol/python-sdk/pull/3038
Commits 1 https://github.com/modelcontextprotocol/python-sdk/pull/3038/commits
Checks 36 https://github.com/modelcontextprotocol/python-sdk/pull/3038/checks
Files changed 6 https://github.com/modelcontextprotocol/python-sdk/pull/3038/files
Serve the 2026-07-28 era over stdio and other stream-pair transports https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#top
Show all changes 1 commit https://github.com/modelcontextprotocol/python-sdk/pull/3038/files
3bd59cc Serve the 2026-07-28 era over stdio and other stream-pair transports maxisbey Jun 30, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3038/commits/3bd59cc931dc591d54e4a9f0467474389ea8adde
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3038/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files
connection.py https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-849ab2b2ff6c99a29f2b9dcdc9edc4139ffa7d091cdf45f05fbfc7cb998b03d1
server.py https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
runner.py https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
test_client.py https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-f91d7d1bfecb41d80a4cc73133b82560b7284a2af2d6630c49b983ca9366ea13
test_runner.py https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-51ad0fc280fc0fb1ed6039b7c5a26a6fafba8d8ffc8533cfa89cb9df18ea3f10
test_stdio.py https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-3e62be39a5c1d8b8dfe922d017c0fae7b023fa1ffac872a0e046f13ef8ca899a
src/mcp/server/connection.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-849ab2b2ff6c99a29f2b9dcdc9edc4139ffa7d091cdf45f05fbfc7cb998b03d1
View file https://github.com/modelcontextprotocol/python-sdk/blob/3bd59cc931dc591d54e4a9f0467474389ea8adde/src/mcp/server/connection.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3038/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-849ab2b2ff6c99a29f2b9dcdc9edc4139ffa7d091cdf45f05fbfc7cb998b03d1
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-849ab2b2ff6c99a29f2b9dcdc9edc4139ffa7d091cdf45f05fbfc7cb998b03d1
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-849ab2b2ff6c99a29f2b9dcdc9edc4139ffa7d091cdf45f05fbfc7cb998b03d1
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-849ab2b2ff6c99a29f2b9dcdc9edc4139ffa7d091cdf45f05fbfc7cb998b03d1
src/mcp/server/lowlevel/server.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
View file https://github.com/modelcontextprotocol/python-sdk/blob/3bd59cc931dc591d54e4a9f0467474389ea8adde/src/mcp/server/lowlevel/server.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3038/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
src/mcp/server/runner.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
View file https://github.com/modelcontextprotocol/python-sdk/blob/3bd59cc931dc591d54e4a9f0467474389ea8adde/src/mcp/server/runner.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3038/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3038/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3038/files
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.