Deterministic faults
Reproduce bounded delays, hanging tools, cancellation, and transport disconnects without relying on flaky external conditions.
Open-source project
A TypeScript toolkit for testing how Model Context Protocol servers and clients behave when tools slow down, hang, disconnect, time out, or return an unexpected result.
The problem
A successful tool call says little about timeout handling, cancellation cleanup, lost transports, or server health after a failure. MCP Failure Lab turns those conditions into repeatable scenarios that can run locally or in CI.
What it tests
Reproduce bounded delays, hanging tools, cancellation, and transport disconnects without relying on flaky external conditions.
Assert success, error, or timeout outcomes, maximum duration, MCP result state, and expected response text.
Run an observer tool after the primary call to verify that the server remains responsive and its state is correct.
Use human-readable console output or stable JSON reports, with distinct exit codes for passes, assertion failures, and execution errors.
How it works
Choose a fault tool, its arguments, a deadline, and the expected outcome in a JSON scenario.
The runner starts the MCP server and executes the scenario through a real stdio client and transport.
Assertions evaluate timing and results, then an optional observer checks post-call health or state.
Use it
npx mcp-failure-lab demo