agent-cassette
by kanchingyg
README.md
# agent-cassette
[](https://github.com/kanchingyg/agent-cassette/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/agent-cassette)
[](https://jsr.io/@kanchingyg/agent-cassette)
[](https://github.com/kanchingyg/agent-cassette)
[](https://github.com/kanchingyg/agent-cassette/blob/HEAD/LICENSE)
Deterministic VCR cassette recorder and offline replay proxy for LLM HTTP/SSE streams and MCP stdio runs. Replay multi-turn agent tests in ~0ms in CI without GPUs or live API keys.
## Install
[Bun](https://bun.sh) / [npm](https://www.npmjs.com/package/agent-cassette):
```bash
bunx agent-cassette record -- npm test
npx agent-cassette record -- npm test
# or install in your project / globally
bun add -d agent-cassette
npm i -D agent-cassette
```
[JSR](https://jsr.io/@kanchingyg/agent-cassette):
```bash
bunx jsr add @kanchingyg/agent-cassette
npx jsr add @kanchingyg/agent-cassette
```
## Quick start
```bash
# Record live LLM HTTP/SSE and MCP interactions into a deterministic cassette
npx agent-cassette record -- npm test
bunx agent-cassette record -- bun test
# Replay offline in CI in ~0ms with zero network calls or API keys
npx agent-cassette replay -- npm test
# Run as an MCP server over stdio
npx agent-cassette --mcp
```
## Features
- **HTTP & SSE stream recording**: Captures chunked token streams from OpenAI, Anthropic, Ollama, and OpenAI-compatible endpoints and replays them deterministically.
- **Prompt & tool-call hashing**: Normalizes volatile headers and timestamps while matching prompt and tool-call signatures.
- **Automatic secret scrubbing**: Strips `Authorization`, `x-api-key`, and bearer tokens before writing cassette files to disk.
- **SSRF & path containment**: Blocks private-network target redirection and enforces workspace path containment on cassette reads/writes.
## MCP setup
```json
{
"mcpServers": {
"agent-cassette": {
"command": "npx",
"args": ["-y", "agent-cassette", "--mcp"]
}
}
}
```
## License
[MIT](./LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues