Provides an MCP interface to discover, attach to, and control GDB sessions for AI-assisted debugging.
Configuration
View docs{
"mcpServers": {
"yywz1999-gdb-mcp-server": {
"command": "python3",
"args": [
"mcp_server.py"
]
}
}
}You can run a Python-based MCP server that talks to GDB using the Model Context Protocol. This server lets an AI assistant interact with GDB, attach to running GDB sessions, manage breakpoints, inspect memory and registers, step through code, and perform common debugging tasks across multi-architecture and remote scenarios.
Launch the MCP server in a local environment to enable interaction with GDB through MCP. Start by attaching to a running GDB session or discovering active GDB processes, then perform debugging actions via MCP calls that correspond to common GDB operations.
# prerequisites: Python 3.11+ and Git
# 1) Clone the MCP server repository
git clone https://github.com/yywz1999/gdb-mcp-server.git
cd gdb-mcp-server
# 2) Install Python dependencies
python3 -m pip install -r requirements.txt
# 3) Run the MCP server (from the repository root or adjust path as needed)
python3 mcp_server.py
```
This sequence installs dependencies and starts the MCP server so you can begin interfacing with GDB via MCP.The server provides a standard set of tools to locate and attach to GDB, followed by a suite of GDB-related actions you can trigger via MCP calls. When starting from macOS with a terminal, you may want to optimize terminal handling and ensure the GDB terminal is ready before attaching.
The following tools are available for interacting with GDB through MCP: sys_find_gdb_processes, sys_attach_to_gdb, gdb_execute_command, gdb_set_breakpoint, gdb_delete_breakpoint, gdb_step, gdb_next, gdb_finish, gdb_continue, gdb_get_registers, gdb_examine_memory, gdb_get_stack, gdb_get_locals, gdb_disassemble, gdb_connect_remote.
Find all running GDB processes on the host so you can attach without manual process selection.
Attach the MCP server to a selected GDB process to start issuing commands.
Execute an arbitrary GDB command and return the result.
Set a breakpoint at a specified location.
Remove a breakpoint by its location or number.
Step through the next source line of code.
Continue execution until the next line in the current function.
Run until the current function returns.
Continue program execution.
Fetch the current values of CPU registers.
Inspect a memory region by address and size.
Obtain the current stack trace.
Retrieve local variables in the current stack frame.
Disassemble a code region to view assembly instructions.
Connect to a remote debugging target.