Skip to main content
Glama
LLDB MCP Server
by benpm

LLDB MCP Server

CI

An MCP (Model Context Protocol) server that provides structured debugging tools for LLDB, designed for use with Claude Code and other MCP-compatible AI assistants.

Features

This server exposes LLDB debugging capabilities through well-defined MCP tools:

Execution Control

  • lldb_run - Run a program with optional breakpoints and arguments

  • lldb_analyze_crash - Analyze crash dumps and core files

Breakpoints & Watchpoints

  • lldb_set_breakpoint - Set breakpoints by function, file:line, or address

  • lldb_watchpoint - Set watchpoints to break on variable access

Inspection

  • lldb_examine_variables - View local variables and arguments

  • lldb_backtrace - Get stack traces for all threads

  • lldb_registers - View CPU register values

  • lldb_read_memory - Read and display memory contents

  • lldb_threads - List all threads and their states

Code Analysis

  • lldb_disassemble - Disassemble functions or address ranges

  • lldb_source - List source code with line numbers

  • lldb_symbols - Look up symbols by name, regex, or address

  • lldb_images - List loaded executables and shared libraries

Expression Evaluation

  • lldb_evaluate - Evaluate C/C++ expressions in debug context

Utilities

  • lldb_run_command - Run arbitrary LLDB commands

  • lldb_help - Get help on LLDB commands

  • lldb_version - Show LLDB version info

Related MCP server: GDB MCP Server

Requirements

  • Python 3.10+

  • LLDB (with command-line tool in PATH)

  • mcp[cli] Python package

Installing LLDB

Ubuntu/Debian:

sudo apt install lldb

macOS:

# LLDB comes with Xcode Command Line Tools
xcode-select --install

Windows:

# Install via LLVM releases or Visual Studio
winget install LLVM.LLVM

Installation

  1. We provide a setup script that installs all dependencies and verifies the installation.

  2. Make the script executable

  3. chmod +x setup_for_copilot.sh

  4. Run the setup script

  5. ./setup_for_copilot.sh

  6. This script will:

    1. Check for Python 3 and pip

    1. Install required Python packages (mcp[cli], pydantic, httpx)

    1. Verify the installation by running tests

  7. Option 1: Install from source

# Clone the repository
git clone https://github.com/yourusername/lldb-mcp.git
cd lldb-mcp

# Install dependencies
pip install -e .

Option 2: Install dependencies directly

pip install "mcp[cli]" pydantic httpx

Configuration for Claude Code

Automatic Configuration

You can easily add the server to Claude Code using the mcp add command:

claude mcp add lldb python3 /path/to/lldb-mcp/lldb_mcp_server.py

Replace /path/to/lldb-mcp with the actual path to the repository.

Manual Configuration

Add the following to your Claude Code MCP configuration file:

Location of config file

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

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

Configuration

{
  "mcpServers": {
    "lldb": {
      "command": "python",
      "args": ["/path/to/lldb-mcp/lldb_mcp_server.py"]
    }
  }
}

Or if installed as a package:

{
  "mcpServers": {
    "lldb": {
      "command": "lldb-mcp"
    }
  }
}
{
  "mcpServers": {
    "lldb": {
      "command": "uvx",
      "args": ["--from", "/path/to/lldb-mcp", "lldb-mcp"]
    }
  }
}

Usage Examples

Once configured, you can ask Claude Code to help with debugging tasks:

Analyze a Crash

"Analyze the crash dump in ./core and the executable ./myprogram to find what caused the segfault"

Set Breakpoints and Examine State

"Set a breakpoint at the processData function in processor.cpp, run the program with argument 'test.txt', and show me the local variables when it stops"

Disassemble Code

"Show me the assembly for the main function in ./myprogram"

Evaluate Expressions

"Run ./myprogram until it hits parseConfig and evaluate the expression config->max_threads"

Memory Inspection

"Read 128 bytes of memory at address 0x7fff5fbff000 in hexadecimal format"

Symbol Lookup

"Find all symbols matching 'parse.*' regex in ./myprogram"

Tool Reference

lldb_run_command

Execute any LLDB command directly.

