Cover image
Try Now
2025-03-10

揭露Golang的Delve Debugger的MCP服务器,使AI启用自我挑战

3 years

Works with Finder

1

Github Watches

1

Github Forks

6

Github Stars

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 session

    • program: Path to Go program to debug
    • args: 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 terminate
  • list_debug_sessions: List active debug sessions

Breakpoint Management

  • set_breakpoint: Set a breakpoint in a debug session
    • session_id: ID of the debug session
    • file: Source file to set breakpoint in (absolute path)
    • line: Line number to set breakpoint at

Execution Control

  • continue: Continue execution in a debug session

    • session_id: ID of the debug session
  • next: Step over current line in a debug session

    • session_id: ID of the debug session
  • step_in: Step into function in a debug session

    • session_id: ID of the debug session
  • step_out: Step out of function in a debug session

    • session_id: ID of the debug session

Inspection

  • evaluate: Evaluate an expression in a debug session
    • session_id: ID of the debug session
    • expression: Expression to evaluate
    • frame_id: Stack frame ID (optional, default: 0)

Example Workflow

  1. Start a debug session:

    start_debug program=/path/to/program.go
    
  2. Set a breakpoint:

    set_breakpoint session_id=session-123456 file=/path/to/program.go line=15
    
  3. Continue to breakpoint:

    continue session_id=session-123456
    
  4. Evaluate an expression:

    evaluate session_id=session-123456 expression="myVariable"
    
  5. Step over a line:

    next session_id=session-123456
    
  6. 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:

  1. Starts the MCP server
  2. Launches a debug session for ./testdata/hello.go
  3. Tries to set a breakpoint and execute debugging commands
  4. 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

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • Khalid kalib
  • Write professional emails

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • ANGEL LEON
  • A world class elite tech co-founder entrepreneur, expert in software development, entrepreneurship, marketing, coaching style leadership and aligned with ambition for excellence, global market penetration and worldy perspectives.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

    Reviews

    4 (1)
    Avatar
    user_o6476Zqe
    2025-04-15

    Email MCP by gaddobenedetti is a game-changer for email management! It's intuitive, efficient, and integrates seamlessly with my workflow. The interface is clean and user-friendly, making it easy to organize and prioritize emails. Highly recommended for anyone looking to enhance their email productivity! Check it out at https://mcp.so/server/mcp_email/gaddobenedetti.