lldb-mcp-server

lldb-mcp-server

An MCP server that exposes LLDB debugging capabilities, enabling AI-assisted interactive debugging of C/C++ applications through 40 specialized tools.

Category
访问服务器

README

LLDB MCP Server

Language: English | 中文

Version Python License PyPI

Overview

LLDB MCP Server is a debugging server based on the Model Context Protocol (MCP). It exposes LLDB debugging capabilities to AI assistants like Claude Code and Claude Desktop through 40 specialized tools, enabling AI-driven interactive debugging of C/C++ applications.

Core Architecture: Multi-session design where each debugging session has isolated SBDebugger, SBTarget, and SBProcess instances, supporting concurrent debugging workflows.

Use Cases:

  • AI-assisted debugging with Claude Code / Claude Desktop
  • Automated debugging scripts and workflows
  • Crash analysis and security vulnerability detection
  • Remote debugging and core dump analysis

Key Capabilities:

  • 🔧 40 Debugging Tools: Session management, breakpoints, execution control, memory operations, security analysis, and more
  • 🔄 Multi-session Support: Run multiple independent debugging sessions concurrently
  • 📊 Event-driven Architecture: Non-blocking event collection for state changes, breakpoint hits, stdout/stderr
  • 🛡️ Security Analysis: Crash exploitability classification and dangerous function detection
  • 📝 Session Recording: Automatically records all commands and output with timestamps
  • 💻 Cross-platform: Supports macOS (Intel & Apple Silicon), Linux (Ubuntu, Fedora, Arch), and Windows (experimental)

Documentation

Prerequisites

System Requirements

  • Operating System: macOS (Intel or Apple Silicon), Linux (Ubuntu 22.04+, Fedora 38+, Arch Linux), or Windows (10+)
  • LLDB with Python bindings (version 14+, 18+ recommended)
  • Python 3.10+

Platform-Specific Requirements

macOS:

Linux:

  • Package Manager: apt (Ubuntu/Debian), dnf (Fedora/RHEL), or pacman (Arch)
  • LLDB: Install via sudo apt install lldb-18 python3-lldb-18 (Ubuntu) or equivalent

Windows:

  • Chocolatey (recommended) or another LLVM/LLDB distribution that includes Python bindings
  • LLVM/LLDB: Install via choco install -y llvm python

Quick Start

1. Install Dependencies

macOS

# Install Homebrew LLVM (includes LLDB)
brew install llvm

# Install uv (provides uvx command)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Add Homebrew LLVM to PATH (add to ~/.zshrc)
export PATH="$(brew --prefix llvm)/bin:$PATH"

# Reload shell configuration
source ~/.zshrc
hash -r

# Verify LLDB installation
which lldb
lldb --version

Linux (Ubuntu/Debian)

# Install LLDB with Python bindings
sudo apt update
sudo apt install lldb-19 python3-lldb-19

# Install uv (provides uvx command)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Find LLDB Python path
lldb-19 -P
# Example output: /usr/lib/llvm-19/lib/python3.12/site-packages

# Verify Python 3.12 is available (required for LLDB-19 bindings)
which python3.12
python3.12 --version

# Test LLDB Python bindings
python3.12 -c "import sys; sys.path.insert(0, '$(/usr/bin/lldb-19 -P)'); import lldb; print('LLDB Python bindings OK')"

⚠️ CRITICAL - Linux Python Version Matching:

  • LLDB Python bindings are compiled for a specific Python version (e.g., LLDB-19 → Python 3.12)
  • uvx defaults to the system's default Python (often 3.14 from linuxbrew)
  • You MUST force uvx to use the matching Python version with --python /usr/bin/python3.12
  • Always set LLDB_PYTHON_PATH to the output of lldb-19 -P
  • Mismatch between Python versions causes cannot import name '_lldb' error

For other Linux distributions (Fedora, Arch, etc.), see the Linux Installation Guide.

Windows (Chocolatey)

# Install LLVM (includes LLDB) and Python
choco install -y llvm python

# Verify LLDB and Python
lldb --version
python --version

# Verify LLDB Python bindings
python -c "import lldb; print('LLDB Python bindings OK')"

# Install lldb-mcp-server
pip install -U lldb-mcp-server
lldb-mcp-server --help

If import lldb fails, see the Windows Installation Guide for how to set LLDB_PYTHON_PATH.

2. Configure MCP

Choose your IDE and follow the configuration instructions:

