Skip to main content
Glama

debug-dap-mcp

DAP (Debug Adapter Protocol) stdio MCP server——通过一个 debug 工具把调试能力暴露给任意 MCP 客户端(Claude Code / OpenCode 等)。适配器进程由 server 派生,按内置/用户级/项目级三层配置解析。

  • 单工具 debug,30 个 action(launch/attach/continue/evaluate/…),参数 camelCase

  • 每次返回统一 JSON 载荷(structuredContentcontent[0].text 同源)

  • 自带 14 条内置适配器记录(gdb / lldb-dap / codelldb / debugpy / dlv / js-debug-adapter / netcoredbg / kotlin-debug-adapter / rdbg / php-debug-adapter / bash-debug-adapter / dart-debug-adapter / flutter-debug-adapter / elixir-ls-debugger)

项目来源:具体实现源自 oh-my-pi(Pi 内置调试工具),本项目将其改造为独立的 MCP server 实现。

安装

需要 Node.js ≥ 22。

npx -y @flydut/debug-dap-mcp                             # 临时运行
npm i -g @flydut/debug-dap-mcp                           # 全局安装

启动后即一个 stdio MCP server;通常由 MCP 客户端作为子进程拉起,无需手动运行。

Related MCP server: Debug-MCP

MCP 客户端配置

Claude Code(.mcp.json 或项目配置)

{
  "mcpServers": {
    "debug-dap-mcp": {
      "command": "npx",
      "args": ["-y", "@flydut/debug-dap-mcp"]
    }
  }
}

全局安装后,command 可直接写 debug-dap-mcp 并清空 args

