gdb-mcp (gdb and rr MCP server)
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.
README
gdb-mcp
Experimental — expect rough edges and breaking changes.
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 forrr_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 ((pwndbg), gef>) will break session startup. Either avoid them or
force the standard prompt in .gdbinit:
set prompt (gdb)
Timeout behaviour: if an execution command times out, the session is in an
indeterminate state. Call interrupt to stop the inferior, wait for the
blocked tool call to return, then resume normally. When in doubt, stop_session
start_sessiongives a clean slate.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。