Skip to content

Conversation

steviec
Copy link
Owner

@steviec steviec commented Sep 16, 2025

Problem: Users reported that mcp-server-tester would complete all tests successfully but the process wouldn't exit, requiring Ctrl+C to terminate.

Root cause: The @modelcontextprotocol/sdk's StdioClientTransport.close() method wasn't properly terminating child processes when servers ignored shutdown signals.

This is a known issue and there's 3 open PRs in the sdk repo to fix it!

Solution: Applied patch from typescript-sdk PR #821 that implements graceful shutdown:

  • Closes stdin and waits 100ms for natural exit
  • Sends SIGTERM and waits 1 second
  • Sends SIGKILL as last resort

This ensures child processes are properly cleaned up, allowing the test runner to exit normally.

Patch will be automatically applied via patch-package on npm install until the official fix is released.

Apply patch from typescript-sdk PR #821 to properly
terminate child processes on disconnect.
@steviec steviec merged commit 80a5339 into main Sep 16, 2025
1 check passed
@steviec steviec deleted the steviec/30-fix-hanging-stdio-connection branch September 16, 2025 15:11
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.

1 participant