gdb-mcp
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., "@gdb-mcp start debugging ./mybinary"
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.
gdb-mcp
Model Context Protocol server that wraps gdb so an LLM can drive live debugging
sessions. The server exposes tools for starting a session on a binary, attaching
to an existing PID, running ad-hoc commands, batching commands, checking status,
and shutting sessions down.
Requires
gdbon the host and themcppython package (v1+).
Setup
Install from PyPI (preferred):
pip install gdb-mcpYou can also install from source, inside a virtualenv (recommended) or directly:
# optional but recommended
python -m venv .venv
. .venv/bin/activate
pip install -e .
# or: pip install .Related MCP server: gdb and rr Debugging
Running the MCP server
You can start the server directly:
gdb-mcp
# or
python -m gdb_mcp.serverThe server uses stdio for transport (the default for most MCP clients). Point your MCP client configuration at the command above.
One-shot client configuration
Run gdb-mcp --install to add the server to any detected MCP-aware clients
without editing config files by hand. The installer currently knows how to
update:
Codex CLI (
~/.codex/config.toml)Claude Desktop configs (common Linux/macOS paths)
Cursor / Windsurf MCP config files (if present)
Use --install-command /custom/path/to/gdb-mcp or --install-args ... if you
need to override what gets written.
Exposed tools
start_binary(binary_path, args=None, cwd=None, load_init=True, start_timeout=30.0, prompt=None, force_prompt=True)– launch gdb against a target binary (with optional args) and return a session id and the initial banner. Setload_init=Falseto skip user gdbinit (default is to load it so helpers like GEF/pwndbg remain enabled). Increasestart_timeoutif loading extensions takes longer to reach the first prompt. Usepromptto force a specific prompt string (defaults cover(gdb),(pwndbg), andgef>).force_promptsets the prompt to the chosen value after startup to avoid timeouts from customized prompts (e.g., pwndbg); setforce_prompt=Falseif you need to keep your custom prompt unchanged.attach_to_pid(pid, cwd=None, load_init=True, start_timeout=30.0, prompt=None, force_prompt=True)– start gdb and attach to a running process (sameload_init/timeout/prompt behavior as above).gdb_command(session_id, command, timeout_seconds=15.0)– execute a single gdb command in the given session and return the output.batch_commands(session_id, commands, timeout_seconds=15.0)– run a list of commands sequentially.list_sessions()– get a snapshot of all active sessions.session_status(session_id)– check if the gdb process is still alive.stop_session(session_id)– shut down the gdb process and remove it.
Each tool returns simple JSON so it is easy to route back into your LLM prompt.
Notes and tips
The server automatically disables pagination and confirmation prompts and enables pending breakpoints to keep interactions non-blocking.
timeout_secondsapplies per command. If you expect a program to run for a long time, pass a larger timeout orNone.Output is captured from gdb stdout/stderr until the next
(gdb)prompt. If you spawn a program that never returns to the prompt (e.g., it blocks on input), the call will time out.Common debugger prompts are detected automatically (
(gdb),(pwndbg),gef>), even with ANSI colors. You can still pass a custompromptif you use something nonstandard. By default the server forces the prompt to a stable value (force_prompt=True) so gdbinit customizations (like pwndbg) don’t prevent the initial prompt from being detected.
Demo
Auto-playing preview:

Source video: docs/media/demo.mp4
Credits
This project was built for my CSE 598 class, which emphasized using AI/LLMs in our workflow. I leaned on AI to write the entire project—including this README.
Inspired by https://github.com/mrexodia/ida-pro-mcp, and their server logic was used as a starting point.
Available Tools
7 toolsattach_to_pidC
Start gdb and attach to an existing process id.
Inputs: pid (required), cwd, load_init, start_timeout, +2 more.
batch_commandsC
Send multiple gdb commands in sequence.
Inputs: session_id (required), commands (required), timeout_seconds.
gdb_commandC
Execute a raw gdb command within a session and return the output.
Inputs: session_id (required), command (required), timeout_seconds.
list_sessionsB
List active gdb sessions.
Inputs: no named parameters.
session_statusA
Report whether the given session still has a live gdb process.
Inputs: session_id (required).
start_binaryC
Start a new gdb session for a binary and return the session id.
Inputs: binary_path (required), args, cwd, load_init, +3 more.
stop_sessionC
Shut down a gdb session and remove it from the registry.
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 7 tools
Each tool has a clearly distinct purpose: session creation (attach_to_pid, start_binary), command execution (gdb_command, batch_commands), and session management (list_sessions, session_status, stop_session). No overlap or ambiguity.
All tool names follow a consistent verb_noun pattern (e.g., attach_to_pid, list_sessions, stop_session) using snake_case, making it easy for an agent to infer function.
Seven tools is well-scoped for a GDB debugger MCP, covering all essential operations: starting sessions, sending commands (single and batch), and session lifecycle management.
The tool set covers the full lifecycle of GDB sessions (create, execute, list, check status, stop) and allows arbitrary GDB commands via gdb_command, leaving no obvious gaps.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides programmatic access to the GNU Debugger (GDB), enabling AI models to interact with GDB through natural language for debugging tasks.9Apache 2.0
- AlicenseAqualityDmaintenanceMCP 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.343MIT
- AlicenseCqualityDmaintenanceAn MCP server that exposes pwndbg commands running under LLDB as tools for AI assistants. This enables AI-driven binary analysis, exploit development, and reverse engineering through pwndbg's enhanced debugging capabilities.1001MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to control GDB debugging sessions, including breakpoint management, thread analysis, and variable inspection, using the GDB/MI protocol.221MIT