11# Model Context Protocol (MCP)
22
3- LLDB supports for the [ Model Context Protocol] [ 1 ] (MCP). This structured,
4- machine-friendly protocol allows AI models to access and interact with external
5- tools, such as the debugger. Using MCP, an AI agent can execute LLDB commands
6- to control the debugger: set breakpoints, inspect memory, step through code.
7- This can range from helping you run a specific command you can't immediately
8- remember to a fully agent-driven debugging experiences
3+ LLDB supports the [ Model Context Protocol] [ https://modelcontextprotocol.io ]
4+ (MCP). This structured, machine-friendly protocol allows AI models to access
5+ and interact with external tools, for example debuggers. Using MCP, an AI agent
6+ can execute LLDB commands to control the debugger: set breakpoints, inspect
7+ memory, step through code. This can range from helping you run a specific
8+ command you cannot immediately remember, to a fully agent-driven debugging
9+ experience.
910
1011## MCP Server
1112
@@ -26,6 +27,9 @@ explicitly with the `protocol-server stop` command.
2627(lldb) protocol-server stop MCP
2728```
2829
30+ The commands will fail if a server is already running or not running
31+ respectively.
32+
2933## MCP Client
3034
3135MCP uses standard input/output (stdio) for communication between client and
@@ -34,7 +38,15 @@ allow you to specify an MCP server as a binary and arguments. This means that
3438you need to use something like ` netcat ` to connect to LLDB's MCP server and
3539forward communication over stdio over the network connection.
3640
37- Configuration example for [ Claude Code] [ 2 ] :
41+ ```
42+ ┌──────────┐ ┌──────────┐ ┌──────────┐
43+ │ │ │ │ │ │
44+ │ LLDB ├─────socket────┤ netcat ├─────stdio─────┤MCP Client│
45+ │ │ │ │ │ │
46+ └──────────┘ └──────────┘ └──────────┘
47+ ```
48+
49+ Configuration example for [ Claude Code] [ https://modelcontextprotocol.io/quickstart/user ] :
3850
3951```
4052{
@@ -47,7 +59,7 @@ Configuration example for [Claude Code][2]:
4759}
4860```
4961
50- Configuration example for [ Visual Studio Code] [ 3 ] :
62+ Configuration example for [ Visual Studio Code] [ https://code.visualstudio.com/docs/copilot/chat/mcp-servers ] :
5163
5264```
5365{
@@ -63,6 +75,11 @@ Configuration example for [Visual Studio Code][3]:
6375}
6476```
6577
66- [ 1 ] : https://modelcontextprotocol.io
67- [ 2 ] : https://modelcontextprotocol.io/quickstart/user
68- [ 3 ] : https://code.visualstudio.com/docs/copilot/chat/mcp-servers
78+ ### Troubleshooting
79+
80+ The MCP server uses the ` Host ` log channel. You can enable logging with the
81+ ` log enable ` command.
82+
83+ ```
84+ (lldb) log enable lldb host
85+ ```
0 commit comments