dap-mcp-server
Enables debugging C/C++ programs through lldb-dap, including breakpoints, stepping, variable inspection, and expression evaluation.
Enables debugging PHP scripts via vscode-php-debug and Xdebug 3, with built-in launch defaults for runtime arguments and the listen port.
Enables debugging Python programs via debugpy, supporting breakpoint-based inspection, stepping, and expression evaluation.
Enables debugging Rust executables using GDB native DAP on Linux or LLDB elsewhere, with Rust pretty-printer/formatter loading and Cargo target defaults.
Enables debugging TypeScript applications via vscode-js-debug, with breakpoints and expression evaluation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dap-mcp-server debug main.py, break at line 12, and show me the variables"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
|
Go | Delve |
|
Node.js / TypeScript | vscode-js-debug | Configure its |
C/C++ | lldb-dap |
|
Rust on Linux | GDB native DAP ( | GDB with Python and native DAP support; optional matching |
Rust on other platforms | lldb-dap ( | LLVM/LLDB, plus matching Rust LLDB formatters |
PHP | vscode-php-debug + xdebug 3 | Install xdebug, then point the |
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
phpadapter'slaunchDefaultscarry the xdebugruntimeArgsand listen port. They are merged into a user-configuredphpentry, so you only supply thephpDebug.jspath. If PHP still runs past a breakpoint, the result carries ahintpointing at xdebug.Rust — GDB sessions load installed Rust GDB pretty-printers before initialization when available; LLDB sessions that break in
.rsfiles loadlldb_lookup.py.debug_atdefaultsprogramtotarget/debug/<package name>. For virtual Cargo workspaces, test executables, or custom target directories, pass the compiled executable explicitly.Go —
cwdis mirrored todlvCwdso delve builds from the module directory.Java / JDWP —
debug_doctorprints the-agentlib:jdwp=…line to start the JVM with;debug_attachacceptsbreakpointsso they bind before asuspend=yVM 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 |
| Start here: detect the project, recommend an adapter, verify its complete command, and return setup remediation. |
| Primary debugging call: infer the adapter, stop at a line, evaluate expressions, and clean up. |
| One-shot: launch → run to breakpoint → evaluate expressions → disconnect when the adapter is already known. |
| One-shot: launch → run to completion → return all output. Combine with logpoints for printf-style debugging without editing source. |
| Start an interactive debug session (launch a program with breakpoints) |
| Attach to a running process; pass |
| Restart with the same configuration |
| End a debug session |
| Set/replace breakpoints in a file (use |
| Break on exceptions |
| List currently-registered breakpoints for a session |
| Get threads, stack trace, scopes, and variables ( |
| Evaluate an expression in the debuggee context |
| Continue, next, stepIn, stepOut, or pause; answers compactly by default ( |
| Get buffered stdout/stderr |
| Register a custom debug adapter |
| List available adapters |
Installation
npm install -g dap-mcp-serverOr from source:
git clone <repo-url>
cd dap-mcp-server
npm install
npm run buildUsage 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 listFor 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.mdPlugin: 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-serverFrom 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-serverThe 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-debuggingTo 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.mdFor 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.stepreturns 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/stepresponse has reported (capped at the newest 50 entries, withoutputOmitted);get_outputalways has the whole buffer.debug_doctordetails only the selected adapter (verbose: truefor all); a not-readydebug_atanswers 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 toolsconfigure_adapterBDestructiveIdempotent
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 lineADestructive
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 readinessARead-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_outputADestructive
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_stateARead-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_adaptersARead-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_breakpointsARead-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
Scored across 17 tools
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.
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.
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.
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
Related MCP Connectors
Agent Replay Debugger MCP — record every agent step + deterministic replay. Step-debugger for
Live browser debugging for AI assistants — DOM, console, network via MCP.
AI-native programming language and toolchain for accountable, verifiable agent-driven development.
AI Agent Utility Layer for agent safety, web monitoring, crypto research and tool discovery.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables 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.29194MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to debug code inside VS Code by setting breakpoints, stepping through execution, inspecting variables, and evaluating expressions across multiple languages.588MIT
- AlicenseBqualityDmaintenanceEnables 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.1227MIT
- AlicenseBqualityDmaintenanceEnables AI agents to debug C/C++ programs with GDB or LLDB, supporting breakpoints, stepping, variable inspection, and function calls.20MIT