Provides programmatic access to the GNU Debugger (GDB), enabling command execution, session management, and debugging functionality through GDB's machine interface.
GDB-MCP
https://github.com/user-attachments/assets/84e717ba-6983-442d-bf11-7ba2b17108af
GDB-MCP is a Model Context Protocol (MCP) server that provides programmatic access to the GNU Debugger (GDB). It enables AI models and other MCP clients to interact with GDB through a standardized interface, making debugging capabilities accessible through natural language interactions.
Since it uses the gdb/mi interface, you can access the full functionality of gdb. We also provide a command reference for gdb in resources.
Features
Session Management: Create and manage multiple isolated GDB debugging sessions
Command Execution: Execute both CLI and MI (Machine Interface) GDB commands
Comprehensive Documentation: Access complete GDB command reference through MCP resources
Asynchronous Operation: Built on asyncio for efficient concurrent session handling
Timeout Protection: Automatic cleanup of idle sessions to prevent resource leaks
Related MCP server: LLDB-MCP
Installation
Prerequisites
Python 3.12 or higher
GDB installed on your system
MCP-compatible client (e.g., Claude Desktop)
Install from Source
Quick Start
Running the Server
Claude Desktop Configuration
Add the following to your Claude Desktop configuration file:
See examples/claude_code_config_example.json for a complete configuration example.
Usage
Available Resources
The server provides comprehensive GDB documentation through MCP resources:
gdb://commands/reference- Complete GDB command referencegdb://commands/cli- CLI commands with abbreviationsgdb://commands/mi- Machine Interface commandsgdb://commands/mapping- CLI to MI command correspondence
Available Tools
open - Start a debugging session
call - Execute a GDB command
close - Close a debugging session
list_sessions - List all active sessions
Example Usage
Basic Debugging Session
Accessing Documentation
Architecture
GDB-MCP consists of several key components:
MCP Server (
server.py) - Handles client connections and request routingGDB Manager (
gdb_manager.py) - Manages GDB subprocess lifecycleSession Management - Maintains isolated debugging sessions with automatic timeout
Resource Provider - Serves comprehensive GDB documentation
The server operates GDB in MI (Machine Interface) mode internally for reliable command parsing and structured output.
Development
Project Structure
Security Considerations
Designed for local debugging only
Each GDB session runs in an isolated process
Automatic session timeout prevents resource leaks
File system access limited to user permissions
Acknowledgments
Built on the Model Context Protocol
Powered by GNU Debugger (GDB)