IG

ipiano/gdb-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

54 stars 13 forks 质量 74 趋势 0MIT

ipiano/gdb-mcp 是从 https://github.com/ipiano/gdb-mcp. 导入的 MCP 服务器候选

概览

ipiano/gdb-mcp 是从 https://github.com/ipiano/gdb-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

一个MCP(模型上下文协议)服务器,为AI助手提供对GDB调试会话的程序访问。这使得AI模型能够像VS Code和CLion等IDE一样,使用GDB/MI(机器接口)协议与调试器交互。

特色

  • 完整的GDB控制:启动会话,执行命令,控制程序执行
  • 线程分析:检查线程,获取回溯,分析线程状态
  • 断点管理:设置条件断点、临时断点
  • 变量检查:评估表达式,检查变量和寄存器
  • 核心转储分析:加载和分析带有自定义初始化的核心转储
  • 灵活初始化:启动时运行 GDB 脚本或命令

建筑

该服务器采用**GDB/MI(机器接口)**协议,这也是专业IDE使用的接口。它提供:

  • 结构化、机器解析输出
  • 完全访问GDB的调试能力
  • 可靠的命令执行和响应处理

安装

先决条件

  • Python 3.10 或更高版本
  • GDB 已安装并可在 PATH 中使用

快速开始

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

GDB MCP Server

An MCP (Model Context Protocol) server that provides AI assistants with programmatic access to GDB debugging sessions. This allows AI models to interact with debuggers in the same way IDEs like VS Code and CLion do, using the GDB/MI (Machine Interface) protocol.

Features

  • Full GDB Control: Start sessions, execute commands, control program execution
  • Thread Analysis: Inspect threads, get backtraces, analyze thread states
  • Breakpoint Management: Set conditional breakpoints, temporary breakpoints
  • Variable Inspection: Evaluate expressions, inspect variables and registers
  • Core Dump Analysis: Load and analyze core dumps with custom initialization
  • Flexible Initialization: Run GDB scripts or commands on startup

Architecture

This server uses the GDB/MI (Machine Interface) protocol, which is the same interface used by professional IDEs. It provides:

  • Structured, machine-parseable output
  • Full access to GDB’s debugging capabilities
  • Reliable command execution and response handling

Installation

Prerequisites

  • Python 3.10 or higher
  • GDB installed and available in PATH

Quick Start

# Install pipx if needed
python3 -m pip install --user pipx
python3 -m pipx ensurepath

# Install gdb-mcp-server
cd /path/to/gdb-mcp
pipx install .

For alternative installation methods (virtual environment, manual setup), see INSTALL.md.

Configuration

Claude Desktop

Add this to your Claude Desktop configuration file:

Location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "gdb": {
      "command": "gdb-mcp-server"
    }
  }
}

For other installation methods and MCP clients, see INSTALL.md.

Environment Variables

The GDB MCP Server supports the following environment variables:

GDB_PATH

Specify the path to the GDB executable to use. This is useful when:

  • You have multiple GDB versions installed
  • GDB is installed in a non-standard location
  • You want to use a custom or patched GDB build

Default: gdb (resolved via system PATH)

Example:

export GDB_PATH=/usr/local/bin/gdb-13.2
gdb-mcp-server

Note: The gdb_path parameter in the gdb_start_session tool overrides this environment variable if both are specified.

GDB_MCP_LOG_LEVEL

Set the logging level for the server.

Default: INFO Options: DEBUG, INFO, WARNING, ERROR, CRITICAL

Example:

export GDB_MCP_LOG_LEVEL=DEBUG
gdb-mcp-server

Available Tools

The GDB MCP Server provides 22 tools for controlling GDB debugging sessions:

Session Management:

  • gdb_start_session - Start a new GDB session with optional initialization
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "gdb": { "command": "gdb-mcp-server" } } }