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
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 routing - GDB Manager (
gdb_manager.py
) - Manages GDB subprocess lifecycle - Session 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)
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
An MCP server that provides programmatic access to the GNU Debugger (GDB), enabling AI models to interact with GDB through natural language for debugging tasks.
Related MCP Servers
- -securityAlicense-qualityA GDB/MI protocol server based on the MCP protocol, providing remote application debugging capabilities.Last updated -38RustMIT License
- -securityAlicense-qualityA MCP server for LLDB that allows automatic analyzing, debugging and disassembling of native apps.Last updated -51PythonBSD 2-Clause "Simplified" License
- -securityFlicense-qualityAn MCP server that provides access to Google Cloud Monitoring API, enabling interaction with cloud resources monitoring data through natural language commands.Last updated -Python
- -securityFlicense-qualityAn MCP server that provides natural language interaction with Google's Policy Troubleshooter API, allowing users to troubleshoot access denied errors and analyze IAM policies.Last updated -Python