René's URL Explorer Experiment


Title: fix(stdio): drain accepted responses before EOF shutdown by ace-trump-tech · Pull Request #3421 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: fix(stdio): drain accepted responses before EOF shutdown by ace-trump-tech · Pull Request #3421 · modelcontextprotocol/python-sdk

X Title: fix(stdio): drain accepted responses before EOF shutdown by ace-trump-tech · Pull Request #3421 · modelcontextprotocol/python-sdk

Description: Fixes #2678 Summary Ensure that accepted stdio requests complete and their JSON-RPC responses are written before the server shuts down after stdin reaches EOF. Motivation and Context When a stdio server receives JSONL input through shell redirection, stdin may reach EOF while one or more accepted request handlers are still running. The current shutdown path can cancel those handlers before their responses are flushed to stdout. As a result, the final tool-call responses may disappear silently, even though the requests were accepted and processed. This change adds a bounded graceful-shutdown drain for active requests. The default behavior remains unchanged for transports that do not opt into the drain window. How Has This Been Tested? Reproduced the issue with file-redirected stdin. Tested multiple in-flight requests with an artificial delay. Verified that all accepted request IDs are emitted before process exit. Added regression coverage for stdin EOF during active request handling. Verified that the shutdown wait remains bounded if a handler does not finish. Environment: Python 3.12 MCP Python SDK 1.27.x stdio transport Linux/macOS Breaking Changes No breaking changes. The graceful-shutdown drain is bounded and opt-in. Existing behavior for other transports remains unchanged. 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 which would cause existing functionality to change) Documentation update Checklist I am assigned to the linked issue (or it is labeled help wanted, or I'm a maintainer) I have disclosed any AI assistance and can explain the change in my own words I have read the MCP Documentation 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 implementation is available in: https://github.com/ace-trump-tech/python-sdk/tree/fix/stdio-eof-drain

Open Graph Description: Fixes #2678 Summary Ensure that accepted stdio requests complete and their JSON-RPC responses are written before the server shuts down after stdin reaches EOF. Motivation and Context When a stdio s...

X Description: Fixes #2678 Summary Ensure that accepted stdio requests complete and their JSON-RPC responses are written before the server shuts down after stdin reaches EOF. Motivation and Context When a stdio s...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:a0f21e11-0a3a-2b3b-17c8-ba9d55c91440
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id97CC:20A8C6:922CBD:C6B646:6B04809C
html-safe-noncebb0264a60ca08f6e592002ccea8b2d735ea7ac0eb9244e21ff06112581993141
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0NDOjIwQThDNjo5MjJDQkQ6QzZCNjQ2OjZCMDQ4MDlDIiwidmlzaXRvcl9pZCI6IjE1NjI2MzgzNTY4MjYwNjMwMDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac9b353d049c8982a62d13c0dbb678bae6a654c2af34f3199f291154e421b07bf9
hovercard-subject-tagpull_request:4400810414
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/3421/files
twitter:imagehttps://avatars.githubusercontent.com/u/187950525?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/187950525?s=400&v=4
og:image:altFixes #2678 Summary Ensure that accepted stdio requests complete and their JSON-RPC responses are written before the server shuts down after stdin reaches EOF. Motivation and Context When a stdio s...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0366ddfb372682a32e92a5d86155cb08fa83e5bbe79953a968789f2f7e24c511
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
releaseed3f2e01f6b7672780c586c8af0e72726374d7b6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3421%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3421%2Ffiles
Sign uphttps://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/3421/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues320 (320)https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests112 (112)https://github.com/modelcontextprotocol/python-sdk/pulls
Actionshttps://github.com/modelcontextprotocol/python-sdk/actions
Projectshttps://github.com/modelcontextprotocol/python-sdk/projects
Security and quality12 (12)https://github.com/modelcontextprotocol/python-sdk/security
Insightshttps://github.com/modelcontextprotocol/python-sdk/insights
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
ace-trump-techhttps://github.com/ace-trump-tech
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
ace-trump-tech:fix/stdio-eof-drainhttps://github.com/ace-trump-tech/python-sdk/tree/fix/stdio-eof-drain
Conversation 1 https://github.com/modelcontextprotocol/python-sdk/pull/3421
Commits 1 https://github.com/modelcontextprotocol/python-sdk/pull/3421/commits
Checks 31 https://github.com/modelcontextprotocol/python-sdk/pull/3421/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/3421/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files
fix(stdio): drain accepted responses before EOF shutdown https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#top
Show all changes 1 commit https://github.com/modelcontextprotocol/python-sdk/pull/3421/files
6e1d1b0 fix(stdio): drain accepted responses before EOF shutdown ace-trump-tech Aug 31, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3421/commits/6e1d1b051506a888698bce2b0d5ea7cfd6cca9cd
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3421/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files
server.py https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
server.py https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-51d6996c0b80b8a5c42e7071451cb9ed3c91b398facebe99b94aad911059190e
runner.py https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
jsonrpc_dispatcher.py https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
test_jsonrpc_dispatcher.py https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-ce6a750fbce4c4bfa60b1845cdd92c08be0c2ed1fdcecdcb2a2efa24170efabd
src/mcp/server/lowlevel/server.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
View file https://github.com/ace-trump-tech/python-sdk/blob/6e1d1b051506a888698bce2b0d5ea7cfd6cca9cd/src/mcp/server/lowlevel/server.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3421/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
src/mcp/server/mcpserver/server.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-51d6996c0b80b8a5c42e7071451cb9ed3c91b398facebe99b94aad911059190e
View file https://github.com/ace-trump-tech/python-sdk/blob/6e1d1b051506a888698bce2b0d5ea7cfd6cca9cd/src/mcp/server/mcpserver/server.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3421/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-51d6996c0b80b8a5c42e7071451cb9ed3c91b398facebe99b94aad911059190e
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-51d6996c0b80b8a5c42e7071451cb9ed3c91b398facebe99b94aad911059190e
src/mcp/server/runner.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
View file https://github.com/ace-trump-tech/python-sdk/blob/6e1d1b051506a888698bce2b0d5ea7cfd6cca9cd/src/mcp/server/runner.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3421/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
src/mcp/shared/jsonrpc_dispatcher.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
View file https://github.com/ace-trump-tech/python-sdk/blob/6e1d1b051506a888698bce2b0d5ea7cfd6cca9cd/src/mcp/shared/jsonrpc_dispatcher.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3421/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
tests/shared/test_jsonrpc_dispatcher.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-ce6a750fbce4c4bfa60b1845cdd92c08be0c2ed1fdcecdcb2a2efa24170efabd
View file https://github.com/ace-trump-tech/python-sdk/blob/6e1d1b051506a888698bce2b0d5ea7cfd6cca9cd/tests/shared/test_jsonrpc_dispatcher.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3421/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-ce6a750fbce4c4bfa60b1845cdd92c08be0c2ed1fdcecdcb2a2efa24170efabd
https://github.com/modelcontextprotocol/python-sdk/pull/3421/files#diff-ce6a750fbce4c4bfa60b1845cdd92c08be0c2ed1fdcecdcb2a2efa24170efabd
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3421/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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.