A Model Context Protocol (MCP) server that provides debugging capabilities through the Debug Adapter Protocol (DAP). This server enables AI assistants and other MCP clients to interact with debuggers for various programming languages.
The MCP DAP Server acts as a bridge between MCP clients and DAP-compatible debuggers, allowing programmatic control of debugging sessions. It provides a comprehensive set of debugging tools that can be used to:
- Start and stop debugging sessions
- Set breakpoints (line-based and function-based)
- Control program execution (continue, step in/out/over, pause)
- Inspect program state (threads, stack traces, variables, scopes)
- Evaluate expressions
- Attach to running processes
- Handle exceptions
- Basic demo with multiple prompts
- Autonomous agentic debugging pt.1
- Autonomous agentic debugging pt.2
- Session Management: Start, stop, restart, and terminate debugging sessions
- Breakpoint Management: Set line and function breakpoints
- Execution Control: Continue, pause, step operations (in/out/next)
- State Inspection: View threads, stack traces, scopes, and variables
- Expression Evaluation: Evaluate expressions in the current debugging context
- Variable Modification: Change variable values during debugging
- Process Attachment: Attach to already running processes
- Module Information: List loaded modules
- Source Information: View loaded source files
- Disassembly: View disassembled code
- Exception Handling: Get information about exceptions
- Go 1.24.4 or later
- A DAP-compatible debugger for your target language
git clone https://github.com/go-delve/mcp-dap-server
cd mcp-dap-server
go build -o bin/mcp-dap-server
The server listens on port 8080 by default:
./bin/mcp-dap-server
Configure your MCP client to connect to the server at http://localhost:8080
using the SSE (Server-Sent Events) transport.
This configuration should work (or serve as a starting point) for Agents such as (Gemini CLI)[https://developers.google.com/gemini-code-assist/docs/use-agentic-chat-pair-programmer#configure-mcp-servers].
{
"mcpServers": {
"dap-debugger": {
"command": "mcp-dap-server",
"args": [],
"env": {}
}
}
}
claude mcp add --transport sse mcp-dap-server http://localhost:8080
Starts a new debugging session.
- Parameters:
port
(number): The port number for the DAP server
Stops the current debugging session.
Restarts the current debugging session.
Terminates the debugger and the debuggee process.
Launches a program in debug mode.
- Parameters:
path
(string): Path to the program to debug
Executes a program without debugging.
- Parameters:
path
(string): Path to the program to execute
Attaches to a running process.
- Parameters:
mode
(string): Attachment modeprocessId
(number, optional): Process ID to attach to
Sets line breakpoints in a file.
- Parameters:
file
(string): Source file pathlines
(array): Line numbers for breakpoints
Sets function breakpoints.
- Parameters:
functions
(array): Function names
Continues program execution.
- Parameters:
threadId
(number, optional): Thread ID to continue
Steps over the current line.
- Parameters:
threadId
(number): Thread ID
Steps into function calls.
- Parameters:
threadId
(number): Thread ID
Steps out of the current function.
- Parameters:
threadId
(number): Thread ID
Pauses program execution.
- Parameters:
threadId
(number): Thread ID
Lists all threads in the debugged process.
Gets the stack trace for a thread.
- Parameters:
threadId
(number): Thread IDstartFrame
(number, optional): Starting frame indexlevels
(number, optional): Number of frames to retrieve
Gets variable scopes for a stack frame and automatically fetches all variables within each scope.
- Parameters:
frameId
(number): Stack frame ID
- Returns: A formatted display showing:
- All available scopes (Locals, Arguments, Globals, etc.)
- Variables within each scope with their names, types, and values
- Variable references for compound types that can be further inspected
Gets variables in a scope.
- Parameters:
variablesReference
(number): Variables reference
Evaluates an expression.
- Parameters:
expression
(string): Expression to evaluateframeId
(number, optional): Frame contextcontext
(string, optional): Evaluation context
Sets a variable value.
- Parameters:
variablesReference
(number): Variables referencename
(string): Variable namevalue
(string): New value
Lists all loaded source files.
Lists loaded modules.
Disassembles code at a memory location.
- Parameters:
memoryReference
(string): Memory addressinstructionOffset
(number, optional): Instruction offsetinstructionCount
(number): Number of instructions
Gets exception information.
- Parameters:
threadId
(number): Thread ID
Disconnects from the debugger.
- Parameters:
terminateDebuggee
(boolean, optional): Whether to terminate the debuggee
Signals that configuration is complete.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT
- Built with the Model Context Protocol SDK for Go
- Uses the Google DAP implementation for Go