Go Debugger (Delve) MCP server

Provides a bridge to the Delve debugger for Go applications, enabling runtime debugging capabilities including breakpoints, stepping through code, variable inspection, and stack trace examination.
Back to servers
Setup instructions
Provider
Felix Sun
Release date
Mar 23, 2025
Language
Go
Stats
4 stars

MCP Go Debugger is an interface that allows you to debug Go programs using the Model Context Protocol (MCP). It provides seamless integration between MCP-compatible AI assistants and the Delve debugger, enabling interactive debugging sessions with features like setting breakpoints, stepping through code, and inspecting variables.

Installation

Prerequisites

  • Go 1.20 or higher

Using Go

The easiest way to install the MCP Go Debugger is with Go:

go install github.com/sunfmin/mcp-go-debugger/cmd/mcp-go-debugger@latest

This will download, compile, and install the binary to your $GOPATH/bin directory.

From Source

Alternatively, you can build from source:

git clone https://github.com/sunfmin/mcp-go-debugger.git
cd mcp-go-debugger
make install

Configuration

Cursor

Add the following to your Cursor configuration (~/.cursor/mcp.json):

{
  "mcpServers": {
    "go-debugger": {
      "command": "mcp-go-debugger",
      "args": []
    }
  }
}

Claude Desktop

Add the MCP to Claude Desktop:

claude mcp add go-debugger mcp-go-debugger

Verify the connection:

/mcp

Usage

This debugger integrates with MCP-compatible clients and provides the following tools:

  • ping - Test connection to the debugger
  • status - Check debugger status and server uptime
  • launch - Launch a Go program with debugging
  • attach - Attach to a running Go process
  • debug - Debug a Go source file directly
  • debug_test - Debug a specific Go test function
  • set_breakpoint - Set a breakpoint at a specific file and line
  • list_breakpoints - List all current breakpoints
  • remove_breakpoint - Remove a breakpoint
  • continue - Continue execution until next breakpoint or program end
  • step - Step into the next function call
  • step_over - Step over the next function call
  • step_out - Step out of the current function
  • eval_variable - Eval a variable's value with configurable depth
  • list_scope_variables - List all variables in current scope
  • get_execution_position - Get current execution position
  • get_debugger_output - Retrieve captured program output
  • close - Close the current debugging session

Basic Usage Examples

Debugging a Go Program

Ask the AI assistant to debug your Go program:

Please debug my Go application main.go

The AI assistant will use the MCP to:

  • Launch the program with debugging enabled
  • Set breakpoints as needed
  • Eval variables and program state
  • Help diagnose issues

Attaching to a Running Process

If your Go application is already running, you can attach the debugger:

Attach to my Go application running with PID 12345

Finding a Bug Example

I'm getting a panic in my processOrders function when handling large orders. Can you help me debug it?

The AI will help you:

  • Set breakpoints in the relevant function
  • Eval variables as execution proceeds
  • Identify the root cause of the issue

Debugging a Single Test

If you want to debug a specific test function:

Please debug the TestCalculateTotal function in my calculator_test.go file

The AI assistant will use the debug_test tool to:

  • Launch only the specific test with debugging enabled
  • Set breakpoints at key points in the test
  • Help you inspect variables as the test executes
  • Step through the test execution to identify issues

You can also specify test flags:

Debug the TestUserAuthentication test in auth_test.go with a timeout of 30 seconds

Inspecting Complex Data Structures

When working with nested structures or complex types:

Can you eval the user.Profile.Preferences object at line 45? I need to see all nested fields in detail.

The AI will:

  • Set a breakpoint at the specified location
  • Use the eval_variable tool with appropriate depth parameters
  • Format the structure for easier understanding
  • Help navigate through nested fields

Debugging with Command Line Arguments

To debug a program that requires command-line arguments:

Debug my data_processor.go with the arguments "--input=data.json --verbose --max-records=1000"

Working with Goroutines

For debugging concurrent Go programs:

I think I have a race condition in my worker pool implementation. Can you help me debug it?

The AI can:

  • Set strategic breakpoints around goroutine creation and synchronization points
  • Help eval channel states and mutex locks
  • Track goroutine execution to identify race conditions
  • Suggest solutions for concurrency issues

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "go-debugger" '{"command":"mcp-go-debugger","args":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "go-debugger": {
            "command": "mcp-go-debugger",
            "args": []
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "go-debugger": {
            "command": "mcp-go-debugger",
            "args": []
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later