Pursue the most stable GDB MCP service.
gdb-mcp
English | 简体中文
GDB MCP Server for AI Debugging Workflows
Expose practical GDB capabilities as MCP tools for assistants and automation.
Overview
gdb-mcp is a Python MCP server that turns common GDB operations into MCP tools.
It is designed for:
- interactive AI-assisted debugging
- repeatable local debugging workflows
- lightweight integration into MCP-compatible clients
Key Features
- Multi-session GDB management
- Program load / process attach / core dump load
- Breakpoint lifecycle and execution control (
set/list/toggle/delete,continue,step,next) - Runtime inspection with structured fields: backtrace frames, registers, memory, expressions
- Lightweight GDB/MI parsing via
pygdbmi(gdb_commandincludesmiRecordswhen MI lines are present) - MCP client config installer (
gdb-mcp install)
Structured-first response policy:
- When structured parsing succeeds (for example
miRecords/frames/registers/breakpoints), the corresponding raw text field is omitted. - Raw text is kept only as a fallback when structured parsing yields no usable data.
Quick Start
Requirements:
- Python 3.11+
uvgdb
Install and run:
uv sync --extra dev
uv run gdb-mcp
Runtime Modes and Config
gdb-mcp reads runtime config from:
GDB_MCP_CONFIG(supports relative path)- default
./config.jsonin the project root
Environment variables can override config values:
GDB_MODE=default|advancedGDB_MCP_MAX_OUTPUT_CHARS=<int>
Use gdb_get_capabilities to inspect active mode/policy at runtime.
In default mode, advanced tools are hidden from tools/list.
Mode intent:
default: stable baseline with high-frequency debugging capabilities, sufficient for most day-to-day debugging workflows.advanced: extendsdefaultwith deeper, customizable analysis flows for complex debugging and deeper pwn-oriented needs.
CLI Commands
uv run gdb-mcp doctor
uv run gdb-mcp install
uv run gdb-mcp install --client Codex
uv run gdb-mcp config
uv run gdb-mcp uninstall
install now supports a full cross-platform client matrix (similar to arida-pro-mcp style), and --client can scope installation to selected clients.
Tool List
gdb_startgdb_get_capabilitiesgdb_loadgdb_commandgdb_terminategdb_list_sessionsgdb_set_breakpointgdb_list_breakpointsgdb_delete_breakpointsgdb_toggle_breakpointsgdb_continuegdb_stepgdb_nextgdb_backtracegdb_printgdb_examinegdb_info_registersgdb_attach(advanced only)gdb_load_core(advanced only)gdb_set_watchpoint(advanced only)gdb_info_threads(advanced only)gdb_thread_select(advanced only)gdb_frame_select(advanced only)gdb_collect_crash_report(advanced only)
Example
See examples/USAGE.md.
Build the sample:
cd examples
gcc -g -O0 crash.c -o crash
Testing
uv run pytest -q
Troubleshooting
gdbnot found: runuv run gdb-mcp doctorand installgdbfirst.- MCP tools fail unexpectedly: verify your target path and session id.
- Client config not installed: run
gdb-mcp installand restart the MCP client.