rr-context-mcp
This MCP server lets coding agents record, replay, and deterministically inspect a failing Linux program with rr and GDB/MI.
Record argv-only program runs and list local rr traces.
Check rr/GDB/Linux environment readiness.
Start, inspect, interrupt, and close persistent replay sessions.
Inspect stack, frame, locals, threads, stop reason, and event/tick coordinates.
Move forward or backward with continue, reverse-continue, step, next, and reverse variants.
Set breakpoints and read/write/access watchpoints.
Evaluate a single C/C++ expression.
Get symptom-specific root-cause investigation hints.
Return structured evidence and structured errors; supports dry-run demo and an rr workflow guide resource.
Integrates with Mozilla's rr record-and-replay engine to deterministically record a failing program's execution and replay it under GDB, letting agents inspect stop reasons, stack frames, locals, and threads, set breakpoints and watchpoints, and move forward or backward through execution to bracket the root cause of crashes, assertions, wrong values, or hangs.
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., "@rr-context-mcp record my failing test and inspect the segfault root cause"
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.
rr-context-mcp
An open-source, local MCP server that gives coding agents a deterministic runtime record they can inspect and replay while diagnosing bugs. This first MVP uses Mozilla's rr engine and the official Python MCP SDK.
Existing-project review
This is a new implementation, not a fork. Both reference projects establish that rr can be made accessible to agents through MCP, so the useful design question is how to make the root-cause path clear and reliable.
Project | What it does well | Design lesson for this MVP |
Broad debugger coverage: multi-process replay sessions, reverse execution, breakpoints/watchpoints/catchpoints, session resources, and a detailed guide. Its reported 48 specialized tools make the GDB surface comprehensive. | Avoid presenting every GDB operation as an equally important starting point. Expose a compact investigation loop first; grow into multi-process and advanced breakpoint workflows after the basic loop is stable. | |
An end-to-end record, replay, and inspect flow. Uses GDB/MI to support persistent reverse-debugging sessions and has practical installation and rr troubleshooting guidance. | Keep an actual persistent debugger session and prioritize recording a failure, inspecting state, and moving backward. Avoid requiring a separate agent to manually orchestrate dozens of low-level steps for common cases. |
Proposed architecture
Coding agent (Claude Code / Cursor / other MCP host)
│ MCP stdio
▼
MCP tool layer (workflow-oriented, typed, small outputs)
│
├── Capture adapter ── argv-only `rr record`
├── Trace catalog ──── local rr trace directories
└── Replay adapter ─── `rr replay -s` + persistent GDB/MI2
│
└── structured evidence: stop, stack, locals, threadsThe tool surface is deliberately small for an MVP:
Tool | Job in an investigation |
| Capture the exact command and arguments that reproduce the failure. |
| Check rr, GDB, Linux, and likely performance-counter readiness. |
| Find existing recordings. |
| Connect rr's replay server to the matching executable and debug symbols. |
| Return the stable Evidence contract: current frame, stack, locals, threads, stop reason, and position. |
| Suggest investigation steps for crashes, assertions, wrong values, or hangs. |
| Attach rr event and current-thread tick coordinates to an observation. |
| Move forward or backward to bracket the event that caused the bad state. |
| Interrupt a currently running continue or reverse-continue operation. |
| Stop at a likely causal location. |
| Stop when a variable or expression is read, written, or accessed. |
| Inspect a single expression without exposing an arbitrary GDB console. |
| Release the GDB and rr processes. |
Evidence and error contracts
Evidence contract version: v1. This is the current stable schema for rr_inspect and rr_move.
Successful rr_inspect and rr_move calls, including dry-run mode, return the same fields:
{
"ok": true,
"session_id": "rr-...",
"frame": {
"level": "0",
"address": "0x4011a2",
"function": "parse_packet",
"file": "src/parser.c",
"fullname": null,
"line": "84"
},
"backtrace": [],
"locals": [],
"threads": [],
"current_thread_id": "3",
"stop_reason": {
"reason": "signal-received",
"signal_name": "SIGSEGV",
"signal_meaning": "Segmentation fault",
"thread_id": "3",
"stopped_threads": "all",
"frame": null,
"details": {}
},
"position": {"event": 481, "ticks": 90214},
"parse_warnings": []
}Frame objects use fixed fields: level, address, function, file, fullname, and line; unavailable values are null. stop_reason uses fixed fields and retains stop-specific MI fields in details. position always contains numeric-or-null event and ticks. parse_warnings is empty for complete MI records. For incomplete records it contains { "parse_error": "...", "raw": "original MI line" }, while any successfully parsed evidence remains available in its regular field.
backtrace, locals, and threads are always arrays, including when GDB provides no entries. frame may be null when no frame is available. Live and dry-run paths use the same frame and stop-reason field names.
All tool errors use this shape, with code identifying invalid input, unavailable runtime, timeout, a stopped target interrupt request, or an unexpected internal error:
{ "ok": false, "error": { "code": "timeout", "message": "..." } }Root-cause analysis should move from the observed failure toward the first event that violates an invariant. Agents can inspect at the crash, form a hypothesis, set a watchpoint on a value that should remain stable, and reverse-step or reverse-continue to identify the earlier mutation. Event/tick coordinates make observations easier to compare and cite. A future version can add direct event seeking, process selection, durable trace metadata, and automated evidence summaries without bloating the initial tool list.
MVP limits
rr is Linux-only in normal use and has CPU/kernel/performance-counter requirements. Some virtual machines work only when performance counters are passed through.
Recording captures the target process tree's execution. It does not capture arbitrary remote services or all machine state.
Replay needs the executable that matches the recording. Debug symbols improve the quality of stack and local-variable evidence.
The server can keep multiple replay sessions open in one MCP process, but process selection within a multi-process trace, checkpoints, and trace deletion are not implemented yet.
The current execution wait is bounded by configurable forward/reverse timeouts; expired waits return a structured
timeouterror.rr_interruptcan send an asynchronous interrupt while a movement command is running.GDB/MI results are parsed into structured frames, locals, threads, stop reasons, and event/tick coordinates. Variable inspection still depends on symbols and the executable matching the trace.
Expected tool failures are returned as JSON objects with
ok: falseand an error code/message.rr_environmentreports missing binaries and a best-effort performance-counter check; only a real recording can confirm the host's full rr permissions.rr_recordaccepts an argv array and never runs a shell command. Build steps and shell pipelines must be represented by a wrapper executable/script or run separately before recording.
Related MCP server: karellen-rr-mcp
Requirements
Linux supported by rr
Python 3.11+
rrandgdbonPATHrr hardware performance counter access configured for your environment
Check rr independently before connecting the MCP server. Replay opens the interactive debugger, so exit it after the smoke test:
rr record -o /tmp/rr-smoke -- /bin/true && rr replay /tmp/rr-smokerr may not work inside containers or VMs without the necessary performance-counter access. Consult the rr installation guide for your CPU and distribution.
Install from this checkout
Install the runtime package with pip:
python -m pip install .
rr-context-mcpFor development, install the optional test dependencies in an editable checkout:
python -m pip install -e '.[dev]'
pytestOr install the local command into an isolated pipx environment:
pipx install .
rr-context-mcpTo install directly from the public GitHub repository with pipx:
pipx install 'git+https://github.com/spheratec-sys/rr-context-mcp.git'
rr-context-mcp --helpAfter a release is published to PyPI, users can run pipx run rr-context-mcp or uvx rr-context-mcp without installing it into a project environment.
On Windows, the venv activation command is .venv\\Scripts\\activate; the server itself still requires Linux and rr.
Run the mocked unit and MCP protocol tests:
pytestThe real rr smoke test is opt-in and requires Linux, rr, and working performance counters:
RR_INTEGRATION=1 pytest tests/test_rr_integration.pyLaunch the stdio server directly:
rr-context-mcpYou can override rr's standard recording directory (~/.local/share/rr) with RR_TRACE_DIR=/path/to/traces.
Exercise the full MCP handshake and a sample crash-analysis workflow without rr/GDB:
rr-context-mcp --dry-runThe demo server does not record or replay an actual program. Its sample workflow starts at a SIGSEGV, returns full evidence, installs a cursor watchpoint, simulates a reverse continue to the earlier write, and produces a watchpoint-specific root-cause hint. Set RR_INTEGRATION=1 when running tests to opt into a real rr record/replay smoke test; the default suite remains fully mocked.
Claude Code configuration
From the repository root, use an absolute checkout path:
claude mcp add --transport stdio rr-context-mcp -- /absolute/path/to/rr-context-mcp/.venv/bin/rr-context-mcpOr add a project-local .mcp.json:
{
"mcpServers": {
"rr-context-mcp": {
"type": "stdio",
"command": "/absolute/path/to/rr-context-mcp/.venv/bin/rr-context-mcp",
"env": {
"RR_TRACE_DIR": "/home/you/.local/share/rr"
}
}
}
}Cursor configuration
Add a project .cursor/mcp.json (or use Cursor's MCP settings UI):
{
"mcpServers": {
"rr-context-mcp": {
"command": "/absolute/path/to/rr-context-mcp/.venv/bin/rr-context-mcp",
"env": {
"RR_TRACE_DIR": "/home/you/.local/share/rr"
}
}
}
}Restart or reload the MCP connection after changing configuration. For other stdio MCP clients, configure the same executable and environment.
Typical agent workflow
Build the program with debug symbols and reproduce the problem once with
rr_record, passing the executable and arguments separately.Start replay with the returned
trace_pathand the matching executable.Inspect the stop, stack, locals, and threads. Set a breakpoint or evaluate the suspect value.
Use
rr_movewithreverse_steporreverse_continueto identify when the incorrect value was created; move forward to confirm the causal path.Report the observed evidence and close the session.
The server includes an rr://guide resource with this workflow.
Development status
This is a runnable MVP. It includes the official MCP SDK, tolerant GDB/MI parsing with partial data and original text for malformed records, fully structured inspect/move evidence, stale-stop-resistant bounded execution waits, asynchronous interrupts, multiple replay sessions, capability diagnostics, watchpoints, symptom-specific investigation hints, and a demo mode. Ten realistic MI fixture lines cover stacks, locals, threads, watchpoints, signals, breakpoints, stream output, and truncated data. Unit and protocol tests run without rr hardware. Real capture/replay remains host-dependent and is covered by an opt-in RR_INTEGRATION=1 smoke test.
License
MIT
Available Tools
13 toolsrr_breakpointC
Set a GDB breakpoint by function, source.cpp:line, or address expression.
Inputs: location (required), session_id (required).
rr_environmentA
Check whether this host appears ready to record and replay with rr.
Inputs: no named parameters.
rr_evaluateB
Evaluate one C/C++ expression in the current frame; does not run a GDB console command.
Inputs: expression (required), session_id (required).
rr_inspectA
Return the current stack, selected-frame locals, thread summary, and stop reason.
Call after replay_start and after each execution movement. This compact evidence bundle is the best starting point for root-cause analysis.
Inputs: session_id (required).
rr_interruptC
Interrupt a currently running continue or reverse-continue operation.
Inputs: session_id (required).
rr_list_tracesA
List local rr recordings, newest first. Use trace_path with rr_replay_start.
Inputs: no named parameters. Returns: result
rr_moveB
Move deterministically through the recording.
action is one of continue, reverse_continue, step, reverse_step, next, reverse_next. For memory corruption, set a breakpoint/watchpoint near the observed bad state, then reverse_continue to find the earlier cause.
Inputs: action (required), session_id (required), count.
rr_recordA
Record a failing or suspicious program run with rr.
Pass the executable and each argument as separate array items. The command is executed directly, without a shell. Use the same build and inputs that reproduce the bug. Returns a trace_id and trace_path for replay_start.
Inputs: command (required), cwd, timeout_seconds.
rr_replay_startA
Start an interactive replay session for a trace and its debug-symbol binary.
Provide the exact executable used by the recording, preferably an unstripped build with debug symbols. The response includes session_id and the initial stopped location. Use rr_inspect to collect context before moving execution.
Inputs: executable (required), trace_path (required).
rr_root_cause_hintA
Return an investigation checklist based on stop reason and observed symptom.
symptom may be auto, segfault, assertion, wrong_value, or hang. Use wrong_value after a breakpoint/watchpoint exposes the incorrect state; use hang when replay is stopped at a chosen progress marker for a suspected stuck path.
Inputs: session_id (required), symptom.
rr_session_closeC
Close the replay and GDB processes for a session.
Inputs: session_id (required).
rr_watchpointB
Watch a value and stop when it is written, read, or accessed.
A write watchpoint is useful after observing a corrupted variable: set it while the value is still correct, then continue or reverse through the trace to identify the instruction that changes it. Hardware watchpoint limits vary.
Inputs: expression (required), session_id (required), access.
rr_whenB
Return rr's current event number and per-thread tick position.
Use these coordinates to compare observations and to describe where in the recorded execution a failure or state transition occurred.
Inputs: session_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool maps to a distinct rr/GDB operation: recording, replay start, execution movement, breakpoints vs. watchpoints, inspection, coordinates, and session teardown are all clearly separated. rr_inspect vs. rr_when both report state but descriptions make the boundary explicit (full evidence bundle vs. raw event/tick coordinates).
All tools share a consistent rr_ prefix and snake_case, giving a predictable namespace. Internal ordering varies slightly (rr_list_traces is verb_noun, rr_replay_start and rr_session_close are noun_verb, rr_when/rr_evaluate are single tokens) but the pattern remains readable and uniform overall.
13 tools is well-scoped for an rr record/replay debugging workflow, sitting comfortably in the ideal 3-15 range. Each tool earns its place, with no redundant or filler operations.
The surface covers the full record→replay→inspect→move→root-cause lifecycle plus environment checks and session teardown. Minor gaps exist (e.g. no explicit thread switching, register/memory reads, or disassembly), but core debugging workflows are fully supported.
Maintenance
Related MCP Connectors
Agent Replay Debugger MCP — record every agent step + deterministic replay. Step-debugger for
Bug tracking for AI agents: session replay, console/network logs, repro packs, test plans, evidence.
Traceo bug recordings (console, network, user actions, environment) as context for coding agents.
Production bugs with replay, network, console and stack, ranked for your coding agent to fix.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI agents to debug code and automate browsers using Chrome DevTools Protocol, supporting breakpoints, variable inspection, and replayable interaction recording.351,006 npm20MIT

karellen-rr-mcpofficial
AlicenseNot gradedqualityBmaintenanceEnables LLM-powered debugging with rr reverse execution, allowing record and replay of program execution via GDB/MI for forward and reverse state inspection.5Apache 2.0- AlicenseNot gradedqualityDmaintenanceEnables AI agents to capture, replay, inspect, diff, share, and manage executable bug artifacts (.bug files) via the BugProof CLI, supporting 10 tools and structured prompts for debugging workflows.53 npmAGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables coding agents to capture and replay intermittent software failures, minimize reproductions, compare trials, search regressions, verify proposed fixes against a saved failing baseline, and retrieve investigation evidence without rerunning commands.100 npmMIT