GDB MCP Server

GDB MCP Server

An MCP server for GDB debugging.

smadi0x86

开发者工具
访问服务器

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.

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
MCP Package Docs Server

MCP Package Docs Server

促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。

精选
本地
TypeScript
Claude Code MCP

Claude Code MCP

一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。

精选
本地
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。

精选
本地
JavaScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

精选
TypeScript
Linear MCP Server

Linear MCP Server

一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

精选
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Curri MCP Server

Curri MCP Server

通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。

官方
本地
JavaScript