npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

shack-session-replay

v0.1.0

Published

MCP server that records and replays agent tool-call trajectories

Readme

shack-session-replay

An MCP server that records agent tool-call trajectories and replays recorded responses for deterministic regression testing.

Speaks JSON-RPC 2.0 over stdio: STDOUT carries only protocol messages; all logs go to STDERR.

What it does

Agents often call external tools (web search, APIs, databases) whose results are non-deterministic. shack-session-replay lets you capture a complete run — every request and its live response — into a named trajectory file. You can then replay that trajectory later so the agent sees exactly the same responses it received during recording, enabling bit-for-bit reproducible regression tests without hitting live backends.

Workflow:

  1. Call start_recording to open a named session.
  2. For each tool call, call record_event with the outgoing request and the live response.
  3. Call stop_recording to flush the session to a JSON file on disk.
  4. In tests, call replay_lookup with the trajectory name and a request to retrieve the stored response.

Matching is done on method + params equality; the id field is stripped before comparison so the same logical call always resolves regardless of call-site id.

MCP tools

| Tool | Arguments | Description | |---|---|---| | start_recording | name (string, required) | Begin a named recording session. Fails if one is already active. | | stop_recording | — | Flush the active recording session to disk and close it. | | record_event | request (object, required), response (object, required) | Append a request/response pair to the currently active recording session. | | replay_lookup | trajectory (string, required), request (object, required) | Return the first recorded response matching the given request. Reports matched: true with the response, or matched: false if no recording matches. | | list_trajectories | — | List all trajectory files in the data directory, with names and event counts. |

Configuration

| Flag | Short | Default | Description | |---|---|---|---| | --data-dir | -d | trajectories | Directory where trajectory JSON files are stored. |

Install

npm install

Build

npm run build

Run

node dist/main.js --data-dir /path/to/trajectories

Or, if installed globally:

shack-session-replay --data-dir /path/to/trajectories

The server reads JSON-RPC 2.0 requests from stdin, one per line, and writes responses to stdout.

Test

npm test

Usage example

The following shows a complete record-then-replay interaction. Each line sent to stdin is a JSON-RPC 2.0 request; each line received on stdout is its response.

Stdin:

{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"start_recording","arguments":{"name":"my_session"}}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"record_event","arguments":{"request":{"method":"tools/call","params":{"name":"search","arguments":{"q":"typescript mcp"}}},"response":{"result":{"hits":["doc1","doc2"]}}}}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"stop_recording","arguments":{}}}
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"replay_lookup","arguments":{"trajectory":"my_session","request":{"method":"tools/call","params":{"name":"search","arguments":{"q":"typescript mcp"}}}}}}

Stdout:

{"jsonrpc":"2.0","result":{"content":[{"type":"text","text":"Recording started: my_session"}]},"id":1}
{"jsonrpc":"2.0","result":{"content":[{"type":"text","text":"Event recorded (total in session: 1)"}]},"id":2}
{"jsonrpc":"2.0","result":{"content":[{"type":"text","text":"Recording 'my_session' saved with 1 event(s) at trajectories/my_session.json"}]},"id":3}
{"jsonrpc":"2.0","result":{"content":[{"type":"text","text":"{\"matched\":true,\"response\":{\"result\":{\"hits\":[\"doc1\",\"doc2\"]}},\"recorded_at\":\"...\"}"}]},"id":4}