GDB MCP Server
Provides debugging support for programs running on Arm architectures, including aarch64-none-linux-gnu and arm-none-eabi.
Interfaces with the GNU Project Debugger (GDB) to provide execution control, memory inspection, and breakpoint management tools.
Supports remote debugging of applications and systems targeting Linux-based environments.
Enables remote debugging of programs running inside QEMU emulators by connecting to their gdbserver interface.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GDB MCP Serverconnect to localhost:1234 and show the local variables at the current breakpoint"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GDB MCP Server
MCP服务器,用于AI Agent调试嵌入式系统程序。支持交叉编译GDB工具(aarch64、arm等),远程调试(gdbserver/QEMU),提供完整的调试信息查询功能。
功能特性
多架构支持: aarch64-none-linux-gnu-gdb, arm-none-eabi-gdb, x86_64-gdb
远程调试: 连接目标板的gdbserver或QEMU模拟器
条件断点: 支持条件表达式断点
完整调试信息: 寄存器、内存、堆栈、变量、线程等
MCP集成: 作为Claude Code或其他MCP客户端的工具使用
快速开始
1. 安装
npm install
npm run build2. 配置MCP客户端
在Claude Code的设置中添加:
{
"mcpServers": {
"gdb": {
"command": "node",
"args": ["C:/Users/zjm09/Documents/work/2025/gdb-mcp/dist/index.js"]
}
}
}3. 使用MCP工具
# 初始化GDB
gdb_init({architecture: "aarch64"})
# 连接目标
gdb_connect({target: "localhost:1234"})
# 加载程序
gdb_load_program({programPath: "./main"})
# 设置断点
gdb_set_breakpoint({location: "main.c:10"})
gdb_set_breakpoint({location: "factorial", condition: "n==0"}) # 条件断点
# 执行调试
gdb_run()
gdb_step()
gdb_next()
# 查看信息
gdb_list_registers()
gdb_read_registers({registers: ["pc", "sp"]})
gdb_list_locals()
gdb_evaluate_expression({expression: "x"})工具列表
连接管理
工具 | 描述 |
| 启动GDB进程 |
| 连接远程目标 |
| 断开并终止GDB |
| 加载可执行文件 |
执行控制
工具 | 描述 |
| 开始执行 |
| 继续执行 |
| 单步进入函数 |
| 单步跳过函数 |
| 执行到返回 |
| 中断执行 |
断点管理
工具 | 描述 |
| 设置断点(支持条件) |
| 删除断点 |
| 列出断点 |
| 启用断点 |
| 禁用断点 |
| 设置断点条件 |
内存/寄存器
工具 | 描述 |
| 读取内存 |
| 列出寄存器名 |
| 读取寄存器值 |
| 写入寄存器 |
堆栈/变量
工具 | 描述 |
| 列出调用栈 |
| 选择栈帧 |
| 列出局部变量 |
| 列出函数参数 |
| 计算表达式 |
线程管理
工具 | 描述 |
| 列出线程 |
| 选择线程 |
调试信息
工具 | 描述 |
| 获取当前位置 |
| 列出源文件 |
| 反汇编 |
高级
工具 | 描述 |
| 执行原始GDB MI命令 |
测试
使用QEMU模拟
cd tests/test-program
make # 交叉编译
bash start-qemu.sh # 启动QEMU等待GDB连接测试流程
启动QEMU后,使用MCP工具连接
设置断点、执行调试
查看变量、寄存器等调试信息
项目结构
gdb-mcp/
├── src/
│ ├── index.ts # MCP服务器入口
│ ├── gdb/
│ │ ├── gdb-process.ts # GDB进程管理
│ │ ├── mi-parser.ts # MI输出解析
│ │ ├── mi-commands.ts # MI命令构建
│ │ └── types.ts # 类型定义
│ ├── schemas/ # Zod验证
│ └── constants.ts # 配置常量
├── tests/
│ └ test-program/ # 测试程序
│ └ README.md
│ └ tsconfig.json
│ └ package.json开发
npm run dev # 开发模式(自动重载)
npm run build # 编译
npm run inspector # 使用MCP Inspector测试许可证
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zjm1060/gdb-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server