mcp-rec
VCR for the Model Context Protocol. Record any MCP server's traffic to a JSONL file, then replay it deterministically — for tests, bug reports, or running your client offline.
Why
MCP servers are great until they aren't:
- Your server passes locally but fails for someone else — and you have no way to share the exact session that broke.
- You want CI tests for your MCP server but you can't pin upstream API responses.
- You want to demo your agent offline.
- You want to bisect "when did this tool start returning empty results?" against a recording.
mcp-rec solves all four by acting as a transparent proxy: it sits between
your MCP client and any stdio MCP server, forwards every byte, and writes a
JSONL transcript. Later you can replay that transcript as if it were the
real server.
Install
pip install mcp-rec
# or
uvx mcp-rec --help
Zero dependencies. Pure Python ≥3.10.
Record
Point your MCP client at mcp-rec record instead of your usual server command:
// claude_desktop_config.json
{
"mcpServers": {
"filesystem": {
"command": "mcp-rec",
"args": [
"record",
"-o", "/tmp/filesystem-session.jsonl",
"--",
"npx", "-y", "@modelcontextprotocol/server-filesystem", "/some/path"
]
}
}
}
Use your client normally. Every JSON-RPC message in both directions is appended to the JSONL file:
{"ts": 1750000001.23, "dir": "client->server", "msg": {"jsonrpc":"2.0","id":1,"method":"tools/list"}}
{"ts": 1750000001.45, "dir": "server->client", "msg": {"jsonrpc":"2.0","id":1,"result":{"tools":[...]}}}
Replay
Replace the real server with mcp-rec replay <jsonl> in your client config:
{
"mcpServers": {
"filesystem": {
"command": "mcp-rec",
"args": ["replay", "/tmp/filesystem-session.jsonl"]
}
}
}
Incoming requests are matched against the recording by (method, params)
and the corresponding response is returned with the caller's id rewritten
in. Repeated identical requests pop their responses in original order.
Unknown methods return a JSON-RPC -32601 error so your client can tell
the recording doesn't cover them.
Use cases
| Workflow | How mcp-rec helps |
|---|---|
| Bug report | Record the failing session, attach the JSONL — anyone can reproduce. |
| CI tests | Replay against your client to assert behavior without hitting upstream APIs. |
| Offline demo | Record once, demo anywhere without the upstream service. |
| Regression bisect | Diff two recordings to find when the server's output changed. |
| Stress test the client | Replay to verify the client handles all your tool's response shapes. |
Limitations
- stdio transport only for now. SSE/HTTP transports are on the roadmap.
- Notifications (server-initiated, no id) are replayed once at startup, not interleaved with the request stream.
- The matcher is exact-match on
(method, params). If your params include timestamps or random IDs you'll get a-32601on replay — strip those fields in your client tests, or open an issue and we'll add a matcher config.
Companion projects
- ai-first-scraper-mcp — sample MCP server you can record against.
About the author
Built by yubinkim444, who also makes Kay's Records — an app for iOS and Android.
If this project saved you time, giving the app a try is the nicest way to say thanks.
License
MIT © yubinkim444
Metadata
Release files for mcp-rec 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_rec-0.1.1.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_rec-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.8 kB
Release files / mcp_rec-0.1.1.tar.gz
| Download URL | mcp_rec-0.1.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc1afd252d022d861965ad71da4d7e7993e3430cd504f245312c04449094f3d1
|
|
BLAKE2b-256 checksum How to use checksums |
3cc374aff32bfc1e88a5d25c0fbcb741ae66a28a993c24616b8db4d1476594c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / mcp_rec-0.1.1-py3-none-any.whl
| Download URL | mcp_rec-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9004afba48200e3b079cedaafe9370408cfa3af6b39f4539fd498a706f814ed1
|
|
BLAKE2b-256 checksum How to use checksums |
4996bce62a8a445e4d20526e9343ff3c47182cb1fdd174d15f1788ded58654e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|