gdb-mcp

gdb-mcp

MCP server that wraps gdb to enable LLMs to drive live debugging sessions, including starting sessions on binaries, attaching to processes, and running commands.

Category
访问服务器

README

gdb-mcp

Model Context Protocol server that wraps gdb so an LLM can drive live debugging sessions. The server exposes tools for starting a session on a binary, attaching to an existing PID, running ad-hoc commands, batching commands, checking status, and shutting sessions down.

Requires gdb on the host and the mcp python package (v1+).

Setup

Install from PyPI (preferred):

pip install gdb-mcp

You can also install from source, inside a virtualenv (recommended) or directly:

# optional but recommended
python -m venv .venv
. .venv/bin/activate

pip install -e .
# or: pip install .

Running the MCP server

You can start the server directly:

gdb-mcp
# or
python -m gdb_mcp.server

The server uses stdio for transport (the default for most MCP clients). Point your MCP client configuration at the command above.

One-shot client configuration

Run gdb-mcp --install to add the server to any detected MCP-aware clients without editing config files by hand. The installer currently knows how to update:

  • Codex CLI (~/.codex/config.toml)
  • Claude Desktop configs (common Linux/macOS paths)
  • Cursor / Windsurf MCP config files (if present)

Use --install-command /custom/path/to/gdb-mcp or --install-args ... if you need to override what gets written.

Exposed tools

  • start_binary(binary_path, args=None, cwd=None, load_init=True, start_timeout=30.0, prompt=None, force_prompt=True) – launch gdb against a target binary (with optional args) and return a session id and the initial banner. Set load_init=False to skip user gdbinit (default is to load it so helpers like GEF/pwndbg remain enabled). Increase start_timeout if loading extensions takes longer to reach the first prompt. Use prompt to force a specific prompt string (defaults cover (gdb), (pwndbg), and gef>). force_prompt sets the prompt to the chosen value after startup to avoid timeouts from customized prompts (e.g., pwndbg); set force_prompt=False if you need to keep your custom prompt unchanged.
  • attach_to_pid(pid, cwd=None, load_init=True, start_timeout=30.0, prompt=None, force_prompt=True) – start gdb and attach to a running process (same load_init/timeout/prompt behavior as above).
  • gdb_command(session_id, command, timeout_seconds=15.0) – execute a single gdb command in the given session and return the output.
  • batch_commands(session_id, commands, timeout_seconds=15.0) – run a list of commands sequentially.
  • list_sessions() – get a snapshot of all active sessions.
  • session_status(session_id) – check if the gdb process is still alive.
  • stop_session(session_id) – shut down the gdb process and remove it.

Each tool returns simple JSON so it is easy to route back into your LLM prompt.

Notes and tips

  • The server automatically disables pagination and confirmation prompts and enables pending breakpoints to keep interactions non-blocking.
  • timeout_seconds applies per command. If you expect a program to run for a long time, pass a larger timeout or None.
  • Output is captured from gdb stdout/stderr until the next (gdb) prompt. If you spawn a program that never returns to the prompt (e.g., it blocks on input), the call will time out.
  • Common debugger prompts are detected automatically ((gdb), (pwndbg), gef>), even with ANSI colors. You can still pass a custom prompt if you use something nonstandard. By default the server forces the prompt to a stable value (force_prompt=True) so gdbinit customizations (like pwndbg) don’t prevent the initial prompt from being detected.

Demo

Auto-playing preview:

Demo

Source video: docs/media/demo.mp4

Credits

  • This project was built for my CSE 598 class, which emphasized using AI/LLMs in our workflow. I leaned on AI to write the entire project—including this README.
  • Inspired by https://github.com/mrexodia/ida-pro-mcp, and their server logic was used as a starting point.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选