pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/modelcontextprotocol/python-sdk/pull/2671

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

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

@he-yufeng

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 he-yufeng force-pushed the fix/stdio-keyboardinterrupt-clean-exit branch from c4dc40b to 58f2d2a Compare May 29, 2026 19:48
@he-yufeng

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 he-yufeng closed this Jun 5, 2026
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

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy