LLDB-MCP is a tool that integrates the LLDB debugger with Claude's Model Context Protocol (MCP). Through this integration, Claude can directly start, control, and interact with LLDB debugging sessions, thereby supporting AI-assisted debugging workflows.
Purpose
LLDB-MCP is designed to enable AI assistants (such as Claude) to operate the LLDB debugger through natural language, for binary and core file analysis, debugging, and disassembly. It is suitable for scenarios that require AI-assisted program debugging, crash analysis, memory inspection, and more.
Main Capabilities
This tool provides a comprehensive set of commands, covering the following aspects:
- Start and manage LLDB sessions
- Load programs for debugging
- Set breakpoints and watchpoints
- Control program execution
- Inspect memory, registers, and variables
- Analyze stack traces and program state
- Create and manage multiple LLDB debugging sessions
- Load executables and attach to running processes
- Load core dump files for post-mortem analysis
- Execute arbitrary LLDB commands
- Fine-grained control over program execution
- Memory inspection and disassembly
- Thread and stack frame inspection
Usage
- Clone the repository:
git clone https://github.com/stass/lldb-mcp.git cd lldb-mcp - Install dependencies:
pip install mcp - Configure Claude to use the LLDB-MCP server:
- Open the Claude desktop application configuration
- Add the following to the MCP configuration:
"mcpServers" : { "lldb-mcp" : { "command" : "python3", "args" : ["/path/to/lldb-mcp/lldb_mcp.py"], "disabled" : false } }
- After installation and configuration are complete, you can interact with LLDB through Claude using natural language.
Example Commands
The following are examples of interacting with LLDB-MCP through Claude:
- "Start a new LLDB session"
- "Load the program '/path/to/executable'"
- "Set a breakpoint at main"
- "Run the program"
- "Show backtrace"
- "Print the value of variable 'count'"
- "Step over the next line"
- "Examine memory at address 0x1000"
- "Show register values"
- "Continue execution"
- "Kill the process"
- "Terminate the LLDB session"
Supported Commands
Session Management
lldb_start: Start a new LLDB sessionlldb_terminate: Terminate an LLDB sessionlldb_list_sessions: List all active LLDB sessions
Program Loading
lldb_load: Load a program into LLDBlldb_attach: Attach to a running processlldb_load_core: Load a core dump file
Execution Control
lldb_run: Run the loaded programlldb_continue: Continue program executionlldb_step: Step to the next line or instructionlldb_next: Step over function callslldb_finish: Execute until the current function returnslldb_kill: Terminate the running process
Breakpoints and Watchpoints
lldb_set_breakpoint: Set a breakpointlldb_breakpoint_list: List all breakpointslldb_breakpoint_delete: Delete a breakpointlldb_watchpoint: Set a watchpoint on a variable or memory addresslldb_backtrace: Show the call stacklldb_print: Print the value of an expressionlldb_examine: Examine memorylldb_info_registers: Show registerslldb_frame_info: Get detailed information about a stack framelldb_disassemble: Disassemble codelldb_process_info: Get information about the current process
Thread Management
lldb_thread_list: List all threads in the current processlldb_thread_select: Select a specific threadlldb_command: Execute an arbitrary LLDB commandlldb_expression: Evaluate an expression in the current framelldb_help: Get help for LLDB commands
Example program
example/overflow.c contains an example C program that causes a buffer overflow with specific arguments. Use cc overflow.c to compile it, and have Claude debug the issue using the resulting program.
Usage tips
- When you need to execute an LLDB command that has no dedicated function, use
lldb_command. - Use the
--debugflag when starting the server to enable debug mode for detailed logs. - Sessions are automatically cleaned up when the server shuts down.
- Each session has a unique ID—make sure to use the correct ID when executing commands.
Requirements
- LLDB is installed on the system
- Claude desktop application with MCP support
Troubleshooting
- If LLDB commands time out, check whether LLDB is installed correctly.
- Verify the LLDB path when starting a new session.
- Check for permission issues when attaching to a process.
- If commands are not executed correctly, check the debug logs.