GDB and RR Debugging MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/schuay/gdb-mcp
cd gdb-mcp

Then follow the repository README for any remaining dependency or build steps before continuing.

2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add gdb-mcp -- node "<FULL_PATH_TO_GDB_MCP>/dist/index.js"

Replace <FULL_PATH_TO_GDB_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

MCP server that exposes GDB debugging as tools.

gdb-mcp

MCP server that exposes GDB debugging as tools. An AI assistant can set breakpoints, run programs, step through code, inspect variables and memory, and examine registers — all via structured tool calls.

Reverse debugging with rr is also supported.

Requirements

  • Python 3.12+
  • uv
  • GDB on $PATH
  • rr on $PATH (optional — only needed for rr_record / start_replay_session)

Installation

uv tool install git+https://github.com/schuay/gdb-mcp.git

This installs a gdb-mcp command into an isolated environment and puts a shim on your $PATH. Upgrade later with:

uv tool upgrade gdb-mcp

Install and configure Gemini CLI

curl -fsSL https://raw.githubusercontent.com/schuay/gdb-mcp/main/install-gemini.sh | bash

This installs the tool and adds the server to ~/.gemini/settings.json. Requires jq.

Tools

Session management

Tool Description
start_session Spawn a GDB process, optionally loading a binary
stop_session Kill a session and free its resources
list_sessions Show all active sessions with idle time and kind (gdb / rr-replay)

Time-travel debugging (rr)

rr records a full execution trace and replays it deterministically, enabling reverse-execution (reverse-continue, reverse-step, etc.).

Tool Description
rr_record Record a program execution; returns trace_dir for later replay
start_replay_session Start an rr replay session; accepts trace_dir from rr_record, or omit to replay the latest recording

A replay session works with all standard tools, plus dedicated reverse-execution tools:

Tool Description
reverse-continue Run backwards to the previous breakpoint or watchpoint
reverse-step Step backwards one source line or instruction (enters calls)
reverse-next Step backwards one source line or instruction (skips calls)
reverse-finish Run backwards to where the current function was called

Typical workflow:

rr_record("/path/to/binary", args=["--flag"])
  → { "trace_dir": "/home/user/.local/share/rr/binary-0", ... }

start_replay_session(trace_dir="/home/user/.local/share/rr/binary-0")
  → { "session_id": "a1b2c3d4", ... }

# Now use the session_id with any tool: breakpoint, run, reverse-continue, etc.

Execution control

Execution tools block until the inferior stops (breakpoint, signal, exit, or timeout). While blocked, use interrupt to send SIGINT and unblock.

Tool GDB command Description
run run Start or restart the inferior
continue_exec continue Continue after a stop
step step / stepi Step into next line or instruction
next next / nexti Step over next line or instruction
finish finish Run until current function returns
until until Run until a specific location (skip loops)
interrupt SIGINT Interrupt a running inferior

Breakpoints and watchpoints

Tool GDB command Description
breakpoint break / tbreak Set a breakpoint (supports conditions)
delete_breakpoints delete Delete one or all breakpoints
watch watch / rwatch / awatch Stop when an expression is written, read, or accessed

Threads

Tool GDB command Description
list_threads info threads List all threads with their current location
select_thread thread N Switch to a specific thread

Stack frames

Tool GDB command Description
backtrace backtrace Show the full call stack
select_frame frame N Select a frame by number
up up Move up toward the caller
down down Move down toward the innermost frame

Inspection

Tool GDB command Description
context frame + info args + info locals + list Full snapshot of current location, arguments, locals, and source — call this after every stop
list_variables info locals / info args Variables in the current frame
print print Evaluate and print a GDB expression
examine x Examine memory at an address
info_registers info registers Show CPU register values
list_source list Show source code around the current position
disassemble disassemble Disassemble a function or address range

Generic

Tool Description
exec_command Run any GDB command and return its output
batch_commands Run a list of commands sequentially (fewer round-trips)

exec_command handles execution commands correctly: advance, jump, signal, and return all block until the inferior stops, just like the named tools do.

Notes

GDB plugins such as pwndbg or GEF work if installed, but their custom prompts (`(

Tools (34)

start_sessionSpawn a GDB process, optionally loading a binary
stop_sessionKill a session and free its resources
list_sessionsShow all active sessions with idle time and kind
rr_recordRecord a program execution
start_replay_sessionStart an rr replay session
reverse-continueRun backwards to the previous breakpoint or watchpoint
reverse-stepStep backwards one source line or instruction
reverse-nextStep backwards one source line or instruction (skips calls)
reverse-finishRun backwards to where the current function was called
runStart or restart the inferior
continue_execContinue after a stop
stepStep into next line or instruction
nextStep over next line or instruction
finishRun until current function returns
untilRun until a specific location
interruptInterrupt a running inferior
breakpointSet a breakpoint
delete_breakpointsDelete one or all breakpoints
watchStop when an expression is written, read, or accessed
list_threadsList all threads with their current location
select_threadSwitch to a specific thread
backtraceShow the full call stack
select_frameSelect a frame by number
upMove up toward the caller
downMove down toward the innermost frame
contextFull snapshot of current location, arguments, locals, and source
list_variablesVariables in the current frame
printEvaluate and print a GDB expression
examineExamine memory at an address
info_registersShow CPU register values
list_sourceShow source code around the current position
disassembleDisassemble a function or address range
exec_commandRun any GDB command and return its output
batch_commandsRun a list of commands sequentially

Configuration

claude_desktop_config.json
{"mcpServers": {"gdb": {"command": "uv", "args": ["tool", "run", "gdb-mcp"]}}}

Try it

Start a GDB session for my binary at ./build/app and set a breakpoint at main.
Run the program and show me the backtrace when it hits the breakpoint.
Record this execution using rr so I can perform reverse debugging.
Step backwards through the code to find where the variable 'x' was modified.
Examine the memory at the current stack pointer address.

Frequently Asked Questions

What are the key features of GDB and RR Debugging?

Full GDB integration for controlling program execution. Support for time-travel debugging via rr. Breakpoint and watchpoint management. Thread and stack frame inspection. Memory and register examination.

What can I use GDB and RR Debugging for?

Automated debugging of C/C++ applications. Root cause analysis of intermittent crashes using rr traces. Learning complex codebases by stepping through execution with AI guidance. Verifying memory state and register values during runtime.

How do I install GDB and RR Debugging?

Install GDB and RR Debugging by running: uv tool install git+https://github.com/schuay/gdb-mcp.git

What MCP clients work with GDB and RR Debugging?

GDB and RR Debugging works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep GDB and RR Debugging docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare