Go Delve Debugger
HTTP-SSEMCP server enabling AI assistants to debug Go applications using Delve debugger
MCP server enabling AI assistants to debug Go applications using Delve debugger
An MCP server that allows LLMs to interact with the Delve Go debugger.
This project implements a Model Context Protocol (MCP) server that integrates with the Delve Go debugger to enable AI assistants to debug Go applications. The server exposes a set of tools that allow LLMs to start, control, and interact with debug sessions.
You can find a working example at EXAMPLE.md.
go install github.com/go-delve/delve/cmd/dlv@latest)go install github.com/xhd2015/dlv-mcp/cmd/dlv-mcp@latest
Start the MCP server:
dlv-mcp --listen :9097
Then configure MCP Server at http://localhost:9097/sse, in Cursor or any MCP client.
bunx @modelcontextprotocol/inspector dlv-mcp
start_debug: Start a new debug session
program: Path to Go program to debugargs: Command line arguments for the program (optional)mode: Debug mode (debug, test, or exec, default: debug)terminate_debug: Terminate a debug session
session_id: ID of the debug session to terminatelist_debug_sessions: List active debug sessions
set_breakpoint: Set a breakpoint in a debug session
session_id: ID of the debug sessionfile: Source file to set breakpoint in (absolute path)line: Line number to set breakpoint atcontinue: Continue execution in a debug session
session_id: ID of the debug sessionnext: Step over current line in a debug session
session_id: ID of the debug sessionstep_in: Step into function in a debug session
session_id: ID of the debug sessionstep_out: Step out of function in a debug session
session_id: ID of the debug sessionevaluate: Evaluate an expression in a debug session
session_id: ID of the debug sessionexpression: Expression to evaluateframe_id: Stack frame ID (optional, default: 0)Start a debug session:
start_debug program=/path/to/program.go
Set a breakpoint:
set_breakpoint session_id=session-123456 file=/path/to/program.go line=15
Continue to breakpoint:
continue session_id=session-123456
Evaluate an expression:
evaluate session_id=session-123456 expression="myVariable"
Step over a line:
next session_id=session-123456
Terminate the session:
terminate_debug session_id=session-123456
The server is built using the following components:
bunx @modelcontextprotocol/inspector go run ./cmd/dlv-mcp
We've created a demo client that shows how to use the debugger-mcp server programmatically. The demo:
./testdata/hello.goTo run the demo:
go run ./demo/main.go
The demo client showcases how to:
Check out demo/main.go and demo/README.md for more details on the implementation.
MIT License