DebugMCP (MCP Server) - Empowering AI Agents with Operational Debugging Capabilities
Let AI agents debug your code inside VS Code - set breakpoints, step through execution, inspect variables, and evaluate expressions. Works with Codex, GitHub Copilot, GitHub Copilot CLI, Claude Code, Cline, Cursor, Windsurf, Roo Code, and any MCP-compatible assistant. Compatible with any VS Code supported coding language.






๐ DebugMCP CLI is now available on npm! Debug directly from the
terminal without requiring VS Code or any IDE at all by connecting AI
coding agents to explicitly configured Debug Adapter Protocol (DAP) adapters.
The debug adapter and target process run in the background. Install it with
npm install --global debugmcp, then run
debugmcp configure --agent copilot-cli. The CLI also installs the
debug-live skill automatically. View the package on npm
โญ If you find DebugMCP useful, please star the repo on GitHub! It helps others discover the project and motivates continued development.
๐ข Developers Notice: This extension is maintained by ozzafar@microsoft.com and orbarila@microsoft.com. We welcome feedback and contributions to help improve this extension.
๐ฌ Watch DebugMCP in action โ your AI assistant autonomously sets breakpoints, steps through code, and inspects variables directly in VS Code.
โจ What's New
2.4
- Standalone DebugMCP CLI โ install
debugmcp from npm and give MCP-compatible agents direct access to explicitly configured DAP adapters without running VS Code. The CLI supports any language with a DAP adapter that communicates over stdio, configures supported agents, and installs the debug-live skill automatically.
2.2
- Cross-agent
debug-live skill install โ the systematic debugging workflow ships as an Agent Skill and is now installed into the standard skills directories โ ~/.agents/skills/ (the cross-agent location honored by skills-compatible harnesses, including VS Code agent mode) and ~/.copilot/skills/ when present โ so it's discoverable everywhere instead of being copied next to each agent's config where nothing scans it (fixes #105, where VS Code never loaded the skill). The server also advertises MCP instructions and the start_debugging tool points at the skill for the full workflow.
- Pause running programs โ new
pause_execution tool interrupts a freely-running program and stops at its current location, even with no breakpoint set (great for busy loops and embedded/bare-metal targets), so you can then inspect state or step from there.
- Robust debugging via the VS Code Testing API โ
start_debugging with a testName uses the VS Code Testing API to discover and launch the test, producing consistent breakpoint hits inside individual test cases across language test runners (pytest, Jest/Vitest, Java, .NET, Go, etc.).
๐ Quick Install
Install DebugMCP from VS Code Marketplace or use the direct link: vscode:extension/ozzafar.debugmcpextension
Install DebugMCP from Open VSX Registry
Install debugmcp-cli from npm
Table of Contents
- Overview
- Features
- Installation
- Quick Start
- Supported AI Assistants
- Supported Languages
- Configuration
- FAQ
- Troubleshooting
- How It Works
- Contributing
- License
Overview
DebugMCP is an MCP server that gives AI coding agents full control over the VS Code debugger. Instead of reading logs or guessing, your AI assistant can autonomously set breakpoints, launch debug sessions, step through code line by line, inspect variable values, and evaluate expressions โ just like a human developer would. It runs 100% locally, requires zero configuration, and works out of the box with any MCP-compatible AI assistant.
Features
๐ง Tools
| Tool | Description | Parameters |
|---|
| start_debugging | Start a debug session for a source code file | fileFullPath (required)workingDirectory (required)testName (optional)configurationName (optional) |
| stop_debugging | Stop the current debug session | None |
| step_over | Execute the next line (step over function calls) | None |
| step_into | Step into function calls | None |
| step_out | Step out of the current function | None |
| continue_execution | Continue until next breakpoint | None |
| pause_execution | Interrupt a freely-running program and stop at its current location (no breakpoint needed) | None |
| restart_debugging | Restart the current debug session; a fresh stop without acknowledgement returns an explicit completion-unconfirmed result, not confirmed success | None |
| get_debug_status | Read paused/running/no-session status, the active session ID, and selected-frame details when paused; optionally wait for a pause | waitForPauseSeconds (optional, 0-600; bounded by the operation timeout) |
| get_debug_output | Read captured output for one session; requires user-enabled capture and at least one filter | sessionId (required)prefix and/or category (required filter; both are ANDed)cursor (optional)limit (optional, 1-100) |
| add_breakpoint | Add a breakpoint at a specific line (optionally conditional) | fileFullPath (required)line (required, 1-based)condition (optional) |
| add_logpoint | Add a logpoint that logs a message (instead of pausing) when a line is reached | fileFullPath (required)line (required, 1-based)logMessage (required, {expr} interpolated)condition (optional) |
| remove_breakpoint | Remove a breakpoint from a specific line | fileFullPath (required)line (required) |
| clear_all_breakpoints | Remove all breakpoints at once | None |
| list_breakpoints | List all active breakpoints | None |
| list_variable_names | List names and types of variables in scope, without reading any values | scope (optional: 'local', 'global', 'all') |
| get_variables_values | Get the values of specifically named variables at the current execution point | variableNames (required, e.g. ["user","response"])scope (optional: 'local', 'global', 'all') |
| evaluate_expression | Evaluate an expression in debug context; expandable children are listed by name and type without their values | expression (required) |
Note: The MCP server exposes tools for debugger actions, while the procedural
workflow guidance (when to debug, how to structure a root-cause investigation,
language-specific quirks) lives in the companion Agent Skill.
Tool descriptions stay terse and behavioral; the extension installs the debug-live skill
into the standard skills directories (~/.agents/skills/, plus ~/.copilot/skills/ when
present) so skills-compatible harnesses load the full workflow on demand. The server also
advertises MCP instructions pointing agents at it before debugging.
Debug output capture
To read logpoint messages without pausing the program, enable
debugmcp.captureDebugOutput in VS Code user settings before output is emitted.
For the standalone CLI host, start it with debugmcp serve --capture-output.
Capture is off by default, and MCP tools cannot enable it.
Obtain sessionId from get_debug_status while the session is active, then call
get_debug_output, for example:
{
"sessionId": "<session-id-from-get_debug_status>",
"prefix": "[orders]",
"limit": 20
}
Provide a nonempty prefix (up to 256 characters), a category (console,
stdout, stderr, or important), or both. Reuse the returned nextCursor as
cursor with the same filters to read new entries; hasMore indicates additional
entries to scan, and truncated reports evicted history. Only DAP output events
are captured, not existing Debug Console contents.
Output stays in memory, bounded to 8 sessions and 1,000 events/256 KiB per
session. Events over 8 KiB are replaced by an omission marker. History can
remain after termination until eviction, but changing the capture setting or
disposing the host clears it; output is not persisted or logged by the capture
feature. Credential-pattern redaction happens before retention, but is
heuristic and event-local, not a guarantee that every secret is removed.
Enable capture only for output you intend to make available to the agent.
๐ฏ Debugging Best Practices
DebugMCP follows systematic debugging practices for effective issue resolution:
- Start with Entry Points: Begin debugging at function entry points or main execution paths
- Follow the Execution Flow: Use step-by-step execution to understand code flow
- Root Cause Analysis: Don't stop at symptoms - find the underlying cause
๐ก๏ธ Security & Reliability
- Secure Communication: All MCP communications use secure protocols
- Local Operation: The MCP server runs 100% locally with no external communications and requires no credentials
- State Validation: Robust validation of debugging states and operations
Installation
Standalone CLI (preview)
The standalone host talks directly to explicitly configured DAP adapters and
does not require VS Code. It never discovers, downloads, installs, or selects an
adapter automatically.
Install the published package:
npm install --global debugmcp
For repository development, build and invoke the local bundle:
npm install
npm run package
node dist/debugmcp.js adapter add python --command "python -m debugpy.adapter"
node dist/debugmcp.js adapter validate python
node dist/debugmcp.js configure
Adapter registrations are stored in .debugmcp.json by default. Add --user
to adapter add, adapter list, or adapter remove to use the per-user
configuration. Project registrations override registrations with the same name
in user configuration.
Language shorthands derive the DAP type and file extensions for python,
csharp, dotnet, cpp, c, javascript, typescript, node, java,
go, rust, ruby, php, swift, and dart. These are configuration
conveniences, not a language support boundary. The command remains explicit so
the selected environment determines which adapter installation is used.
Languages without a shorthand provide --type and --extensions explicitly.
Compiled-language registrations can provide the executable in --launch;
values support ${workspaceFolder}, ${file}, ${fileDirname}, and