{
    "command": "help breakpoint",  # Any LLDB command
    "target": "./myprogram",       # Optional: executable to load
    "working_dir": "/path/to/dir"  # Optional: working directory
}

lldb_analyze_crash

Analyze crash dumps with full context.

{
    "executable": "./myprogram",
    "core_file": "./core",              # Optional: core dump
    "response_format": "markdown"       # or "json"
}

lldb_set_breakpoint

Set breakpoints with conditions.

{
    "executable": "./myprogram",
    "location": "main.cpp:42",          # or "functionName" or "0x400500"
    "condition": "i > 100"              # Optional: break condition
}

lldb_examine_variables

View variables at a breakpoint.

{
    "executable": "./myprogram",
    "breakpoint": "processData",
    "variables": ["buffer", "size"],    # Optional: specific vars
    "args": ["input.txt"],              # Optional: program args
    "response_format": "markdown"
}

lldb_disassemble

Disassemble code regions.

{
    "executable": "./myprogram",
    "target": "main",                   # Function name, address range, or "current"
    "show_bytes": true,                 # Show opcode bytes
    "mixed": true                       # Interleave source
}

lldb_read_memory

Read memory contents.

{
    "executable": "./myprogram",
    "address": "0x7fff5fbff000",
    "count": 64,                        # Bytes to read
    "format": "x",                      # x=hex, b=binary, d=decimal, s=string
    "breakpoint": "main"                # Optional: stop here first
}

lldb_evaluate

Evaluate C/C++ expressions.

{
    "executable": "./myprogram",
    "expression": "ptr->data[5]",
    "breakpoint": "processBuffer",
    "args": ["test.dat"]
}

lldb_backtrace

Get stack traces.

{
    "executable": "./myprogram",
    "breakpoint": "handleError",        # or use core_file
    "core_file": "./core",              # For post-mortem
    "all_threads": true,
    "limit": 50,
    "response_format": "json"           # Structured output
}

lldb_registers

View CPU registers.

{
    "executable": "./myprogram",
    "breakpoint": "criticalSection",
    "register_set": "general",          # general, float, vector, all
    "specific_registers": ["rax", "rbx", "rsp"]  # Optional
}

lldb_watchpoint

Set data watchpoints.

{
    "executable": "./myprogram",
    "variable": "global_counter",
    "watch_type": "write",              # write, read, read_write
    "condition": "global_counter > 1000"
}

lldb_symbols

Look up symbols.

{
    "executable": "./myprogram",
    "query": "process.*",
    "query_type": "regex"               # name, regex, address, type
}

Alternative: Using LLDB's Built-in MCP Server

LLDB 18+ has built-in MCP support. To use it instead:

  1. Start LLDB and enable MCP:

    (lldb) protocol-server start MCP listen://localhost:59999
  2. Configure Claude Code to connect via netcat:

    {
      "mcpServers": {
        "lldb": {
          "command": "/usr/bin/nc",
          "args": ["localhost", "59999"]
        }
      }
    }

Note: LLDB's built-in MCP only exposes a single lldb_command tool, whereas this server provides structured, specialized tools for better AI integration.

Development

Running Tests

pytest tests/

Type Checking

mypy lldb_mcp_server.py

Linting

ruff check lldb_mcp_server.py
ruff format lldb_mcp_server.py

Troubleshooting

"LLDB executable not found"

Ensure LLDB is installed and in your PATH:

which lldb
lldb --version

Permission denied on core files

On Linux, enable core dumps:

ulimit -c unlimited
sudo sysctl -w kernel.core_pattern=core.%p

Debugger can't find symbols

Compile your programs with debug info:

g++ -g -O0 myprogram.cpp -o myprogram
clang++ -g -O0 myprogram.cpp -o myprogram

License

MIT License - see LICENSE file for details.

Contributing

Contributions welcome! Please read CONTRIBUTING.md for guidelines.

Available Tools

17 tools
lldb_analyze_crashA
Read-onlyIdempotent

Analyze a crashed program or core dump to determine the cause.

This tool loads a core dump or crashed executable and provides:
- Backtrace showing the crash location
- Register state at crash time
- Local variables in the crash frame
- Loaded modules information

Args:
    params: AnalyzeCrashInput with executable path and optional core file

