MCP Lab / MCP Failure Lab

Deterministic failure scenarios for MCP servers.

Reproduce delay, hanging requests, cancellation, transport loss, and malformed or duplicate JSON-RPC responses through a real MCP client/server execution path.

Available on npmTypeScriptMITEarly release

Quick start

No repository checkout, external MCP server, or API key is required.

terminalcommand
$ npx mcp-failure-lab demo
demoresult
Scenario:   Deterministic delay demo
Outcome:    success
Duration:   ~500 ms
Assertions: passed

Execution model

Each scenario runs against Failure Lab’s built-in server or a configured external HTTP or stdio MCP target. The primary call and optional observer call are sequential and use the same MCP client connection.

StageResponsibilityImplemented
LoadValidate a code-first or JSON scenario definition.yes
ExecuteCall a registered tool through an MCP client connection.yes
RecordCapture outcome, duration, result, or execution error.yes
AssertCheck outcome, maximum duration, `isError`, and returned text.yes
ObserveRun a separate post-condition call such as `ping`.yes
ReportRender console, JSON, or JUnit XML output and select an exit code.yes

CI behavior

Exit code 0 means expectations passed, 2 means assertions failed, and 1 means the scenario could not be loaded or executed.

Operational behavior

stdio protocol traffic stays on stdout. Diagnostics use stderr, and SIGINT or SIGTERM triggers graceful shutdown.

Current boundary. External HTTP and stdio MCP targets are supported. The built-in server provides malformed and duplicate JSON-RPC response faults. Late-response testing is available over stdio, and session-loss testing is available for initialized legacy HTTP sessions.