Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Testing MCP agents offline: the recording is the server

Описание и применение

Запись одной реальной сессии MCP в JSONL‑файл и последующее воспроизведение как сервера позволяет тестировать агенты без реальных учетных данных, лимитов и сети, сохраняя совместимость с любыми клиентами и обеспечивая контроль контрактов и безопасность.

Задача

MCP agent tests depend on a live MCP server with credentials, rate limits, and network, making tests fragile and hard to run offline.

Результат

Using mcp-cassette, developers can record a single real MCP session and replay it indefinitely, eliminating credentials, rate limits, and network dependencies. Tests remain unchanged, contracts are gated, and safety checks lint for tool poisoning and prompt injection.

Рабочий процесс

  • 1. Record a real MCP session: npx mcp-cassette record -o session.cassette.jsonl -- npx -y @modelcontextprotocol/server-github
  • 2. Replay the session: npx mcp-cassette check --stdio "npx mcp-cassette replay session.cassette.jsonl"
  • 3. Integrate into tests (e.g., Vitest): point the MCP client to tape.url from the cassette
  • 4. Gate tool contracts with mcp-cassette snapshot --check --stdio "node dist/my-server.js"
  • 5. Lint server surface and responses with mcp-cassette check --stdio "node dist/my-server.js" --format sarif --sarif-location mcp-contract.snapshot.json > mcp-cassette.sarif
  • 6. Add CI step: use GitHub Action ivermin1123/[email protected] with server-command: node dist/my-server.js

Доказательства

If your agent calls tools over the Model Context Protocol, its tests depend on something they do not control: a live MCP server, with its credentials, its rate limits and its network.

Источник

mcp-cassette records one real MCP session into a JSONL file, then serves that file as an MCP server.

Источник

The recorder sits between your client and the real server as a transparent proxy and writes every frame, in both directions, to an open JSONL cassette.

Источник

The replay speaks MCP over stdio or Streamable HTTP, so any client in any language connects to it unchanged.

Источник

A tool contract is an API. snapshot writes it to a file you commit, and snapshot --check fails CI when it breaks.

Источник

  • Дата записи: 2026-10-11T09:41:04.361Z