Returns:
    str: Crash analysis including backtrace, registers, and variables

Inputs: params (required). Returns: result

lldb_backtraceA
Read-onlyIdempotent

Get a stack backtrace showing the call chain.

The backtrace shows:
- Frame numbers (0 is current frame)
- Function names and addresses
- Source file and line numbers (if available)
- Module/library names

Args:
    params: BacktraceInput with executable and stopping point

Returns:
    str: Stack backtrace with frame information

Inputs: params (required). Returns: result

lldb_disassembleA
Read-onlyIdempotent

Disassemble machine code to view assembly instructions.

Can disassemble:
- A named function: 'main', 'MyClass::method'
- An address range: '0x1000-0x1100' or '0x1000 0x1100'
- Current frame (when stopped at breakpoint)

Options:
- show_bytes: Include raw opcode bytes
- mixed: Interleave source code with assembly

Args:
    params: DisassembleInput with target and display options

Returns:
    str: Assembly listing

Inputs: params (required). Returns: result

lldb_evaluateA
Read-onlyIdempotent

Evaluate a C/C++ expression in the debugger context.

Expressions can include:
- Variable access: 'my_var', 'ptr->member'
- Array indexing: 'array[5]'
- Function calls: 'strlen(str)'
- Casts: '(int*)ptr'
- Arithmetic: 'x + y * 2'
- sizeof: 'sizeof(MyStruct)'

Args:
    params: EvaluateExpressionInput with expression and context

Returns:
    str: Expression result with type information

Inputs: params (required). Returns: result

lldb_examine_variablesA
Read-onlyIdempotent

Examine local variables and arguments at a breakpoint.

Runs the program until the specified breakpoint, then displays
the values of local variables and function arguments.

Args:
    params: ExamineVariablesInput with executable, breakpoint, and optional variable names

Returns:
    str: Variable values at the breakpoint

Inputs: params (required). Returns: result

lldb_helpA
Read-onlyIdempotent

Get help on LLDB commands and usage.

Provides:
- General LLDB usage (empty topic)
- Help on specific commands (e.g., 'breakpoint', 'memory')
- Command syntax and options

Args:
    topic: Command or topic to get help on (empty for general help)

Returns:
    str: Help text for the specified topic

Inputs: topic. Returns: result

lldb_imagesA
Read-onlyIdempotent

List loaded executable images and shared libraries.

Shows:
- Main executable
- Shared libraries (.so, .dylib, .dll)
- Load addresses
- File paths

Args:
    params: ImageListInput with executable and optional filter

Returns:
    str: List of loaded images with addresses

Inputs: params (required). Returns: result

lldb_read_memoryA
Read-onlyIdempotent

Read and display memory contents at a specified address.

Memory can be displayed in various formats:
- 'x': Hexadecimal (default)
- 'b': Binary
- 'd': Decimal
- 's': String (null-terminated)
- 'i': Instructions (disassembly)

Args:
    params: ReadMemoryInput with address, count, and format

Returns:
    str: Memory contents in requested format

Inputs: params (required). Returns: result

lldb_registersA
Read-onlyIdempotent

View CPU register values at a breakpoint.

Register sets:
- 'general': General purpose registers (rax, rbx, rsp, etc.)
- 'float': Floating point registers
- 'vector': SIMD/vector registers (xmm, ymm)
- 'all': All register sets

Args:
    params: RegistersInput with breakpoint and register selection

Returns:
    str: Register values in hexadecimal format

Inputs: params (required). Returns: result

lldb_runA

Run a program under the debugger with optional breakpoints.

This tool:
1. Loads the executable
2. Sets any specified breakpoints
3. Runs the program (optionally stopping at entry)
4. Returns the state when stopped

Args:
    params: RunProgramInput with executable, args, and breakpoints

Returns:
    str: Program state after stopping (backtrace, variables)

Inputs: params (required). Returns: result

lldb_run_commandA

Execute an arbitrary LLDB command and return the output.

This is a flexible tool for running any LLDB command. Use this when
other specialized tools don't cover your specific need.

Common commands:
- 'help' - Show help for commands
- 'version' - Show LLDB version
- 'settings list' - Show all settings
- 'type summary list' - List type summaries
- 'platform list' - List available platforms

