FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: exit cleanly on stdio KeyboardInterrupt by he-yufeng · Pull Request #2671 · modelcontextprotocol/python-sdk · GitHub

fix: exit cleanly on stdio KeyboardInterrupt - #2671

Closed
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/stdio-keyboardinterrupt-clean-exit
Closed

fix: exit cleanly on stdio KeyboardInterrupt#2671
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/stdio-keyboardinterrupt-clean-exit

Conversation

Copy link
Copy Markdown

Fixes #2663. Handles Ctrl-C for FastMCP stdio runs at the stdio transport boundary so shutdown does not print a traceback. HTTP transports keep their existing behavior. Validation: uv run pytest tests\server\mcpserver\test_server.py::TestServer::test_run_stdio_exits_cleanly_on_keyboard_interrupt -q; uv run pytest tests\server\mcpserver\test_server.py -q; uv run python -m py_compile src\mcp\server\mcpserver\server.py tests\server\mcpserver\test_server.py; uv run ruff check src\mcp\server\mcpserver\server.py tests\server\mcpserver\test_server.py; uv run ruff format --check src\mcp\server\mcpserver\server.py tests\server\mcpserver\test_server.py; git diff --check.

he-yufeng force-pushed the fix/stdio-keyboardinterrupt-clean-exit branch from c4dc40b to 58f2d2a Compare May 29, 2026 19:48

Copy link
Copy Markdown
Author

Closing this older stdio-only version in favor of #2745, which covers the same issue with the broader transport-level guard and the follow-up CI fixes. Keeping only one active PR for this topic.

he-yufeng closed this Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FastMCP.run(transport="stdio") produces noisy traceback on KeyboardInterrupt instead of clean exit

1 participant


Back | FazBrowse Home | New Git URL