OpenCode(opencode.json

{
  "mcp": {
    "debug-dap-mcp": {
      "type": "local",
      "command": ["npx", "-y", "@flydut/debug-dap-mcp"],
      "enabled": true
    }
  }
}

全局安装后,command 可简写为 ["debug-dap-mcp"]

需要自定义 CLI 参数(如 --no-project-config)时并入 args/command 数组即可,见下文配置节。

31 action 速查表

一次 callTool 只执行一个 action(snake_case),参数 camelCase。公共参数:sessionId(缺省 = 焦点会话)、timeout(毫秒,clamp 到 [5000, 300000],缺省 30000)。所有返回统一 JSON 载荷(snapshot 或查询族结构)。

分组

action

关键参数

会话

launch

program, adapter?, cwd?, args?, dapArguments?

会话

attach

pid/port 二选一(E-U3), host?, adapter?, dapArguments?

会话

terminate

—(整树终止;无会话幂等 snapshot:null

会话

sessions

—(整树快照 + focusedSessionId

断点

set_breakpoint / remove_breakpoint

file, line, condition?, hitCondition?

断点

set_function_breakpoint / remove_function_breakpoint

name, condition?, hitCondition?

断点

set_instruction_breakpoint / remove_instruction_breakpoint

instructionReference, offset?, condition?

断点

data_breakpoint_info

name/variablesReference 至少给一(E-U3)

断点

set_data_breakpoint / remove_data_breakpoint

dataId, accessType?(`read

流控

continue / pause / step_over / step_in / step_out

threadId?

检查

stack_trace

threadId?, levels?

检查

threads

—(整树聚合)

检查

scopes

frameId?

检查

variables

variablesReference, start?, count?

检查

evaluate

expression, frameId?, context?

检查

exception_info

threadId?(缺省回落当前 stop;无 stop 报 usage)

检查

output

tail?(字节,尾部截取)

底层

disassemble

memoryReference, instructionCount?, instructionOffset?, offset?, resolveSymbols?

底层

read_memory

memoryReference, count?, offset?

底层

write_memory

memoryReference, data(base64), offset?

底层

modules

startModule?, moduleCount?

底层

loaded_sources

底层

custom_request

command, arguments?(逃生舱,透传任意 DAP 命令)

错误统一 isError:true + JSON 错误体:{ error:true, code, message, details? }code ∈ { usage, capability, adapter, protocol }

attach 指南

attach 请求体合成序(后者逐键覆盖):适配器 attachDefaults ⊕ 结构化参数(pid 按记录 pidArgument 映射字段名;spawn 型的 port/host)⊕ dapArguments。各适配器对字段名的差异全部是配置数据,server 无特殊分支。

pid 注入(需要适配器声明相应能力;dapArguments 补齐适配器私有必填字段):

// gdb(内置记录够用)
{"action":"attach","pid":12345}
// dlv(pidArgument: processId 已内置;显式写法等价)
{"action":"attach","pid":12345,"adapter":"dlv"}
// debugpy 1.8+(其请求体字段名为 processId、debugpyArgs 必填,均经 dapArguments 透传;
// 也可在用户级配置给 debugpy 记录加 "pidArgument": "processId" 省去前者)
{"action":"attach","pid":12345,"adapter":"debugpy",
 "dapArguments":{"processId":12345,"debugpyArgs":["--listen","127.0.0.1:0"]}}

连接既有 DAP server(用户级配置给适配器加 "attachConnection": "connect",如 dlv 的 dlv dap --listen=:5678 或 js-debug 独立 dapDebugServer):此时 attach{port}port 即该 DAP 端点,MCP 不派生进程、直接连接后发 attach 请求体。

debugpy 注意事项python -m debugpy --listen 5678 app.py 中的 5678 是 pydevd 引擎端口,不是 DAP 端口——对它 attach{port} 不会工作(这是 debugpy 官方拓扑,非本 server 缺陷)。推荐路径是上方 pid 注入;python -m debugpy.adapter --port N 的独立 server 模式在 debugpy 1.8 存在 access-token 认证限制,第三方客户端不可直接复用。Linux 下 pid 注入还需目标进程可被 ptrace(sysctl kernel.yama.ptrace_scope=0 或同 uid 父子关系),Python 3.11+ 的 frozen modules 可能干扰注入(目标以 -X frozen_modules=off 启动更稳)。

透传即语义:断点 verified 标记、variablesstart/count 分页效果均忠实透传各适配器行为(如 debugpy 对未解析位置的断点报 verified:true);Windows 符号链接下 source.path 为适配器返回的真实路径。会话 terminated 后进入保留期(默认 5 min,settings.terminatedRetentionMs 可调),期间快照与 output/exitCode 仍可读且不阻塞新 launch

配置三层

三层配置按 内置 < 用户级 < 项目级 合并;settingsadapters 深合并,数组字段整体替换(如 argsfileTypes 被上层完全替换而非拼接):

位置

内置

随包分发 adapters/defaults.json(14 条记录)

用户级

${XDG_CONFIG_HOME:-~/.config}/debug-dap-mcp/config.json--config <path> 可替换路径)

项目级

<cwd>/.debug-dap-mcp.json

用户级示例(~/.config/debug-dap-mcp/config.json):

{
  // 顶层 settings 覆盖
  "settings": { "binaryPreference": ["dlv"] },
  // 顶层 adapters 新增/覆盖记录(command/args/fileTypes/launchDefaults…)
  "adapters": {
    "my-gdb": {
      "command": "gdb",
      "args": ["-i", "dap"],
      "fileTypes": [".c", ".cpp"],
      "launchDefaults": { "request": "launch" }
    }
  }
}

配置文件用 JSON 或 JSONC(注释)皆可。

安全警示(--no-project-config

项目级 .debug-dap-mcp.json 是「信任仓库即信任配置」:恶意仓库可把适配器 command 指向任意二进制,由 server 作为子进程执行。在不可信仓库中务必以 --no-project-config 启动(禁用项目级配置)。--log-level debug 会在 stderr 记录每次解析出的最终命令行,便于审计。

日志与排障

诊断全部写 stderr(stdout 只承载 MCP 帧)。级别解析:--log-level <debug|info|warn|error> 优先 → 否则 DEBUG_DAP_MCP_LOG → 否则 info

npx -y @flydut/debug-dap-mcp --log-level debug   # 帧收发摘要 + 适配器最终命令行
DEBUG_DAP_MCP_LOG=debug npx -y @flydut/debug-dap-mcp    # 环境变量等价物

常见错误(isError:truecode):

  • usage — 参数校验失败 / 未知 action / 适配器选择失败(消息含候选与各自未中原因)/ pid-portname-variablesReference 二选一违例 / 无活动会话

  • capability — 适配器 capabilities 不支持该 action(如 supportsModulesRequest 缺席)

  • adapter — 适配器启动失败(含 stderr 摘录与 installHint)或中途崩溃(含会话 id、退出码、stderr 摘录)

  • protocol — DAP error response 或单请求超时

开发

npm run build       # tsc 编译到 dist/
npm run typecheck   # src + test 类型检查
npm test            # vitest 全套件(core + mcp + CLI + e2e)

Available Tools

1 tool
debugB

DAP (Debug Adapter Protocol) control surface. Pass one of 31 actions plus their camelCase parameters; returns a JSON payload (structuredContent mirrors it). Sessions are launched via launch/attach and targeted by sessionId (default: focused session).

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdNo
pidNo
argsNo
dataNo
fileNo
hostNo
lineNo
nameNo
portNo
tailNo
countNo
startNo
actionYes
dataIdNo
levelsNo
offsetNo
adapterNo
commandNo
contextNo
frameIdNo
programNo
timeoutNo
threadIdNo
argumentsNo
conditionNo
sessionIdNo
accessTypeNo
expressionNo
moduleCountNo
startModuleNo
dapArgumentsNo
hitConditionNo
resolveSymbolsNo
memoryReferenceNo
instructionCountNo
instructionOffsetNo
variablesReferenceNo
instructionReferenceNo

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It does disclose that the tool returns a JSON payload mirrored as structuredContent and explains session targeting defaults. However, it does not mention side effects (e.g., process launch, memory writes, mutation) or failure/error behavior for such a powerful, stateful DAP surface.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences: the first establishes the core protocol and invocation model, the second covers return behavior, and the third explains session lifecycle and targeting. Every sentence earns its place, and the most important information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the high complexity (38 parameters, 31 actions, no output schema, no annotations), the description is too sparse to be complete. It provides a useful high-level orientation but omits action-to-parameter mappings, required DAP adapter configuration, and return payload details. An agent would need substantial external DAP knowledge to invoke this correctly across actions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 38 parameters, and the description barely compensates. It states that actions take 'their camelCase parameters' and calls out sessionId's default, but does not map actions to their required or relevant parameters. For a tool with this many parameters, an agent has almost no semantic guidance beyond raw parameter names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool as a DAP control surface and explains that calls consist of an action plus its parameters, which distinguishes it from generic debugger operations. It is specific about the protocol (DAP) and the action-driven invocation model. It stops short of a 5 because there are no siblings to differentiate against, so the comparative clarity can't earn full credit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides useful usage context: sessions are started via launch/attach and are targeted by sessionId, defaulting to the focused session. This gives an agent actionable guidance on how to invoke it. There are no explicit when-not or alternative-tool statements, but with no sibling tools that is less critical.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.1.0
    • First observeddebug

TDQS

A3.7/5.0
Disambiguation5/5

There is only one tool, so no ambiguity exists between tools. The 31 DAP actions are internal parameters, not separate tools.

Naming Consistency5/5

The single tool name `debug` is concise and matches the server's purpose. With only one tool, there is no conflicting naming pattern.

Tool Count2/5

The entire DAP protocol is packed into one mult-i purpose dispatch tool, which feels too few for the apparent scope. A single optool acts as a god-parameter surface rather than a discoverable set.

Completeness5/5

The 31 actions likely cover the core DAP request lifecycle (launch, attach, breakpoints, stepping, evaluation, etc.), enabling complete debugging workflows. As a single control surface, there are no obvious dead ends.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables step-through debugging for C#, Node.js/TypeScript, Python, and Dart applications on Windows through a unified MCP interface. Acts as a bridge between MCP clients and various debug adapters, providing consistent debugging workflows with breakpoints, variable inspection, and process attachment capabilities.
    8
    ISC
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to perform interactive Python debugging with breakpoints, step execution, and variable inspection using the Debug Adapter Protocol (DAP) through an MCP server interface.
    8
    1
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that provides a real debugger via the Debug Adapter Protocol, exposing a single 'debug' tool to launch/attach, control execution, and inspect program state across gdb, lldb, debugpy, and more.
    -
  • A
    license
    A
    quality
    A
    maintenance
    Enables coding agents to connect to Debug Adapter Protocol debuggers over MCP, allowing them to launch or attach to native targets, control execution, set breakpoints and watchpoints, inspect stacks, variables, memory, and exceptions, and capture agent-friendly debugger snapshots.
    14
    1,322
    2
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/FlyDut/debug-dap-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server