Title: Active Streamable HTTP sessions are not terminated during shutdown · Issue #2150 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Active Streamable HTTP sessions are not terminated during shutdown · Issue #2150 · modelcontextprotocol/python-sdk
X Title: Active Streamable HTTP sessions are not terminated during shutdown · Issue #2150 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue Description Context This is primar...
Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...
X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening t...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/2150
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Active Streamable HTTP sessions are not terminated during shutdown","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Description\n\n## Context\nThis is primarily a repost of [this fastmcp issue](https://github.com/PrefectHQ/fastmcp/issues/3025) as it seems to actually be a bug in the mcp python sdk and I want to make sure we've got visibility over here.\n\n> When shutting down a FastMCP server (CTRL+C) while clients have active streaming connections, Uvicorn logs:\n> \n> ```\n> ERROR: ASGI callable returned without completing response.\n> ```\n> \n> The error occurs because StreamableHTTPSessionManager cancels the task group without first gracefully terminating active SSE/streaming connections.\n\nExpected behavior would be the active connections being closed with a proper http response before the rest of shutdown.\n\n### Example Code\n\n```Python\nfrom fastmcp import FastMCP\n\nmcp = FastMCP(\"Test Server\")\n\n@mcp.tool\ndef hello() -> str:\n return \"Hello, World!\"\n\nif __name__ == \"__main__\":\n mcp.run(transport=\"streamable-http\", port=8000)\n```\n\n### Python & MCP Python SDK\n\n```Text\nPython 3.12\nMCP Python SDK 1.26.0\n```","author":{"url":"https://github.com/emmahoggan","@type":"Person","name":"emmahoggan"},"datePublished":"2026-02-26T18:53:02Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/2150"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:16ba95d1-e1f5-82ee-5d45-c0892387cce0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B452:16E5D2:1EF362:28925B:6AFD01E7 |
| html-safe-nonce | 7c09bc59d9e683cb07f887aaa5795f9a3298a3c898d08d5073415f8f19a24d90 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDUyOjE2RTVEMjoxRUYzNjI6Mjg5MjVCOjZBRkQwMUU3IiwidmlzaXRvcl9pZCI6IjIzNTA2NDg3NDU0OTU2OTE3NTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4fc732b8db820ed9bf0ef9232c92448c8d1673cc40b200b98acfe87ab6ae6e39 |
| hovercard-subject-tag | issue:3997210214 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/2150/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3740c3ebf8ddd1ceb324d0cc5c5788372313718df9076dfa1d44f8a377f0591a/modelcontextprotocol/python-sdk/issues/2150 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3740c3ebf8ddd1ceb324d0cc5c5788372313718df9076dfa1d44f8a377f0591a/modelcontextprotocol/python-sdk/issues/2150 |
| og:image:alt | Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | emmahoggan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8fd5a24ae29aa78df114eaaf1f9a839e8c3b7c0d27549e4f54678bb7cf3166d4 |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd0990b833f227378ab84f1d9519db1a04660550 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width