Delve MCP

MIT License
1
  • Linux
  • Apple

Integrations

  • Supported platform for running the Delve MCP server with specific configuration paths.

  • Supported platform for running the Delve MCP server with specific configuration paths.

  • Provides integration with Mozilla's rr tool for replay debugging of Go programs, allowing historical execution tracing and analysis.

delve-mcp

用于 Delve 调试器集成的 MCP 服务器

这是一个基于 TypeScript 的 MCP 服务器,为 Go 程序的 Delve 调试器提供了完整的接口。它通过 MCP 工具实现了所有主要的 Delve 命令和功能。

特征

资源

  • 通过delve:// URI 列出并访问调试会话
  • 每个会话都有关于其类型、目标和端口的元数据
  • 会话详细信息和状态的 JSON 表示

工具

使用以下工具调试、跟踪和分析 Go 程序:

  • 调试命令( debugattachexectest
  • 核心转储分析
  • 程序跟踪
  • 使用rr重放调试
  • DAP 服务器支持
  • 带条件的断点管理
  • 执行控制( continuestepnext
  • 变量检验与评估
  • 后端选择( nativelldbrr
  • 日志配置
  • 会话管理

环境设置

服务器要求:

  • 使用 Delve 安装 Go( go install github.com/go-delve/delve/cmd/dlv@latest
  • 对于重放功能:Mozilla rrhttps://github.com/mozilla/rr
  • Node.js 和 npm

安装

要安装 Delve MCP 服务器:

npm install @dwisiswant0/delve-mcp

发展

安装依赖项:

npm install

构建服务器:

npm run build

对于使用自动重建的开发:

npm run watch

配置

要与 Claude Desktop 一起使用,请添加服务器配置:

  • 在 Linux 上: ~/.config/Claude/claude_desktop_config.json
  • 在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
{ "mcpServers": { "delve-mcp": { "command": "/path/to/delve-mcp/build/index.js" } } }

可用工具

调试命令

  • debug - 调试当前目录或指定包中的 Go 包
  • attach -通过 PID 附加到正在运行的进程
  • **exec**执行并调试预编译的二进制文件
  • test -在当前包或指定包中调试测试
  • core - 检查与可执行文件相关的核心转储文件
  • dap - 启动调试适配器协议(DAP)服务器
  • replay - 重放 rr 跟踪记录
  • trace - 使用函数匹配来跟踪程序执行

控制命令

  • setBreakpoint - 设置带有可选条件的断点
  • **removeBreakpoint**删除现有断点
  • **continue**继续程序执行
  • **next**跳到下一行
  • **step**单步执行函数调用
  • **stepout**跳出当前函数
  • variables - 列出当前范围内的局部变量
  • evaluate -评估当前范围内的表达式

配置命令

  • version - 获取 Delve 版本信息
  • setBackend - 配置调试后端( nativelldbrr
  • configureLogging - 配置调试日志组件

使用示例

启动调试会话

// Debug current package { name: "debug" } // Debug with specific package and build flags { name: "debug", arguments: { package: "./cmd/myapp", buildFlags: "-tags=integration" } }

管理断点

// Set a breakpoint { name: "setBreakpoint", arguments: { sessionId: "abc123", file: "main.go", line: 42, condition: "count > 5" } }

检查状态

// List variables { name: "variables", arguments: { sessionId: "abc123" } } // Evaluate expression { name: "evaluate", arguments: { sessionId: "abc123", expr: "myVar.Field" } }

执照

麻省理工学院。

-
security - not tested
A
license - permissive license
-
quality - not tested

基于 TypeScript 的 MCP 服务器为 Go 程序的 Delve 调试器提供完整的接口,支持通过自然语言命令调试、跟踪和分析 Go 代码。

  1. Features
    1. Resources
    2. Tools
    3. Environment Setup
  2. Installation
    1. Development
      1. Configuration
    2. Available Tools
      1. Debug Commands
      2. Control Commands
      3. Configuration Commands
    3. Usage Examples
      1. Starting a Debug Session
      2. Managing Breakpoints
      3. Inspecting State
    4. License
      ID: x7yii528ii