MCP Recovery Lab
You can run a local, read-only MCP server that simulates order lookups with controlled failure modes for testing agent recovery behavior.
Call the single
lookup_ordertool with a required stringorder_id(example:ORD-100).Receive simulated order statuses such as
shippedorprocessing, including revision information in some scenarios.Exercise built-in scenarios:
healthy,transient,rate-limit,stale,unavailable,permission-denied, andmalformed.Test whether an agent retries temporary failures, bounds retries, handles conflicting revisions, reports uncertainty, and avoids inventing answers.
Run the server over MCP stdio with a local MCP client or the provided example scripts.
Verify scenarios with
examples/verify_scenarios.pyor try the Pydantic AI example without an API key.Reset behavior by starting a new server process; no network, credentials, or model provider are used.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Recovery Lab What's the status of order ORD-100? If the tool fails, retry once."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Recovery Lab
A tiny local MCP server that fails on purpose, so you can test how your agent recovers.
An agent's happy path is easy to demo. What happens when a tool returns an error? Does it retry a temporary failure, stop when a service is unavailable, and avoid inventing an answer?
MCP Recovery Lab provides a simulated, read-only order lookup over MCP stdio. It makes no network requests and uses no credentials or model provider. Each process starts with fresh state.
Try it
Requires Python 3.10+ and Git. Clone the repository and install it locally:
git clone https://github.com/Dcastroro/mcp-recovery-lab.git
cd mcp-recovery-lab
python -m pip install .
mcp-recovery-lab --scenario transientThe last command runs a stdio server, so it waits for an MCP client rather than displaying a UI. Add it to an MCP client that supports local stdio servers, using its own configuration format. For clients that accept the common mcpServers format:
{
"mcpServers": {
"recovery-lab": {
"command": "mcp-recovery-lab",
"args": ["--scenario", "transient"]
}
}
}Ask your agent: “What's the status of order ORD-100? If the tool temporarily fails, try it once more.” The first valid lookup returns a tool error and the next returns shipped. Start a new server process to reset the scenario. You can also invoke the server with python -m mcp_recovery_lab.server --scenario transient if your client cannot find the console script.
To see a complete exchange without configuring an agent, install the optional official MCP Python client (python -m pip install "mcp>=2.3,<3") and run python examples/client.py. It discovers the tool, receives the simulated failure, and retries once.
Run python examples/verify_scenarios.py to check all scenarios over stdio, or add --scenario rate-limit to focus on one. The check verifies both the MCP error flag and the expected order status, revision, or error type. A stalled scenario fails after 15 seconds.
Run a Pydantic AI agent without an API key
python -m pip install "pydantic-ai-slim[mcp]>=2.66,<3"
python examples/pydantic_agent.pyThis example connects a real Pydantic AI Agent to the lab through MCP. A scripted FunctionModel retries a temporary error once, checks the returned order ID and status, and stops without inventing an answer for denied access or malformed data. Assertions verify the call counts and final results. The model decisions are deliberately scripted: the example verifies the framework integration and recovery path, not how an LLM would behave. No model service is called. To verify every scenario with the official MCP Python client, run python examples/verify_scenarios.py.
Example output:
Pydantic AI / transient: 2 tool calls; Order ORD-100 is shipped (simulated data).
Pydantic AI / permission-denied: 1 tool call; The order status could not be verified.
Pydantic AI / malformed: 1 tool call; The order status could not be verified.Related MCP server: tool-mcp-bridge
Scenarios
Scenario |
| What to observe |
| Returns the simulated shipped status. | Normal lookup. |
| First valid lookup fails; subsequent lookups succeed. | Whether the client notices and retries. |
| First two valid lookups return a simulated limit error, then succeed. | Whether retries are bounded; the fixture does not impose a real delay. |
| First lookup reports | How an agent handles conflicting observations and revision information. |
| Every lookup fails. | Whether the agent reports uncertainty. |
| Every lookup returns a simulated authorization error. | Whether the agent stops rather than retrying indefinitely or inventing a status. |
| The MCP call succeeds, but its text contains invalid JSON. | Whether the agent checks data before using it; the MCP response itself remains valid. |
Unknown order IDs return a tool error and do not consume the transient failure. These are simulated outcomes, not a production service or a measure of model quality. The server does not judge an agent's answer, implement transport fault injection, or validate arbitrary MCP servers.
Run the checks
python -m unittest discover -s tests -vThe suite includes a real subprocess speaking newline-delimited JSON-RPC over stdio. No network or credentials are needed for the server or tests. MCP clients and models are separate software and may have their own costs or network access.
How it works
The server supports the MCP initialize, ping, tools/list, and tools/call methods needed for this example, plus notifications. It offers one tool, lookup_order. It intentionally implements a small subset of MCP: it is a teaching and testing fixture, not a general MCP framework. Only use simulated order identifiers with it.
Contributing
Small, reproducible examples and bug reports are welcome. Please include the client, Python version, scenario, and steps to reproduce. Do not include real prompts, private data, or credentials in issues or examples.
MIT license.
Available Tools
1 toollookup_orderC
Look up a simulated order. Use order ID ORD-100.
Inputs: order_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
There is only one tool, so an agent cannot misselect or confuse it with anything else. Its purpose (look up a simulated order by ID) is stated unambiguously.
The single name 'lookup_order' follows a clear verb_noun snake_case convention. With one tool there is no deviation or mixing of styles to penalize.
A single tool is too thin for a server framed as a 'Recovery Lab' with an order domain; any lookup, listing, or recovery workflow would need more operations. The surface is scoped to one hardcoded action, which is an extreme mismatch for the stated purpose.
The tool only retrieves a single simulated order (ORD-100), with no list, create, update, cancel, or recovery operations. Agents hitting any other order or needing to act on an order reach a dead end.
Maintenance
Related MCP Connectors
Ovanek MCP: Model Context Protocol server for Ovanek platform tools; writes are dry-run by default.
MCP compatibility and transport verification server.
MCP compatibility and transport verification server.
MCP compatibility and transport verification server.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables distributed multi-agent chaos latency injection and fault fuzzing, allowing MCP-compatible clients to inject network faults and retrieve structured execution telemetry.8-
- AlicenseNot gradedqualityCmaintenanceEnables locally configured MCP servers to be called over stdio and mixed with xAI server-side tools, without relying on hosted xAI MCP.MIT
- AlicenseAqualityCmaintenanceEnables MCP hosts that require a local stdio process to connect to the hosted public demo, forwarding tool discovery and calls for fictional scheduling scenarios, product information, draft-sharing preparation, and optional feedback.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables testing AI agents against a scripted mock MCP endpoint where each tool call returns a chosen response, fails, hangs or drops the connection, and where assertions verify which tools were called, how often, in what order and with what arguments.13 npm2MIT