Title: fix(server): exit cleanly on KeyboardInterrupt in MCPServer.run by devansh-dek · Pull Request #3027 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: fix(server): exit cleanly on KeyboardInterrupt in MCPServer.run by devansh-dek · Pull Request #3027 · modelcontextprotocol/python-sdk
X Title: fix(server): exit cleanly on KeyboardInterrupt in MCPServer.run by devansh-dek · Pull Request #3027 · modelcontextprotocol/python-sdk
Description: Summary Catch KeyboardInterrupt at the MCPServer.run() sync boundary so Ctrl-C during stdio server execution exits cleanly instead of printing a noisy anyio/asyncio cancellation traceback. Adds unit tests verifying KeyboardInterrupt is suppressed while other exceptions still propagate. Test plan uv run pytest tests/server/mcpserver/test_server.py::TestServer::test_run_suppresses_keyboard_interrupt tests/server/mcpserver/test_server.py::TestServer::test_run_reraises_other_exceptions -v uv run ruff check src/mcp/server/mcpserver/server.py tests/server/mcpserver/test_server.py Fixes #2663
Open Graph Description: Summary Catch KeyboardInterrupt at the MCPServer.run() sync boundary so Ctrl-C during stdio server execution exits cleanly instead of printing a noisy anyio/asyncio cancellation traceback. Adds un...
X Description: Summary Catch KeyboardInterrupt at the MCPServer.run() sync boundary so Ctrl-C during stdio server execution exits cleanly instead of printing a noisy anyio/asyncio cancellation traceback. Adds un...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/3027
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:322c0437-6eb1-e73c-4619-4fe4159c1789 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8AD6:225C45:14593A:1BF765:6A5A68E4 |
| html-safe-nonce | 062ac4ef0d1d4213c00c908532aa57776ba7dcd3bd947663df5ead837e7ce38d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUQ2OjIyNUM0NToxNDU5M0E6MUJGNzY1OjZBNUE2OEU0IiwidmlzaXRvcl9pZCI6IjM2NzgwNzUwNDE5MTEzMDIzNzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 57bed274994a3172d50b213b8863480bbe1647bd074ba6852dbe1d908f2ed1d0 |
| hovercard-subject-tag | pull_request:3960458461 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/modelcontextprotocol/python-sdk/pull/3027/files |
| twitter:image | https://avatars.githubusercontent.com/u/83805376?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/83805376?s=400&v=4 |
| og:image:alt | Summary Catch KeyboardInterrupt at the MCPServer.run() sync boundary so Ctrl-C during stdio server execution exits cleanly instead of printing a noisy anyio/asyncio cancellation traceback. Adds un... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 922bdba685ea48400234d557977f0e32d9adbae6f5125725b4f48cacc6801106 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03575fc589c0e2692de839d7ca2b3aa5b5179f52 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width