Claude Code

macOS - Global Configuration (Recommended):

Intel (x86_64):

claude mcp add-json --scope user lldb-debugger '{
  "type": "stdio",
  "command": "uvx",
  "args": ["--python", "/usr/local/opt/python@3.13/bin/python3.13", "lldb-mcp-server"],
  "env": {
    "LLDB_MCP_ALLOW_LAUNCH": "1",
    "LLDB_MCP_ALLOW_ATTACH": "1",
    "PYTHONPATH": "/usr/local/opt/llvm/lib/python3.13/site-packages"
  }
}'

Apple Silicon (arm64):

claude mcp add-json --scope user lldb-debugger '{
  "type": "stdio",
  "command": "uvx",
  "args": ["--python", "/opt/homebrew/opt/python@3.13/bin/python3.13", "lldb-mcp-server"],
  "env": {
    "LLDB_MCP_ALLOW_LAUNCH": "1",
    "LLDB_MCP_ALLOW_ATTACH": "1",
    "PYTHONPATH": "/opt/homebrew/opt/llvm/lib/python3.13/site-packages"
  }
}'

Linux:

# First, get your LLDB Python path
LLDB_PATH=$(/usr/bin/lldb-19 -P)
echo "LLDB Python path: $LLDB_PATH"

# Then add MCP server configuration
claude mcp add-json --scope user lldb-debugger '{
  "type": "stdio",
  "command": "uvx",
  "args": ["--python", "/usr/bin/python3.12", "-q", "lldb-mcp-server", "--transport", "stdio"],
  "env": {
    "LLDB_MCP_ALLOW_LAUNCH": "1",
    "LLDB_MCP_ALLOW_ATTACH": "1",
    "LLDB_PYTHON_PATH": "'"$LLDB_PATH"'"
  }
}'

Important Notes:

  • Replace /usr/bin/python3.12 with your system's Python 3.12 path if different
  • The --python argument must match the Python version LLDB was compiled for
  • Check LLDB's Python version: lldb-19 -P | grep python3.
  • If you have LLDB-18, use lldb-18 -P and adjust Python version accordingly

Claude Desktop

macOS: Edit ~/Library/Application Support/Claude/claude_desktop_config.json

Linux: Edit ~/.config/claude/claude_desktop_config.json

See Configuration Guide for detailed configuration examples.

Cursor IDE

Create .cursor/mcp.json in your project root or ~/.cursor/mcp.json for global configuration.

See Configuration Guide for platform-specific examples.

Codex (OpenAI)

Use codex mcp add command or edit ~/.codex/config.toml.

See Configuration Guide for detailed instructions.

3. Start Using

All Platforms: No manual installation required! When you configure the MCP server using uvx, it automatically installs and manages the package.

Just configure your IDE and start Claude Code or restart Claude Desktop.

Usage Examples

Basic Debugging

User: "Debug the program at /path/to/my/app"

Claude automatically:
1. Creates a debugging session
2. Loads the binary
3. Sets breakpoints
4. Launches the process
5. Analyzes execution

Crash Analysis

User: "This program crashed, help me analyze the cause"

Claude will:
1. Analyze the crash event
2. Show crash stack trace
3. Check register state
4. Detect dangerous functions
5. Provide repair suggestions

For more examples, see the Usage Guide.

Environment Variables

Variable Purpose Default
LLDB_MCP_ALLOW_LAUNCH=1 Allow launching new processes Disabled
LLDB_MCP_ALLOW_ATTACH=1 Allow attaching to existing processes Disabled
LLDB_PYTHON_PATH Override LLDB Python module path Auto-detect

Troubleshooting

macOS: No module named lldb

# Verify LLDB is from Homebrew
which lldb

# Add to PATH
echo 'export PATH="$(brew --prefix llvm)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
hash -r

Linux: cannot import name '_lldb'

This error occurs when uvx uses a different Python version than LLDB was compiled for.

# Check LLDB's Python version
lldb-19 -P
# Example: /usr/lib/llvm-19/lib/python3.12/site-packages (Python 3.12)

# Check uvx's default Python
uvx --python-preference system python --version
# If this shows 3.14, but LLDB needs 3.12, that's the problem

# Solution: Force uvx to use matching Python version
# Update your MCP config to include: "--python", "/usr/bin/python3.12"
# See Linux configuration section above for complete example

For more issues and solutions, see the Troubleshooting Guide.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选