pwndbg-mcp

pwndbg-mcp

Enables AI agents to control pwndbg for collaborative debugging with real-time state synchronization and full GDB/pwndbg command support.

Category
Visit Server

README

pwndbg-mcp

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

特性

  • ✅ 标准 HTTP MCP 协议
  • ✅ 支持远程访问
  • ✅ 自动启动,无需手动初始化
  • ✅ 完整的 GDB/pwndbg 命令支持
  • ✅ 支持人机协作调试
  • ✅ 实时状态同步
  • ✅ 模块化架构,易于扩展

快速开始

安装

运行安装脚本:

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

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
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured