Skip to main content
Glama

dap-mcp-server

An MCP (Model Context Protocol) server that wraps the Debug Adapter Protocol (DAP), enabling AI agents to use real debuggers instead of relying on print statements and log analysis.

What This Is

When AI coding agents encounter bugs, they typically resort to adding console.log statements or reading stack traces. This MCP server gives them access to actual debuggers — setting breakpoints, stepping through code, inspecting variables, and evaluating expressions — through any debug adapter that implements DAP.

The server spawns debug adapters as child processes and exposes a small set of coarse-grained MCP tools optimized for how an AI agent thinks about debugging: "launch this program, stop here, show me what's happening."

Related MCP server: DebugMCP

Supported Debug Adapters

Any DAP-compliant debug adapter works. Built-in defaults for:

Language

Adapter

Install

Python

debugpy

pip install debugpy

Go

Delve

go install github.com/go-delve/delve/cmd/dlv@latest

Node.js / TypeScript

vscode-js-debug

Configure its dapDebugServer.js path or install it in the project

C/C++

lldb-dap

apt install lldb / brew install llvm

Rust on Linux

GDB native DAP (gdb); LLDB fallback (cppdbg)

GDB with Python and native DAP support; optional matching rust-gdb integration

Rust on other platforms

lldb-dap (cppdbg)

LLVM/LLDB, plus matching Rust LLDB formatters

PHP

vscode-php-debug + xdebug 3

Install xdebug, then point the php adapter's program at out/phpDebug.js

Additional adapters, and project-specific paths for the built-ins, can be registered via configure_adapter or config files.

Launch recipes are built in

The per-language incantations that usually stand between an agent and its first breakpoint ship with the server:

  • PHP — the php adapter's launchDefaults carry the xdebug runtimeArgs and listen port. They are merged into a user-configured php entry, so you only supply the phpDebug.js path. If PHP still runs past a breakpoint, the result carries a hint pointing at xdebug.

  • Rust — GDB sessions load installed Rust GDB pretty-printers before initialization when available; LLDB sessions that break in .rs files load lldb_lookup.py. debug_at defaults program to target/debug/<package name>. For virtual Cargo workspaces, test executables, or custom target directories, pass the compiled executable explicitly.

  • Go — cwd is mirrored to dlvCwd so delve builds from the module directory.

  • Java / JDWP — debug_doctor prints the -agentlib:jdwp=… line to start the JVM with; debug_attach accepts breakpoints so they bind before a suspend=y VM resumes.

debug_doctor and debug_at detect the language from manifests (pyproject.toml, go.mod, Cargo.toml, composer.json, pom.xml, build.gradle, CMakeLists.txt, package.json), from the breakpoint file's extension, and — for manifest-less script directories — from the source files in cwd and cwd/src.

Rust: choosing GDB or LLDB

On Linux, debug_doctor and debug_at prefer GDB after a bounded DAP initialize check of the configured command (gdb --nx --quiet --interpreter=dap). A GDB executable without working Python/DAP support is unavailable. Automatic selection falls back to LLDB before launching the target; a launch or runtime failure never reruns the program with another debugger. An explicit adapter always wins, including when that adapter is unavailable. C/C++ and other-platform defaults are unchanged; interactive tools still take an explicit adapter.

{
  "cwd": "/workspace/rust-project",
  "adapter": "cppdbg",
  "program": "/workspace/rust-project/target/debug/app",
  "file": "/workspace/rust-project/src/main.rs",
  "line": 42,
  "expressions": ["count"]
}

Pass this to debug_at to choose LLDB; omit adapter for automatic selection, or use "gdb" explicitly. Compile with debug information (cargo build or cargo test --no-run); the program must be an executable, not an .rs file.

Automatic inspection evaluates expressions with DAP context watch. The interactive evaluate tool retains its repl default: with GDB, use context: "watch" for count or count as u32, and context: "repl" for debugger commands such as print count. Expression syntax depends on the engine; LLDB formatters do not add a Rust expression parser.

GDB Rust formatters are optional for String, Vec, and HashMap; scalar inspection works without them. Install the matching toolchain's rust-gdb integration if doctor reports them missing. Automatic loading accepts only the installed sysroot's scripts outside the project and rejects escaping symlinks; it does not broaden GDB's auto-load safe path. Custom trusted setup can be supplied through adapter arguments. GDB launch env values override the inherited server environment, and local attach translates the common processId field to GDB's pid. Advanced remote/core-dump GDB workflows require adapter-specific setup.

MCP Tools

Tool

Description

debug_doctor

Start here: detect the project, recommend an adapter, verify its complete command, and return setup remediation.

debug_at

Primary debugging call: infer the adapter, stop at a line, evaluate expressions, and clean up.

debug_inspect

One-shot: launch → run to breakpoint → evaluate expressions → disconnect when the adapter is already known.

debug_run

One-shot: launch → run to completion → return all output. Combine with logpoints for printf-style debugging without editing source.

debug_launch

Start an interactive debug session (launch a program with breakpoints)

debug_attach

Attach to a running process; pass breakpoints / exceptionBreakpoints to bind them before it resumes

debug_restart

Restart with the same configuration

debug_disconnect

End a debug session

set_breakpoints

Set/replace breakpoints in a file (use logMessage for logpoints)

set_exception_breakpoints

Break on exceptions

list_breakpoints

List currently-registered breakpoints for a session

get_state

Get threads, stack trace, scopes, and variables (scopes: ["Registers"] to opt into CPU registers, detail: "compact" for a slim view)

evaluate

Evaluate an expression in the debuggee context

step

Continue, next, stepIn, stepOut, or pause; answers compactly by default (detail: "full" for the get_state shape)

get_output

Get buffered stdout/stderr

configure_adapter

Register a custom debug adapter

list_adapters

List available adapters

Installation

npm install -g dap-mcp-server

Or from source:

git clone <repo-url>
cd dap-mcp-server
npm install
npm run build

Usage with Codex

Choose either direct MCP registration or the plugin; installing both exposes the same debugger twice. The plugin also supplies the activation skill.

Direct MCP registration

Register the stdio server in Codex CLI (the CLI and IDE extension share this configuration):

codex mcp add dap -- npx -y dap-mcp-server
codex mcp list

For a source checkout, build first and register the absolute entry-point path instead:

npm ci
npm run build
codex mcp add dap -- node "$(pwd)/build/index.js"

Direct registration exposes the tools but does not install the activation skill. To add the skill to a project after a global npm install:

mkdir -p .agents/skills/dap-debugging
cp "$(npm root -g)/dap-mcp-server/SKILL.md" .agents/skills/dap-debugging/SKILL.md

Plugin: MCP server and activation skill

The npm package also ships a Codex plugin that bundles the MCP declaration with the dap-debugging activation skill. After a global install, register its marketplace and install the plugin:

npm install -g dap-mcp-server
codex plugin marketplace add "$(npm root -g)/dap-mcp-server/integrations/codex"
codex plugin add dap-debugging@dap-mcp-server

From a source checkout, the marketplace path is "$(pwd)/integrations/codex". The plugin launches the published npm server via npx; use direct registration with build/index.js to test changes to the server itself.

Start a new Codex session after installation. Ask Codex to run debug_doctor with the project's absolute cwd, then use debug_at for one-shot breakpoint inspection. The activation skill provides this workflow when installed. Debug adapters must still be installed separately (see the supported-adapters table above).

Usage with Claude Code

Register the server for the current user:

claude mcp add --scope user dap -- npx -y dap-mcp-server

The repository also contains a Claude Code plugin that bundles the MCP declaration and the activation skill. During local development, validate and load it with:

claude plugin validate integrations/claude/dap-debugging
claude --plugin-dir ./integrations/claude/dap-debugging

To configure MCP manually, use a project .mcp.json:

{
  "mcpServers": {
    "dap": {
      "command": "npx",
      "args": ["-y", "dap-mcp-server"]
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "dap": {
      "command": "dap-mcp-server"
    }
  }
}

A SKILL.md file is included in the package. After a local package install, copy it to the required skill directory layout:

mkdir -p .claude/skills/dap-debugging
cp node_modules/dap-mcp-server/SKILL.md .claude/skills/dap-debugging/SKILL.md

For a global npm install, the source file is under $(npm root -g)/dap-mcp-server/SKILL.md, not the project's node_modules.

Design

Tools are deliberately coarse-grained. debug_doctor makes setup failures actionable and debug_at performs the common detect → launch → stop → inspect → cleanup workflow in one call. A single get_state call returns threads, stack trace, scopes, and variables. The step tool blocks until the debuggee stops again and returns the new state.

Responses are budgeted for an LLM's context window:

  • CPU register scopes are never fetched unless asked for by name; skipped scopes are listed in omittedScopes.

  • step returns a compact state: frame-local scopes only, a 5-frame stack, no thread list for single-threaded programs, minified JSON.

  • A state carries only output that no earlier debug_launch/step response has reported (capped at the newest 50 entries, with outputOmitted); get_output always has the whole buffer.

  • debug_doctor details only the selected adapter (verbose: true for all); a not-ready debug_at answers with a one-line summary.

Stops on an exception include exception: { id, description, breakMode }. When the program ends, debug_run, debug_at, debug_launch and step report its exitCode if the adapter provides one.

Session IDs are optional when only one debug session is active. Breakpoints can be set inline with debug_launch for single-call debugging setup.

See docs/plans/2026-03-05-dap-wrapper-mcp-design.md for the full design document.

Configuration

Adapter configurations are stored in:

  • ~/.dap-mcp/adapters.json — global defaults

  • ./.dap-mcp/adapters.json — project-local overrides

License

MIT

Available Tools

17 tools
configure_adapterB
DestructiveIdempotent

Register or update a debug adapter configuration and persist it to disk.

Inputs: type (required), program (required), args, scope, +5 more.

debug_atInspect runtime state at a lineA
Destructive

Primary one-shot debugging tool for bugs and failing behavior. Auto-selects a ready adapter, launches the program, stops at file:line, evaluates expressions, reports breakpoint/termination/timeout details, and cleans up.

Inputs: file (required), line (required), cwd, env, +8 more. Returns: hit, hint, output, reason, +8 more

debug_attachA

Attach a debug adapter to an already-running process. Pass breakpoints here rather than afterwards: they bind before the debuggee resumes, which is the only reliable way to stop a process started suspended (e.g. JDWP suspend=y). With breakpoints or exception breakpoints, waits and reports stopped, terminated, or timeout.

Inputs: adapter (required), host, port, timeout, +6 more.

debug_disconnectB

Disconnect from a debug session and optionally terminate the debuggee.

Inputs: sessionId, terminateDebuggee.

debug_doctorCheck debugger readinessA
Read-onlyIdempotent

Inspect a local project, detect its language/tooling, select the likely debug adapter, verify the complete adapter command, and return concrete remediation. Use this before debugging or when an adapter fails to start.

Inputs: cwd, adapter, verbose. Returns: cwd, ready, adapters, detected, +3 more

debug_inspectA

One-shot inspection: launch a program, run to a breakpoint, evaluate a list of expressions in that frame, then disconnect. Collapses launch + wait + evaluate + disconnect into a single call. Use for 'what is X at line N?' debugging.

Inputs: at (required), adapter (required), program (required), cwd, +6 more.

debug_launchA

Launch an interactive debug session. With a breakpoint or stopOnEntry, waits by default and reports whether execution stopped, terminated, or timed out.

Inputs: adapter (required), cwd, env, args, +8 more.

debug_restartA

Restart a debug session with the same adapter and launch configuration.

Inputs: sessionId.

debug_runA

Launch a program with no stops, let it run to completion, and return all stdout/stderr/console output. Optionally inject logpoints (breakpoints with logMessage) for printf-style debugging without modifying source. Use for 'what does this script actually do?' cases where you don't need to inspect intermediate state.

Inputs: adapter (required), program (required), cwd, env, +4 more.

evaluateB

Evaluate an expression in the context of a stopped debug session.

Inputs: expression (required), context, frameId, sessionId.

get_outputA
Destructive

Get buffered stdout/stderr and debug adapter output for a session. Pass since (the nextSince from a previous call) to get only newly-emitted entries — useful for polling logpoint output without re-reading the full buffer.

Inputs: clear, since, category, sessionId.

get_stateA
Read-onlyIdempotent

Get the current state of a debug session. If stopped, returns full stack/scopes/variables. If running, returns status and buffered output.

Inputs: depth, detail, scopes, timeout, +3 more.

list_adaptersA
Read-onlyIdempotent

List all known debug adapters with their availability status on this machine. Returns a summary line, the full adapter list, and a separate 'missing' list with installation hints for adapters that aren't installed.

Inputs: no named parameters.

list_breakpointsA
Read-onlyIdempotent

List the breakpoints currently registered with a session, grouped by source file. Includes regular breakpoints, conditional breakpoints, and logpoints.

Inputs: sessionId.

set_breakpointsB

Set breakpoints in a source file for an active debug session.

Inputs: file (required), breakpoints (required), sessionId.

set_exception_breakpointsC

Configure exception breakpoints for an active debug session.

Inputs: filters (required), sessionId.

stepA

Control execution of a debug session: continue, step over (next), step into, step out, or pause. Waits for the program to stop and returns the new state.

Inputs: action (required), detail, timeout, threadId, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 17 tools

    Disambiguation3/5

    Most tools map to distinct DAP operations (launch, attach, step, evaluate, breakpoints), but the one-shot helpers debug_at and debug_inspect overlap heavily—both launch, hit a breakpoint, and evaluate expressions—and debug_run sits nearby too. Descriptions do help differentiate them, but an agent must read carefully to pick the right entry point.

    Naming Consistency3/5

    All snake_case, but the verb style is split: session tools carry a debug_ prefix (debug_launch, debug_attach, debug_inspect) while peer operations are bare verbs (step, evaluate, get_state). Names like debug_at and debug_doctor don't follow a clear verb_noun pattern, weakening predictability.

    Tool Count3/5

    17 tools is on the heavy side, and the overlap between debug_at, debug_inspect, and debug_run suggests some could be consolidated. Most tools do earn their place, so it's borderline rather than bloated.

    Completeness4/5

    Coverage spans adapter discovery/configuration, session lifecycle (launch, attach, restart, disconnect), breakpoints (regular, exception, list), state/output, evaluate, and step. Minor gaps exist—no explicit breakpoint removal or dedicated thread/stack queries—but these are largely workable through existing tools.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      Enables AI agents to perform step-through debugging of Python, JavaScript/Node.js, and Rust programs using the Debug Adapter Protocol, with support for breakpoints, variable inspection, and stack traces.
      29
      194
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to debug code inside VS Code by setting breakpoints, stepping through execution, inspecting variables, and evaluating expressions across multiple languages.
      588
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables coding agents to use a real debugger (Python via debugpy) for launching, attaching, setting breakpoints, stepping through code, inspecting stack frames, and evaluating expressions through MCP tools.
      12
      27
      MIT