Protocol-level faults
Reproduce delays, hangs, disconnects, malformed JSON-RPC messages, and duplicate responses without relying on flaky network conditions.
Open-source project
A TypeScript toolkit for testing how Model Context Protocol clients and servers behave under deterministic tool, transport, protocol, timeout, cancellation, and cleanup failures.
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, in CI, against its built-in server, or against another MCP target.
Published SDK test runs and their source evidence are available in MCP Observatory, where results can be compared by implementation, version, scenario, and transport.
What it tests
Reproduce delays, hangs, disconnects, malformed JSON-RPC messages, and duplicate responses without relying on flaky network conditions.
Exercise the built-in server over stdio or a locally safe Streamable HTTP endpoint through real MCP client and transport paths.
Run the same scenario model against third-party HTTP or stdio servers through a validated adapter contract with bounded setup and cleanup.
Assert success, error, or timeout outcomes, duration limits, MCP result state, response text, and independent post-call observations.
Separate scenario failures from adapter setup, execution, cancellation, observation, and cleanup failures so reports preserve where the system broke.
Produce console, JSON, or JUnit XML output with stable exit codes for CI, assertion failures, and execution errors.
How it works
Choose a built-in fault or external MCP target, its arguments, a deadline, and the expected outcome.
The runner executes the scenario through a real MCP client over stdio or Streamable HTTP.
Assertions and optional observers evaluate timing, results, post-call health, and cleanup before producing a CI-ready report.
Use it
npx mcp-failure-lab demo