Args:
    params: RunCommandInput containing the command and optional target

Returns:
    str: Command output or error message

Inputs: params (required). Returns: result

lldb_set_breakpointA

Set a breakpoint in a program.

Breakpoints can be set by:
- Function name: 'main', 'MyClass::method'
- File and line: 'main.cpp:42'
- Address: '0x400500'
- Regex: Use 'breakpoint set -r pattern'

Args:
    params: SetBreakpointInput with location and optional condition

Returns:
    str: Confirmation of breakpoint creation with details

Inputs: params (required). Returns: result

lldb_sourceA
Read-onlyIdempotent

List source code for a file, function, or current location.

Can display:
- Source around a specific line
- Source for a named function
- Source at the current debug position

Args:
    params: ListSourceInput specifying what source to show

Returns:
    str: Source code listing with line numbers

Inputs: params (required). Returns: result

lldb_symbolsA
Read-onlyIdempotent

Look up symbols (functions, variables, types) in an executable.

Search types:
- 'name': Exact symbol name lookup
- 'regex': Regular expression pattern matching
- 'address': Find symbol at a specific address
- 'type': Look up a type definition

Args:
    params: SymbolLookupInput with query and search type

Returns:
    str: Symbol information including address and source location

Inputs: params (required). Returns: result

lldb_threadsA
Read-onlyIdempotent

List all threads and their current state.

Shows:
- Thread IDs and names
- Current execution point for each thread
- Stop reason (if stopped)
- Optionally: backtrace for each thread

Args:
    params: ThreadsInput with executable and optional core file

Returns:
    str: Thread listing with state information

Inputs: params (required). Returns: result

lldb_versionA
Read-onlyIdempotent

Get LLDB version information.

Returns:
    str: LLDB version and build information

Inputs: no named parameters. Returns: result

lldb_watchpointA

Set a watchpoint to break when a variable is accessed.

Watch types:
- 'write': Break when value is written (modified)
- 'read': Break when value is read
- 'read_write': Break on any access

Args:
    params: WatchpointInput with variable and access type

Returns:
    str: Confirmation of watchpoint creation

Inputs: params (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting specific debugger operations, such as analyzing crashes, viewing backtraces, disassembling code, evaluating expressions, examining variables, listing images, reading memory, viewing registers, running programs, executing commands, setting breakpoints, showing source, looking up symbols, listing threads, checking version, and setting watchpoints. No tools appear to overlap in functionality, making it easy for an agent to select the correct one.

    Naming Consistency5/5

    All tool names follow a consistent 'lldb_' prefix with a descriptive verb_noun pattern, such as lldb_analyze_crash, lldb_backtrace, lldb_disassemble, etc. This uniformity enhances readability and predictability, allowing agents to easily understand and navigate the toolset without confusion from mixed naming conventions.

    Tool Count5/5

    With 17 tools, the server is well-scoped for a comprehensive debugger interface, covering essential operations like execution control, inspection, and analysis. Each tool serves a specific and necessary function in the debugging workflow, avoiding redundancy while ensuring complete coverage of typical debugging tasks.

    Completeness5/5

    The toolset provides complete coverage of the LLDB debugging domain, including core operations like running programs, setting breakpoints and watchpoints, examining state (variables, registers, memory), analyzing crashes, and accessing symbols and source code. No significant gaps are evident; agents can perform full debugging workflows without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides GDB debugging functionality for use with Claude or other AI assistants, allowing users to manage debugging sessions, set breakpoints, examine variables, and execute GDB commands through natural language.
      16
      111 npm
      161
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      Enables LLM clients to interact with the GNU Debugger (GDB) for comprehensive debugging and binary analysis. It provides a wide range of tools for program execution control, memory examination, stack analysis, and disassembly.
      13
      74
      GPL 3.0
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to start and manage LLDB debugging sessions, including loading programs, setting breakpoints, stepping through code, and examining memory.
      19
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with LLDB debugging sessions through a standardized MCP interface, allowing natural language commands for debugging tasks like setting breakpoints, stepping, and evaluating expressions.
      756
      Apache 2.0