GDB MCP Server

GDB MCP Server

An MCP server for GDB debugging.

smadi0x86

Developer Tools
Visit Server

README

GDB MCP Server

https://github.com/user-attachments/assets/1bac46ee-4054-432d-95b8-660c9062d863

An MCP server written in MCP python SDK that enables LLMs to interact with GDB for program debugging and analysis. This tool allows LLMs to perform complex debugging tasks through a generative AI interface.

Features

  • Session Management

    • Start and manage multiple GDB sessions
    • Load programs and core dumps
    • Attach to running processes
  • Debugging Commands

    • Set breakpoints with conditions
    • Step through code (step, next, finish)
    • Continue execution
    • Get backtraces
    • Print variable values
    • Disassemble code
    • List available functions
    • Inspect registers
  • Advanced Features

    • Multi-session support
    • Working directory configuration
    • Program argument handling
    • Core dump analysis
    • Symbol inspection

Note: The info functions and disassemble commands are temporarily disabled due to GDB Machine Interface (MI) output parsing issues. These features will be restored in a future update once the output parsing is properly implemented.

Project Status

  • For known issues and current bugs, see BUGS.md
  • For planned improvements and features, see TODO.md

Tools Available

GDB_COMMANDS = [
    gdb_start,
    gdb_load,
    gdb_run,
    gdb_command,
    gdb_attach,
    gdb_load_core,
    gdb_set_breakpoint,
    gdb_continue,
    gdb_step,
    gdb_next,
    gdb_finish,
    gdb_backtrace,
    gdb_print,
    gdb_disassemble,
    gdb_info_registers,
    gdb_info_functions,
    gdb_list_sessions,
    gdb_terminate,
]

Installation

  1. Clone the repository:
git clone https://github.com/smadi0x86/gdb-mcp.git
cd gdb-mcp
  1. Install dependencies using Poetry:
poetry install
  1. Install the package in development mode:
poetry install

Usage

  1. Start the GDB MCP server:
python3 gdb-mcp.py
  1. The server will run on stdio, ready to accept commands.

LLM Client Configuration

For Claude Desktop

Add this configuration to your claude_desktop_config.json:

{
  "mcpServers": {
     "gdb": {
    "command": "python3",
    "args": ["/home/your-username/dev/personal/gdb-mcp/gdb-mcp.py"]
    }
  }
}

For VS Code Copilot

Add this configuration to your VS Code settings:

{
  "mcp": {
    "inputs": [],
    "servers": {
      "gdb": {
        "command": "python3",
        "args": ["/home/your-username/dev/personal/gdb-mcp/gdb-mcp.py"]
      }
    }
  }
}

Testing with Example Program

  1. Compile the example program with debug symbols:
gcc -g example.c -o example
  1. Use this prompt with your LLM client:
I have a binary at /path/to/example that I need to analyze. I don't have access to the source code. Please help me understand and debug this program using GDB.

1. Start a GDB session and load the binary
2. Use info functions to discover what functions are available
3. For each interesting function:
   - Disassemble it to understand its behavior
   - Set breakpoints at key instructions
   - Run the program and examine variables at breakpoints
4. When the program crashes or exhibits unexpected behavior:
   - Get a backtrace
   - Examine registers and variables
   - Help me understand what might be causing the issue

For each step:
- Explain what we're doing and why
- Show me the disassembly or variable values
- Help me interpret what we're seeing
- Suggest next steps based on our findings

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the GNU v3 License - see the LICENSE file for details.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python