You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the MCP spec recommendations, the shutdown sequence now:
1. Closes stdin first to allow graceful server exit
2. Waits 2 seconds for the server to exit on its own
3. Only escalates to SIGTERM if the server doesn't exit
4. Finally uses SIGKILL as a last resort
This unified approach works consistently across all platforms and gives
well-behaved servers a chance to exit cleanly without signals.
Co-Authored-By: davenpi <[email protected]>
Add tests for MCP spec-compliant stdio shutdown
Added two tests to validate the stdin-first shutdown behavior:
1. test_stdio_client_graceful_stdin_exit: Verifies that a well-behaved
server exits cleanly when stdin is closed, without needing signals
2. test_stdio_client_stdin_close_ignored: Tests proper escalation to
SIGTERM when a process ignores stdin closure
These tests ensure the MCP spec shutdown sequence works correctly and
provides graceful exit opportunities before using forceful termination.
0 commit comments