SM

sunfmin/mcp-go-debugger

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 4 forks 质量 59 趋势 18MIT

A debugger interface for Go programs that integrates with MCP (Model Context Protocol).

概览

A debugger interface for Go programs that integrates with MCP (Model Context Protocol). - Launch and debug Go applications - Attach to existing Go processes - Set breakpoints - Step through code (step into, step over, step out) - Eval variables - View stack traces - List all variables in current scope - Get current execution position - Debug individual test functions with debug_test - Native integration with Delve debugger API types - Capture and display program output during debugging - Support for custom test flags when debugging tests - Detailed variable inspection with configurable depth The easiest way to install the MCP Go Debugger is with Go: This will download, compile, and install the binary to your $GOPATH/bin directory. Alternatively, you can build from source: Add the following to your Cursor configuration (~/.cursor/mcp.json): This debugger is designed to be integrated with MCP-compatible clients.

README

以下为原文 README 节选,完整内容请查看原文。

MCP Go Debugger

A debugger interface for Go programs that integrates with MCP (Model Context Protocol).

Features

  • Launch and debug Go applications
  • Attach to existing Go processes
  • Set breakpoints
  • Step through code (step into, step over, step out)
  • Eval variables
  • View stack traces
  • List all variables in current scope
  • Get current execution position
  • Debug individual test functions with debug_test
  • Native integration with Delve debugger API types
  • Capture and display program output during debugging
  • Support for custom test flags when debugging tests
  • Detailed variable inspection with configurable depth

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 is designed to be integrated with MCP-compatible clients. The tools provided include:

  • 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 (local, args, package)
  • get_execution_position - Get current execution position (file, line, function)
  • get_debugger_output - Retrieve captured stdout and stderr from the debugged program
  • 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

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

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