# mcp-debugger [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/debugmcp/mcp-debugger  
**GitHub Stars:** 197  
**npm Downloads (last month):** 10787  
**Views:** 7  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-debugger-2

## Description
Step-through debugging for AI agents: breakpoints, stepping and live variables in nine languages

## Tools
Capabilities this server exposes over MCP:

- **create_debug_session** — Create a new debugging session. Passing port, processId or an adapterConfig that names a target (a debugger URI: vmServiceUri, websocketAddress, vmServiceInfoFile; or a Flutter deviceId, for an app running on an Android device) attaches to a running process in the same call, with every attach argument attach_to_process takes (host alone does not); omit them for launch mode. Attaching pauses the target unless stopOnEntry is false
- **list_supported_languages** — List all supported debugging languages with metadata
- **list_debug_sessions** — List all active debugging sessions. Paused sessions include lastStop with the reason for the most recent stop (e.g. "breakpoint" vs "exception")
- **set_breakpoint** — Set a breakpoint. Setting breakpoints on non-executable lines (structural, declarative) may lead to unexpected behavior
- **list_breakpoints** — List all breakpoints in a session with their verified state and adapter-assigned ids. Session-global function breakpoints appear separately as functionBreakpoints (omitted when filtering by file). Works before launch (queued, verified=false), while running or paused, and after the program exits
- **remove_breakpoint** — Remove a breakpoint by breakpointId (returned by set_breakpoint / list_breakpoints), by function name, or by file + line (removes all breakpoints at that location). Takes effect immediately while the program is running or paused; also works after the program exits, before a relaunch
- **clear_breakpoints** — Remove all breakpoints in a session, or all breakpoints in one file. Clearing zero breakpoints is success. Takes effect immediately while the program is running or paused
- **start_debugging** — Start debugging a script. Answers when the launched program stops, when it ends, or after a short hold — whichever comes first, and the same way in every language: "paused" with a reason and, as wait_for_stop answers a stop, the location, its source context and a note (a breakpoint reached as the program starts is answered here), "stopped" with the exit code, or "running" with pending:true when the program has not stopped yet; the message says what is armed. The hold is not a limit on the program — nothing is cancelled when it passes and breakpoints stay armed: call wait_for_stop to block until the program stops or ends (for a server, after sending the request that reaches your breakpoint). A stopOnEntry launch is answered at its entry stop
- **restart_debugging** — Restart the debuggee: terminate the current program (if still running) and relaunch it with the same configuration as the last start_debugging. All current breakpoints are re-applied automatically. The get_output buffer starts fresh — read from since=0 after a restart. Works while running, paused, or after the program has exited. Not available for attach sessions or sessions never launched. Answers like start_debugging, including "running" with pending:true when the relaunch has not stopped within the same short hold (then call wait_for_stop)
- **attach_to_process** — Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state "running" with pending:true; the late event alone changes the session to "paused" — call wait_for_stop to block until it does
- **detach_from_process** — Detach from the debugged process without terminating it
- **expose_session** — Expose a debug session as a read-only DAP mirror endpoint on 127.0.0.1 so an IDE (e.g. VS Code) can attach as a second debug client and inspect live state: threads, stack, scopes, variables, evaluate. Returns host, port, and a session token the IDE must include as "mirrorToken" in its attach configuration. The mirror never drives execution — continue/step/pause and breakpoint changes are rejected; control stays with this MCP session. Requires an active session (launched or attached); works while running or paused. Calling it again returns the same endpoint. The endpoint closes on unexpose_session, close_debug_session, restart, or debuggee exit
- **unexpose_session** — Close a session's DAP mirror endpoint and disconnect any attached IDE clients. Succeeds as a no-op if the session is not exposed
- **close_debug_session** — Close a debugging session
- **step_over** — Step over the current line. Waits briefly for the program to stop; if the step is still executing after ~5s (e.g. stepping over a long-running call), returns success with state "running" and pending:true — the step is still in effect and the session becomes "paused" when it completes (call wait_for_stop to block until then, or pause_execution to interrupt)
- **step_into** — Step into the current call. Waits briefly for the program to stop; if the step is still executing after ~5s, returns success with state "running" and pending:true — the session becomes "paused" when the step completes (call wait_for_stop to block until then)
- **step_out** — Step out of the current function. Waits briefly for the program to stop; if the step is still executing after ~5s (e.g. the rest of the function is long-running), returns success with state "running" and pending:true — the session becomes "paused" when the step completes (call wait_for_stop to block until then)
- **continue_execution** — Continue execution. Returns immediately after the adapter acknowledges; does not wait for the next stop. Call wait_for_stop to block until the program stops again or ends — it reports why (lastStop, e.g. "breakpoint" vs "exception") and where; list_debug_sessions and get_stack_trace show the same without waiting. Use get_output to read the program's stdout/stderr
- **wait_for_stop** — Block until the session next pauses or ends, then say why and where. Call it after continue_execution (which does not wait) and whenever a tool answers pending:true, instead of polling list_debug_sessions. Answers at once when the session is already paused (state "paused" with lastStop — the same record list_debug_sessions shows — and the top frame as location) or already over (the terminal state, with exitCode when the debuggee reported one); note says when the answer is anchored on a thread other than the one the stop was reported on, or when no frame of the shown stack is program code. If neither happens within the timeout it answers state "running" with pending:true: nothing was cancelled, breakpoints and exception filters stay armed — call it again to keep waiting, or pause_execution to interrupt
- **pause_execution** — Pause a running program. Waits briefly for the stop; if the program cannot stop within ~5s (e.g. blocked in native code, or an idle server waiting for input), returns success with pending:true and the session reports "paused" the next time the program runs code (call wait_for_stop to block until then). An observed stop answers with stopReason, the first visible frame as location (with its source context), and note when the stop was reported on a thread with no program frame — a sibling thread in program code is shown instead, or, when none has one, the note says no program frame is active. Fails with an actionable error if the session has no debuggable target to pause (e.g. a js attach whose target session was never adopted or has ended)
- **list_threads** — List all threads in the debugged process
- **get_variables** — Get variables (scope is variablesReference: number). Responses are size-guarded: oversized values are cut (truncated:true) and very large scopes return a capped list with a truncation notice — pass names:[...] to fetch specific variables in full
- **get_local_variables** — Get local variables for the shared inspection anchor. If the stopped thread is frameless, a sibling with policy-recognized user frames is preferred, adopted, and disclosed in note. At a breakpoint or step inside a frame the stack display hides as internal (a node_modules dependency), the anchor is that frame — the one the program stopped in — and note says so. A JavaScript frame with no Local/block scope returns empty with guidance instead of mislabeling Global bindings. Responses are size-guarded; pass names:[...] to fetch specific variables in full
- **get_stack_trace** — Get stack trace. The response includes stopReason — why the session is paused. For an implicit frameless stopped thread, a sibling with policy-recognized user frames is preferred and adopted, with the switch disclosed in note. Internal/runtime frames are filtered by default; when any are hidden the response carries hiddenFrames and a note. When the frame the program is paused in is itself internal, pausedFrame names it (kept: whether it was retained as stackFrames[0]) and the note says so. The note also says when the top frame's file is newer than the compiled file the debugger binds it through (a stale build)
- **get_scopes** — Get scopes for a stack frame
- **evaluate_expression** — Evaluate expression in the current debug context. Without frameId, uses the same adopted top frame as stack and locals — at a breakpoint or step that is the frame the program stopped in even when the stack display would hide it — and discloses an automatic thread switch or a hidden paused frame in anchorNote; frame names the frame that was used, on success and on failure. Expressions can read and modify program state. Waits up to 30s by default
- **get_source_context** — Get source context around a specific line in a file
- **get_output** — Get debuggee output (stdout/stderr/console) captured for a session. Buffered per launch (last 1000 entries; adapter telemetry and known adapter-internal diagnostics — e.g. LLDB DWARF-parser noise — filtered out). Works while the program is running and after it finishes, until the session is closed. Pass since=nextSince from the previous response to fetch only new output
- **hot_reload** — Apply changed code to the running program and keep its state — the adapter's own live update. Flutter: the SDK adapter's hot reload (the app must have started; the reassemble runs build(), so a breakpoint there is reported by this call as the stop, with its location and snapshot; widget state, counters and timers survive; a reload sent to a paused program lands when it resumes). Java: class redefinition (JDI HotSwap) — scans classesDir for .class files modified after sinceTimestamp, redefines the ones the JVM has loaded, re-plants breakpoints, and returns which classes were redefined and the newest file timestamp (pass it as sinceTimestamp next time for an incremental update). Statement-anchored breakpoints are re-resolved against the new source after the update (anchorResolution reports moved/stale). Refused by name on the other languages. redefine_classes is a deprecated alias of this tool.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-debugger": {
    "command": "npx",
    "args": ["-y","@debugmcp/mcp-debugger"]
  }
}
```

## Documentation

## What mcp-debugger does

mcp-debugger turns debugging operations into MCP tools that an AI agent can call while a program is running. It supports Python, JavaScript and TypeScript, Ruby, Rust, Go, Java, .NET, C and C++, COBOL, and Dart/Flutter through language-specific debug adapters and bridges.

Agents can launch programs, attach to existing processes, set and manage breakpoints, step through execution, inspect variables, evaluate expressions, and read program output. Breakpoints may target line content, function names, or expected source text, which helps them survive source edits and debugging restarts. Logpoints can record interpolated values without pausing execution.

## How it works

The server uses the Debug Adapter Protocol to control the underlying debugger for each language. It runs as a headless Node.js process and can communicate over stdio or Streamable HTTP. Each debugging session gets its own proxy process, allowing separate sessions to operate independently.

Launch and attach modes vary by language. Remote attachment is available through mechanisms including debugpy, rdbg, the JavaScript V8 inspector, JDWP, Dart or Flutter VM-service URIs, and PID-based native attachment. Source-path mapping supports targets running on another machine, in a container, or in a Kubernetes pod. Python and Ruby remote attachment can connect directly to engines already running in the target process.

Program stdout and stderr are buffered behind `get_output`, with a cursor for incremental reads. A session also exposes its output transcript as a subscribable MCP resource. Stop responses include a snapshot of exception information, top stack frames, and locals; `wait_for_stop` can block until the next stop instead of requiring polling.

## Setup and configuration

The package runs wherever Node.js runs, including CI runners, Docker containers, Kubernetes pods, SSH hosts, and agent sandboxes. It is distributed through npm and npx under `@debugmcp/mcp-debugger`, and a Docker image is available as `debugmcp/mcp-debugger`.

The server can use stdio for local MCP clients or Streamable HTTP for networked deployments. Some language adapters require tools installed on the host: Java uses a JDK 21 or newer, .NET uses `netcoredbg`, and Dart/Flutter uses the Dart or Flutter SDK. The package supplies the JavaScript, C/C++, and COBOL debug engines. `list_supported_languages` reports mode availability and the reason when a mode cannot run.

## Tools and capabilities

- Set, list, remove, and clear breakpoints during a session.
- Set content-, function-, and line-oriented breakpoints, including logpoints.
- Launch, attach, restart, and step through debug sessions.
- Inspect variables and evaluate expressions.
- Read buffered stdout and stderr with `get_output`.
- Wait for execution stops with `wait_for_stop`.
- Query launch behavior with `dryRunSpawn` without starting a process.
- Use `hot_reload` for supported Java and Flutter workflows, with `redefine_classes` retained as a deprecated alias.
- Expose a read-only IDE mirror with `expose_session`.

Dart and Flutter support includes Dart programs and tests, Flutter applications and tests on desktop, web, Android, and the iOS simulator, plus Android device attachment by `deviceId`. Flutter sessions support hot reload and hot restart.

## Limitations and notes

Language features depend on the corresponding adapter and local toolchain. Rust on Windows requires the GNU toolchain. C and C++ support includes prebuilt binaries, auto-compiled standalone source files, PID attachment, and configuration pass-through for core dumps, gdbserver, and rr targets. COBOL support uses GnuCOBOL and CodeLLDB, including decoded COBOL storage scopes and copybook breakpoints.

The server is intended for headless and remote workflows rather than replacing a native IDE debugging interface. Its IDE integration is a read-only mirror of the agent's live session.

_Full upstream README: https://allmcps.com/mcp/mcp-debugger-2/readme_

