Title: Client tool call hangs forever if server crashes or connection dies when using streamable-http · Issue #1577 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Client tool call hangs forever if server crashes or connection dies when using streamable-http · Issue #1577 · modelcontextprotocol/python-sdk
X Title: Client tool call hangs forever if server crashes or connection dies when using streamable-http · Issue #1577 · 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 If the server dies dur...
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/1577
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Client tool call hangs forever if server crashes or connection dies when using streamable-http","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\nIf the server dies during a tool call before it sends a response the client will get stuck forever.\n\n### Example Code\n\n```Python\n# server.py\n\nfrom mcp.server.fastmcp import FastMCP\nimport sys\n\nmcp = FastMCP(\"StatefulServer\")\n\n@mcp.tool()\ndef greet(name: str = \"World\") -\u003e str:\n \"\"\"Greet someone by name.\"\"\"\n sys.exit(0)\n return f\"Hello, {name}!\"\n\n\nif __name__ == \"__main__\":\n mcp.run(transport=\"streamable-http\")\n\n\n# client.py\n\nimport asyncio\n\nfrom mcp import ClientSession\nfrom mcp.client.streamable_http import streamablehttp_client\n\n\nasync def main():\n # Connect to a streamable HTTP server\n async with streamablehttp_client(\"http://localhost:8000/mcp\") as (\n read_stream,\n write_stream,\n _,\n ):\n # Create a session using the client streams\n async with ClientSession(read_stream, write_stream) as session:\n # Initialize the connection\n await session.initialize()\n\n res = await session.call_tool(\"greet\", {\"name\": \"World\"})\n print(res)\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n\n\n\n# Run server.py then client.py\n\n\n# client.py will hang forever in the tool call and never complete. I would expect it to throw an error since the connection died and it will never get a response.\n```\n\n### Python \u0026 MCP Python SDK\n\n```Text\nPython 3.13.7\nmcp 1.20.0\n```","author":{"url":"https://github.com/gyang-xai","@type":"Person","name":"gyang-xai"},"datePublished":"2025-11-05T02:57:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1577/python-sdk/issues/1577"}
| 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:d6829092-8df8-bfe7-c8d9-1228cf4c4c2d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC42:FA21D:C6D486:11CF67C:6A634650 |
| html-safe-nonce | 71942eb467ff9401d9d25dd06c7f0e83eae3c3564a8e028bb2eb1443ab4872df |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzQyOkZBMjFEOkM2RDQ4NjoxMUNGNjdDOjZBNjM0NjUwIiwidmlzaXRvcl9pZCI6IjY4OTE1NTk2OTAwNTkzMzUyNDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cdf8bf7d9e12afc054249d9824f53cbc25616cc14ee898bd6fd00a212d369fa7 |
| hovercard-subject-tag | issue:3588937508 |
| 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/1577/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8f6b28533cb96b0842be185bbcb1a3fefa760dc6c03398c4a03d16bf4a17a9b1/modelcontextprotocol/python-sdk/issues/1577 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8f6b28533cb96b0842be185bbcb1a3fefa760dc6c03398c4a03d16bf4a17a9b1/modelcontextprotocol/python-sdk/issues/1577 |
| 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 | gyang-xai |
| hostname | github.com |
| expected-hostname | github.com |
| None | 59e55daad7174ca59d63c6974d58276ccb5477442e550bebb3c035e1bef11c94 |
| 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 | 990295d92a4cc7b63fbbd83a046217cd7d77d49c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width