Skip to content

Conversation

@mxschmitt
Copy link
Contributor

When an MCP tool call is aborted (e.g., user cancels in Claude Code or another MCP client), the abort signal from the MCP SDK was not being propagated to the test runner, causing tests to continue running even after the call was cancelled.

This change:

  • Adds signal: AbortSignal parameter to ServerBackend.callTool
  • Passes extra.signal from MCP SDK request handler to backends
  • Listens for abort signal in runTestsWithGlobalSetupAndPossiblePause and calls testRunner.stopTests() when aborted
  • Updates all test tool handlers to accept and pass the signal

Fixes #38937

When an MCP tool call is aborted (e.g., user cancels in Claude Code),
the abort signal from the MCP SDK was not being propagated to the test
runner, causing tests to continue running even after the call was
cancelled.

This change:
- Adds `signal: AbortSignal` parameter to `ServerBackend.callTool`
- Passes `extra.signal` from MCP SDK request handler to backends
- Listens for abort signal in `runTestsWithGlobalSetupAndPossiblePause`
  and calls `testRunner.stopTests()` when aborted
- Updates all test tool handlers to accept and pass the signal
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.

[Bug]: MCP test_run tool doesn't stop test execution when aborted

1 participant