Go Delve Debugger MCP Server
xhd2015/dlv-mcp · 21 stars · Go · MIT
MCP server MCP Server that exposes Golang's Delve Debugger, enable AI to self-debug
Install
The repo has no one-line install. Follow its README.
Files
Go Delve Debugger MCP Server
An MCP server that allows LLMs to interact with the Delve Go debugger.
Description
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.
Features
- Start debug sessions for Go programs
- Set breakpoints in code
- Step through code (next, step in, step out)
- Evaluate expressions in the context of a debug session
- Inspect variables and stack traces
- Manage multiple debug sessions
Installation
Prerequisites
- Go 1.21 or higher
- Delve debugger installed (
go install github.com/go-delve/delve/cmd/dlv@latest)
Install
go install github.com/xhd2015/dlv-mcp/cmd/dlv-mcp@latest
Usage
Start the MCP server:
dlv-mcp --listen :9097
Then configure MCP Server at http://localhost:9097/sse, in Cursor or any MCP client.
Inspect the MCP Server
bunx @modelcontextprotocol/inspector dlv-mcp
Available Tools
Debug Session Management
-
start_debug: Start a new debug sessionprogram: Path to Go program to debugargs: Command line arguments for the program (optional)mode: Debug mode (debug,test, orexec, default:debug)
-
terminate_debug: Terminate a debug sessionsession_id: ID of the debug session to terminate
-
list_debug_sessions: List active debug sessions
Breakpoint Management
set_breakpoint: Set a breakpoint in a debug sessionsession_id: ID of the debug sessionfile: Source file to set breakpoint in (absolute path)line: Line number to set breakpoint at
Execution Control
-
continue: Continue execution in a debug sessionsession_id: ID of the debug session
-
next: Step over current line in a debug sessionsession_id: ID of the debug session
-
step_in: Step into function in a debug sessionsession_id: ID of the debug session
-
step_out: Step out of function in a debug sessionsession_id: ID of the debug session
Inspection
evaluate: Evaluate an expression in a debug sessionsession_id: ID of the debug sessionexpression: Expression to evaluateframe_id: Stack frame ID (optional, default: 0)
Example Workflow
-
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
Architecture
The server is built using the following components:
- MCP Server Layer: Implements the Model Context Protocol using mark3labs/mcp-go
- DAP Client Layer: Communicates with Delve's DAP server
- Session Management: Maintains and manages debug sessions
Inspect The MCP Server
bunx @modelcontextprotocol/inspector go run ./cmd/dlv-mcp
Using the Demo Client
We've created a demo client that shows how to use the debugger-mcp server programmatically. The demo:
- Starts the MCP server
- Launches a debug session for
./testdata/hello.go - Tries to set a breakpoint and execute debugging commands
- Properly terminates the session and server
To run the demo:
go run ./demo/main.go
The demo client showcases how to:
- Start and communicate with the MCP server using JSON-RPC
- Send tool calls using the correct format
- Parse and handle responses
- Deal with errors gracefully
Check out demo/main.go and demo/README.md for more details on the implementation.
License
MIT License
Facts
- Kind
- MCP server
- Repo
- xhd2015/dlv-mcp
- Group
- Uncategorized
- Stars
- 21
- License
- MIT
- Language
- Go
- Last push
- 2025-03-10
- Forks
- 5
- 1REAio.github.morluto/reaReverse engineer anything from your terminal or agent with one CLI and MCP server.125.3k
- 2com.browser-use/browser-usecom.browser-use/browser-useControl a real Chrome browser to complete any task: fill forms, extract data, book flights.117.7k
- 3World Monitorapp.worldmonitor/mcpLive markets, conflicts, country risk, chokepoints, energy, and China decision signals. 93 tools.88.3k
- 4Scrapling MCP Serverd4vinci/scrapling🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scraplingdev86.9k
- 5Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 6Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k