MCP Server for GNU Debugger with all gdb commands.
Configuration
View docs{
"mcpServers": {
"hnmr293-gdb-mcp": {
"command": "gdb-mcp",
"args": []
}
}
}GDB-MCP is an MCP server that exposes the GNU Debugger (GDB) through a standardized interface, enabling AI models and other MCP clients to manage debugging sessions, run commands, and inspect program state with ease. It leverages the gdb/mi interface to provide full GDB functionality in an asynchronous, session-based environment while guarding resources with automatic timeouts.
You interact with GDB-MCP by creating isolated debugging sessions, issuing GDB commands, and closing sessions when you are done. The server exposes a set of tools that let you open a session, run GDB commands in either CLI or MI mode, and retrieve results or variable values. You can manage multiple sessions concurrently, and idle sessions are automatically cleaned up to prevent resource leaks.
To start debugging, create a new session, load your executable, set breakpoints, and run the program. You can then inspect variables, memory, and program state across any active session. When you finish debugging, close the session to free resources.
Documentation for GDB commands is available through MCP resources, including a complete GDB command reference, a CLI command list with abbreviations, a MI command reference, and a mapping between CLI and MI commands. Use these references to discover the exact commands you can send and how their output is structured.
Prerequisites you need before installing the GDB-MCP server:
• Python 3.12 or higher
• GDB installed on your system
• An MCP-compatible client (for example, Claude Desktop)
Install from source by cloning the repository, installing dependencies, and installing the package in editable mode.
# Clone the repository
git clone https://github.com/yourusername/gdb-mcp.git
cd gdb-mcp
# Install dependencies
pip install -r requirements.txt
# Install the package
pip install -e .You can run the server directly from the command line. Use one of the following commands to start GDB-MCP in standard IO mode.
# Start the MCP server
gdb-mcp
# Or run directly with Python
python -m gdb_mcpConfigure your MCP client to connect to the local GDB-MCP server. A common setup shows a named MCP server entry that executes the server command. Here is a representative configuration snippet you can adapt for your client.
{
"mcpServers": {
"gdb_mcp": {
"command": "gdb-mcp"
}
}
}Start a new debugging session and prepare a GDB environment for the target executable.
Execute a GDB command within a specific session, such as setting breakpoints or inspecting state.
Close an active debugging session to release resources.
List all currently active debugging sessions.