LLDB MCP/HTTP 服务器——通过 dbg_exec 工具从外部 AI 代理驱动 LLDB
概览
一个LLDB插件,它通过(模型上下文协议)和纯层语言暴露调试器,这样外部AI代理(Claude Code、Claude Desktop等)可以通过单一dbg_exec工具驱动调试会话。 插件嵌入了 。这是一个薄桥:它会根据请求运行 LLDB 命令并返回输出。带上你自己的代理。 - LLDB 16+ 带开发头部 - CMake 3.20+ - C++17编译器 注意:Winget 包在运行时需要 Python 3.10(见下方 Windows 设置)。 输出:- Linux: build/lldb_agent.so - macOS: build/lldb_agent.dylib - Windows: build-windows/Release/lldb_agent.dll 该插件依赖于 fastmcpp(作为外部/fastmcpp 子模块出售),该模块提供 MCP 服务器、cpp-httplib 和 nlohmann_json。 服务器启动时会打印URL和端点(并复制到Windows的剪贴板)。将MCP客户端指向SSE端点,或者对HTTP端点发送POST命令,然后点击LLDB停止服务器。 bind_addr默认为127.0.0。
概述(AI 翻译)
一个LLDB插件,通过MCP(模型上下文协议)暴露调试器,并且
纯 HTTP,因此外部 AI 代理(Claude Code、Claude Desktop 等)可以驱动
通过单一的 dbg_exec 工具完成调试会话。
该插件嵌入了无AI。它是一个薄桥:它能根据请求运行LLDB命令 并退回他们的产出。带上你自己的经纪人。
要求
- 带开发头部的LLDB 16+
- CMake 3.20+
- C++17编译器
平台特定要求
Linux:
macOS:
Windows:
注意:Winget 包在运行时需要 Python 3.10(见下方 Windows 设置)。
建造
Linux/macOS:
Windows:
输出:
- Linux:
build/lldb_agent.so - macOS:
build/lldb_agent.dylib - 窗口:
build-windows/Release/lldb_agent.dll
插件依赖于 fastmcpp(作为子模块销售)
在external/fastmcpp下),该服务器提供MCP服务器、cpp-httplib和nlohmann_json。
用途
服务器启动时会打印它的 URL 和端点(并复制到 clipboard 上 Windows)。将MCP客户端指向SSE端点,或者向HTTP端点发送POST命令, 然后在LLDB中按Ctrl+C以停止服务器。
命令
|指挥 |描述 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
LLDB Agent
An LLDB plugin that exposes the debugger over MCP (Model Context Protocol) and
plain HTTP, so an external AI agent (Claude Code, Claude Desktop, etc.) can drive
your debug session through a single dbg_exec tool.
The plugin embeds no AI. It is a thin bridge: it runs LLDB commands on request and returns their output. Bring your own agent.
Requirements
- LLDB 16+ with development headers
- CMake 3.20+
- C++17 compiler
Platform-specific requirements
Linux:
sudo apt install liblldb-dev lldb
macOS:
xcode-select --install
Windows:
winget install LLVM.LLVM
Note: The winget package requires Python 3.10 at runtime (see Windows Setup below).
Build
Linux/macOS:
cmake --preset default
cmake --build --preset default
Windows:
cmake --preset windows
cmake --build --preset windows
Output:
- Linux:
build/lldb_agent.so - macOS:
build/lldb_agent.dylib - Windows:
build-windows/Release/lldb_agent.dll
The plugin depends on fastmcpp (vendored as a submodule
under external/fastmcpp), which provides the MCP server, cpp-httplib and nlohmann_json.
Usage
# Start LLDB with your program
lldb ./myprogram
# Load the plugin
(lldb) plugin load /path/to/lldb_agent.so
# Start the MCP (SSE) server - blocks until Ctrl+C
(lldb) agent mcp
# ...or a plain HTTP server
(lldb) agent http
When a server starts it prints its URL and endpoints (and copies them to the clipboard on Windows). Point your MCP client at the SSE endpoint, or POST commands to the HTTP endpoint, and press Ctrl+C in LLDB to stop the server.
Commands
| Command | Description |
|---|---|
agent help |
Show help |
agent version |
Show version |
agent mcp [bind_addr] |
Start the MCP (SSE) server, block until Ctrl+C |
agent http [bind_addr] |
Start the plain HTTP server, block until Ctrl+C |
bind_addr defaults to 127.0.0.1 (localhost only). Pass 0.0.0.0 to listen on all
interfaces — note the server has no authentication, so only do this on trusted networks.
MCP client configuration
agent mcp prints a ready-to-paste snippet, e.g. for Claude Desktop:
{
"mcpServers": {
"lldb-agent": {
"url": "http://127.0.0.1:/sse"
}
}
}
HTTP API
agent http exposes:
| Method | Path | Purpose |
|---|---|---|
| POST | /exec |
Run a debugger command: {"command": "bt"} → {"output": "...", "success": true} |
| GET | /status |
Server readiness |
| POST | /shutdown |
Stop the server |
curl -X POST http://127.0.0.1:/exec \
-H "Content-Type: application/json" \
-d '{"command": "bt"}'
Windows Setup
The LLVM package from winget requires Python 3.10 to run LLDB. Download and extract to the project bin folder:
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"lldb-agent": {
"url": "http://127.0.0.1:<port>/sse"
}
}
}