Skip to main content
Glama
liert

pwndbg-mcp

by liert

pwndbg-mcp

MCP Server for pwndbg - 让 AI Agent 能够通过标准 MCP 协议控制 pwndbg 进行协作调试

特性

  • ✅ 标准 HTTP MCP 协议

  • ✅ 支持远程访问

  • ✅ 自动启动,无需手动初始化

  • ✅ 完整的 GDB/pwndbg 命令支持

  • ✅ 支持人机协作调试

  • ✅ 实时状态同步

  • ✅ 模块化架构,易于扩展

Related MCP server: pwndbg-lldb-mcp

快速开始

安装

运行安装脚本:

python3 setup.py

按照提示操作,脚本会:

  1. 检查依赖

  2. 自动添加到 ~/.gdbinit

  3. 配置自动加载

手动安装

~/.gdbinit 中添加:

source /path/to/pwndbg-mcp/pwndbg_mcp.py

使用

1. 启动 pwndbg

gdb ./your_binary

HTTP MCP 服务器会自动启动在 127.0.0.1:22334

2. 管理命令

# 查看状态
pwndbg> mcp-status

# 启动服务器(支持自定义配置)
pwndbg> mcp-start                    # 默认 127.0.0.1:22334
pwndbg> mcp-start 0.0.0.0            # 监听所有接口,端口22334
pwndbg> mcp-start 0.0.0.0 9000       # 自定义host和port
pwndbg> mcp-start 9000               # 只改端口

# 停止服务器
pwndbg> mcp-stop

3. 配置 Claude Code

在 Claude Code 的 MCP 配置中添加:

{
  "mcpServers": {
    "pwndbg-mcp": {
      "url": "http://127.0.0.1:22334"
    }
  }
}

4. 开始调试

在 Claude Code 中可以直接使用 MCP 工具控制 pwndbg!

支持的工具

工具

描述

gdb_execute

执行 GDB/pwndbg 命令

gdb_get_registers

获取寄存器状态

gdb_get_memory

读取内存

gdb_set_breakpoint

设置断点

gdb_delete_breakpoint

删除断点

gdb_get_breakpoints

列出所有断点

gdb_continue

继续执行

gdb_step

单步进入

gdb_stepi

单步执行指令

gdb_next

单步跳过

gdb_nexti

下一条指令

gdb_get_backtrace

获取调用栈

gdb_get_info

获取程序信息

架构

模块化设计

pwndbg_plugin/
├── __init__.py       - 插件入口,自动启动
├── http_bridge.py    - HTTP MCP 服务器
├── commands.py       - 用户管理命令
├── wrappers.py       - 内部包装命令
├── queries.py        - 查询接口
├── events.py         - 事件处理
└── utils.py          - 工具函数

通信协议

  • 传输: HTTP POST

  • 协议: 标准 MCP (Model Context Protocol)

  • 端点: POST /POST /mcp

  • 格式: JSON-RPC 2.0

配置

安全建议

默认监听 127.0.0.1(仅本地访问)。如需远程访问:

pwndbg> mcp-start 0.0.0.0 22334

⚠️ 警告:开放远程访问前请确保网络安全

防火墙配置

如果需要远程访问,确保防火墙允许端口:

# UFW
sudo ufw allow 22334/tcp

# iptables
sudo iptables -A INPUT -p tcp --dport 22334 -j ACCEPT

故障排查

检查服务器状态

pwndbg> mcp-status

测试连接

curl -X POST http://127.0.0.1:22334/ \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}'

查看日志

服务器输出会显示在 pwndbg 终端中

开发

添加新工具

  1. queries.py 中添加查询函数

  2. http_bridge.py_get_tools_list() 中注册工具

  3. _execute_tool() 中添加工具映射

测试

cd examples
gdb test_program
pwndbg> start

License

MIT

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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/liert/pwndbg-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server