xcnodejs-debugger-mcp
Integrates with Babel to transpile JavaScript/JSX/TypeScript source files during debugging, enabling breakpoints and inspection of code that requires transpilation.
Provides debugging capabilities for Node.js processes, including launch, attach, breakpoints, stepping, variable inspection, and restart via the Chrome DevTools Protocol.
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., "@xcnodejs-debugger-mcp Debug my Node script at src/index.js, break on line 15, and list 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.
xcnodejs-debugger-mcp
A Node.js debugger MCP server for local coding agents.
The agent calls MCP tools. This server talks Chrome DevTools Protocol (CDP) to a Node process started with V8 Inspector (--inspect-brk=127.0.0.1:0). Architecture:
MCP client (agent) → this server → CDP / WebSocket → Node Inspector → your JSIt is a VS Code Node debug subset (launch, attach, breakpoints, step, stack, variables, console, restart) exposed as MCP tools. It is not a wrapper around node inspect, the Debug Adapter Protocol (DAP), or ms-vscode.js-debug.
Repository: https://github.com/XC881/xcnodejs_debugger_mcp
Author: XC881 team
License: XC881 Non-Sale Source License — commercial use and free modification allowed; selling the software is prohibited
Node.js: 20+
Why this exists
Agents need a debugger they can drive with tools, not a GUI. Existing options usually take one of these paths:
Approach | What it does | Why we did not |
Wrap | Drive the CLI inspector | Fragile text UI, not a protocol |
Wrap DAP / | Agent talks DAP; js-debug talks CDP | Extra process, DAP session lifetime, adapter-specific quirks |
Chrome DevTools only | Human UI on | Not callable from an MCP host |
This server | MCP tools → CDP → Node | One hop, Node-only, session-stable restart |
microsoft/vscode-js-debug is an excellent recipe (child auto-attach, NodeWorker, logpoints, inspect-brk hold). We read it that way. It is not a runtime dependency and is not spawned.
Related MCP server: Node.js Debugger MCP
What is different
MCP → CDP → Node, not MCP → DAP → js-debug → CDP → Node.
stdio and Streamable HTTP on one server. Debug sessions live in the process, not per HTTP request.
Several programs at once. Each
debug_launch/debug_attachreturns asessionId(dbg-1,dbg-2, …).VS Code Restart, not nodemon.
debug_restartkills a launched debuggee (or re-attaches), reapplies breakpoints, keepssessionId, and does not drop the MCP connection.The program’s
node_modules, not the MCP server’s. Defaultcwdis the package root ofprogram(walks up, skips directories insidenode_modules). Breakpoints accept a path or a package specifier such asdemo-ext.Hold at start. Launch uses
--inspect-brkand returnsawaiting_startso you can bind breakpoints in the entry script,--requirehooks, andnode_modulesbefore user code runs.Token-aware variables. Preview (default 32 properties), expand by
objectId, page withcursor. Cycles are[Circular]/已回环. Truncation is已折叠. The heap is not dumped into the model context.Inspector stays on loopback.
--allow-remoteonly allows the MCP HTTP bind address to leave127.0.0.1. CDP is always127.0.0.1.Children and workers.
child_processauto-attach via a loopback hub + preload.worker_threadsvia InspectorNodeWorkermultiplexed on the parent WebSocket.Logpoints, pid attach, source maps, optional Babel. DAP-style
{expr}logpoints, attach by pid,file:/// inline / loopbackhttp(s)maps,@babel/registerfor.jsx/.ts/.tsxwhen the program has a Babel config.
Features
Launch / attach (
wsUrl, host+port, or pid) / disconnectstdio MCP (default) and Streamable HTTP (
--http, loopback unless--allow-remote)Multiple concurrent sessions (
debug_list_sessions)Line breakpoints, conditions, DAP-style logpoints
debugger;pauses when attachedContinue, pause, step in / over / out
debug_wait_for_pauseanddebug_resumedebug_restart(launch relaunch or attach rediscover)Source maps:
file://, inlinedata:, loopbackhttp(s), andhttp(s)maps when the script URL is alsohttp(s)child_processauto-attach andworker_threads(NodeWorker)Call stack, evaluate, stdout/stderr/console
debug_list_scripts(entry, preloads, plugins, internals)Skip
node:/internal/frames by default
Requirements
Node.js 20+
A trusted local workspace (launch and evaluate run as the MCP user)
git clone git@github.com:XC881/xcnodejs_debugger_mcp.git
cd xcnodejs_debugger_mcp
npm installRun
npm start # stdio MCP (default; stdout is the protocol)
npm run start:http # Streamable HTTP on http://127.0.0.1:3930
npm test
npm run build # dist/index.jsLogs and warnings go to stderr. Do not print to stdout in stdio mode.
CLI
xcnodejs-debugger-mcp [--stdio | --http] [--host 127.0.0.1] [--port 3930] [--allow-remote]Flag | Meaning |
| MCP over stdin/stdout (default) |
| Streamable HTTP |
| Bind address for |
| Bind port (default |
| Allow |
MCP host config
Development (tsx, no build):
{
"mcpServers": {
"xcnodejs-debugger": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/xcnodejs_debugger_mcp/src/index.ts"]
}
}
}After npm run build:
{
"mcpServers": {
"xcnodejs-debugger": {
"command": "node",
"args": ["/absolute/path/to/xcnodejs_debugger_mcp/dist/index.js"]
}
}
}HTTP (loopback). Start npm run start:http first:
{
"mcpServers": {
"xcnodejs-debugger": {
"url": "http://127.0.0.1:3930"
}
}
}HTTP sessions live in the server process, not per request. Closing one HTTP call does not disconnect debuggees.
Typical flow
debug_launch returns awaiting_start. The inspector is attached, but user code has not run yet (including --require / --import / loaders). Set breakpoints, then start the isolate.
debug_launch{ "program": "app.js" }→sessionId, stateawaiting_startdebug_set_breakpoint{ "file": "app.js", "line": 12 }(repeat for extension files)debug_continue— returns immediately and starts user codeExercise the program (HTTP request, timer, …)
debug_wait_for_pausedebug_get_stack/debug_get_variables/debug_evaluatedebug_disconnect
debug_resume is continue + wait (scripted stepping). debug_continue + debug_wait_for_pause is the split to use when the process must keep running while you poke it from outside.
Lines and columns are 1-based.
Tools
When more than one session is live, pass sessionId on every tool except debug_launch / debug_attach / debug_list_sessions.
Tool | Role |
| Spawn with |
| Attach by |
| List |
| One session: idle / connecting / awaiting_start / paused / running / closed. |
| Close one session or |
| VS Code Restart: relaunch or re-attach, reapply breakpoints, keep |
| Path or package specifier. Optional |
| Breakpoints in a session. |
| Remove by id ( |
| Scripts the inspector has parsed. |
| Start isolate if |
| Start if needed; return current pause; or block until |
| Continue (or start) and wait for the next pause. |
|
|
| Step and return the new snapshot. |
| Current frames (paused). |
| Locals/closures, or expand |
|
|
| stdout, stderr, |
debug_launch arguments
Argument | Meaning |
| Entry script, absolute or relative to |
| Program arguments |
| Working directory. Default: package root of |
| Extra env (merged over the MCP process env) |
| Runtime binary (default: the Node running this server) |
| Extra runtime args after inspect/preload flags ( |
| Optional |
| Auto-attach |
| Auto |
| Shown in |
debug_attach arguments
Provide one of: wsUrl, host+port, or pid.
Argument | Meaning |
| Full inspector WebSocket URL ( |
| Inspector host (default |
| Inspector HTTP port for |
| Attach by process id. Enables inspector with |
| Optional label |
Pid attach only uses ports owned by that pid (and loopback /json/list). Restart of a pid session rediscovers the inspector without signaling again (SIGUSR1 can toggle inspector off).
Breakpoints, logpoints, debugger;
{ "file": "app.js", "line": 12 }
{ "file": "demo-ext", "line": 2 }
{ "file": "app.js", "line": 20, "condition": "i === 3" }
{ "file": "app.js", "line": 20, "logMessage": "i={i} name={user.name}" }fileis a path or a package name resolved from the debuggeenode_modules.conditionis JavaScript. Pause only when it is truthy.logMessageis a DAP-style logpoint:{expr}is interpolated viaconsole.logand does not pause. Combined withconditionwhen both are set. Empty{}stays literal.%in static text becomes%%.debugger;pauses after the inspect-brk entry pause, when the inspector is attached.
Variables (token-aware)
debug_get_variables does not dump whole objects.
Default page size 32 (
maxProperties, max 200)objectIdexpands a nested objectcursor/nextCursorpages the restincludeGlobal/scopeIndexfor global/script scopes (omitted by default)Cycles:
[Circular]/已回环(V8 mints a newobjectIdper preview; cycles are detected with===viaRuntime.callFunctionOn)Truncated strings and extra properties:
已折叠
Strings in previews are capped (256 characters).
Source maps
Original sources are used for breakpoints, stack frames, and excerpts when a map is available:
file://map files next to generated JSInline
data:mapsLoopback
http(s)maps (including from afile://script)http(s)maps when the script URL is alsohttp(s)
Absolute non-loopback http(s) maps on a file:// script are not fetched (SSRF). Redirects are not followed. Payload cap is 5 MB.
Restart
debug_restart matches VS Code Restart:
Launch: kill the debuggee, spawn the same config, reapply breakpoints. Edited JS is loaded.
sessionIdunchanged. MCP stays up.Attach: disconnect CDP, do not kill the debuggee, rediscover
host+port(or reusewsUrl/ pid without re-signaling), reattach, reapply breakpoints.
This is not file-watch reload / nodemon.
Children and workers
On launch, unless autoAttachChildren: false:
child_process:NODE_OPTIONS=--require=<preload>reports a new inspector URL to a loopback hub. The child is a new session withparentSessionId. Breakpoints are copied. Disconnect parent disconnects children first.worker_threads:NodeWorker.enable({ waitForDebuggerOnStart: true }). The worker is a nested CDP session on the parent WebSocket (not a second inspector port). EntryBreak on startis skipped so copied breakpoints can hit.
The preload skips -e / --eval and threads that are not the main thread (workers go through NodeWorker only).
Node extensions and Babel
This server does not use its own node_modules to load the debuggee’s plugins.
Default cwd is found by walking up from program, skipping paths inside node_modules, until package.json or node_modules is found.
If you omit require / import / loader, Node loads packages the usual way. Set a breakpoint with a specifier or a path:
{ "file": "demo-ext", "line": 2 }{ "file": "node_modules/babel-plugin-foo/lib/index.js", "line": 12 }Optional preloads still work; bare names resolve from the program file node_modules:
{
"program": "app.js",
"require": ["@babel/register"]
}.jsx / .ts / .tsx programs auto-prepend @babel/register from that node_modules when a Babel config exists (babel.config.*, .babelrc*, or package.json#babel). .js is left to Node and source maps unless you set autoLoadBabel: true. Set autoLoadBabel: false to skip.
Set breakpoints in the plugin and in app.js before debug_continue.
Security
Launch executes a process as the MCP user.
debug_evaluateruns JavaScript inside that process.Inspector CDP is always
127.0.0.1.--allow-remotedoes not change that.Use only on a trusted local workspace.
Source-map HTTP fetch is bounded (loopback / same-scheme script, no redirects, 5 MB, 5 s).
Tests
npm testIntegration coverage includes launch/attach, closures, debugger;, ESM/require packages, source maps, child auto-attach, workers, logpoints, pid attach, Babel .tsx hook, and stdio/HTTP MCP.
Mapping from VS Code launch.json
| MCP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
Launch always injects --inspect-brk=127.0.0.1:0 and holds the isolate until continue/resume so pending breakpoints bind in preloaded modules.
Acknowledgements
Node.js — V8 Inspector /
--inspect/--inspect-brkChrome DevTools Protocol — the wire protocol this server speaks
Model Context Protocol and
@modelcontextprotocol/server— MCP stdio and Streamable HTTPmicrosoft/vscode-js-debug — recipe only (inspect-brk hold, child auto-attach,
NodeWorker, logpoint condition shape). Not linked, not spawned, not wrappedDebug Adapter Protocol — UX mapping for Restart and logpoints; this server does not implement or wrap DAP
ws — Inspector WebSocket
zod — tool schemas
Author
XC881 team
Issues and source: https://github.com/XC881/xcnodejs_debugger_mcp
Available Tools
21 toolsdebug_attachAttach to inspectorADestructive
Attach to an existing Node inspector on loopback and return a new sessionId. Provide wsUrl, host+port (GET /json/list), or pid (enables inspector if needed). Runs the target as the MCP user. launch executes a process; evaluate runs JavaScript inside it. Only use on a trusted local workspace. Inspector is bound to 127.0.0.1.
Inputs: pid, host, port, label, +1 more.
debug_continueContinueA
Start the isolate if still awaiting_start, or resume a paused target. Returns immediately. Use debug_wait_for_pause after a breakpoint is expected.
Inputs: sessionId.
debug_disconnectDisconnectADestructiveIdempotent
Close one session, or all sessions if all=true. By default kills a process started by debug_launch; attached processes are left running unless terminate=true.
Inputs: all, sessionId, terminate.
debug_evaluateEvaluateADestructive
Evaluate a JavaScript expression. Uses Debugger.evaluateOnCallFrame when paused, otherwise Runtime.evaluate. Runs the target as the MCP user. launch executes a process; evaluate runs JavaScript inside it. Only use on a trusted local workspace. Inspector is bound to 127.0.0.1.
Inputs: expression (required), sessionId, callFrameId.
debug_get_outputProgram outputARead-only
Read captured stdout, stderr, and Runtime.consoleAPICalled entries. Pass cursor from the previous response for incremental reads.
Inputs: cursor, sessionId.
debug_get_stackCall stackARead-only
Return the current call stack. Requires a paused target. Lines are 1-based.
Inputs: sessionId.
debug_get_variablesVariablesARead-only
Inspect locals/closures on a paused frame, or expand an objectId from a previous result. Returns a preview: default 32 properties, cursor pages the rest, overflow/已折叠 when truncated, [Circular]/已回环 for cycles. Expand nested values with objectId. Global/script scopes are omitted unless includeGlobal or scopeIndex is set. Requires a paused target.
Inputs: cursor, objectId, sessionId, scopeIndex, +3 more.
debug_launchLaunch Node programADestructive
Spawn a Node program under --inspect-brk=127.0.0.1:0 and return a new sessionId in awaiting_start. cwd defaults to the package root of program (the directory that owns that file's node_modules). User code does not run until debug_continue, debug_resume, or debug_wait_for_pause. Set breakpoints in the entry script and in node_modules packages before continuing. require/import/loader are optional --require/--import/--experimental-loader injects, resolved from the program's node_modules. Child processes are auto-attached by default. Call again to debug another program in parallel. Runs the target as the MCP user. launch executes a process; evaluate runs JavaScript inside it. Only use on a trusted local workspace. Inspector is bound to 127.0.0.1.
Inputs: program (required), cwd, env, args, +8 more.
debug_list_breakpointsList breakpointsBRead-only
List breakpoints in a session.
Inputs: sessionId.
debug_list_scriptsList parsed scriptsARead-only
List scripts the inspector has parsed (entry, --require/--import modules, Babel plugins, node internals). Use this to find the file URL to break in an extension.
Inputs: sessionId.
debug_list_sessionsList debug sessionsARead-only
List all debug sessions on this MCP connection (sessionId, state, pid, program, label).
Inputs: no named parameters.
debug_pausePauseB
Request Debugger.pause. Returns the current snapshot if already paused.
Inputs: sessionId, timeoutMs.
debug_remove_breakpointRemove breakpointAIdempotent
Remove a breakpoint by id returned from debug_set_breakpoint.
Inputs: id (required), sessionId.
debug_restartRestart debuggeeADestructive
For launch: kill the debuggee, spawn the same configuration, reapply breakpoints. For attach: disconnect CDP, rediscover the inspector, reattach, reapply breakpoints. sessionId is unchanged and this MCP connection stays up.
Inputs: sessionId.
debug_resumeResume and waitA
Start or continue, then wait for the next pause. Use for scripted stepping through breakpoints. From awaiting_start, starts the isolate (set breakpoints first).
Inputs: sessionId, timeoutMs.
debug_set_breakpointSet breakpointA
Set a line breakpoint with Debugger.setBreakpointByUrl. file is a path or a package specifier resolved from the debuggee program node_modules. Original sources are remapped through file://, inline, or allowed http(s) source maps. Lines and columns are 1-based. logMessage is a DAP-style logpoint (interpolates {expr}, does not pause).
Inputs: file (required), line (required), column, condition, +2 more.
debug_statusSession statusARead-only
Return one session's idle/connecting/paused/running/closed, pid, and inspector WebSocket URL. Omit sessionId if only one session is live.
Inputs: sessionId.
debug_step_intoStep intoB
Step into the current call and return the new pause snapshot.
Inputs: sessionId, timeoutMs.
debug_step_outStep outB
Step out of the current function and return the new pause snapshot.
Inputs: sessionId, timeoutMs.
debug_step_overStep overB
Step over the current statement and return the new pause snapshot. Lines are 1-based.
Inputs: sessionId, timeoutMs.
debug_wait_for_pauseWait for pauseBRead-only
If awaiting_start, start the isolate (set breakpoints first). If paused, return the current snapshot. If running, block until Debugger.paused or timeout. Only one waiter is allowed per session.
Inputs: sessionId, timeoutMs.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Most tool groups are clearly separated by resource (breakpoints, sessions, stepping), but debug_continue, debug_resume, debug_wait_for_pause, and debug_pause have overlapping control-flow behavior that could cause an agent to pick the wrong one. The descriptions clarify the differences, but the boundaries are still somewhat subtle.
All tools use a consistent debug_ prefix with snake_case and a predictable verb_noun pattern (debug_set_breakpoint, debug_list_sessions, debug_get_variables). Phrasal verbs like debug_step_out and debug_wait_for_pause are still intuitive and fit the same scheme.
21 tools is on the heavy side, though the domain of a Node.js debugger naturally requires many operations. The count is justified by the breadth of lifecycle, breakpoint, stepping, and inspection features, but it is still more than the typical well-scoped MCP server.
The tool surface covers the core debugging lifecycle well: launch/attach, control, breakpoints, stepping, stack/variables, evaluation, output, and session management. Minor gaps exist such as no explicit conditional breakpoint support, exception breakpoint configuration, or source retrieval, but agents can accomplish most debugging workflows.
Maintenance
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
Agent Replay Debugger MCP — record every agent step + deterministic replay. Step-debugger for
A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides Node.js debugging capabilities with process management for AI agents, allowing them to start/stop Node.js processes, set breakpoints, step through code, and evaluate expressions.816MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to debug Node.js applications using Chrome DevTools Protocol. Provides comprehensive debugging capabilities including breakpoints, stepping, variable inspection, expression evaluation, and console monitoring.4,585 npm351MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that lets AI coding tools control and observe a running Node.js process through the chrome devtools protocol (CDP), via a lightweight Debug Adapter Protocol (DAP) bridge.29 npm2MIT
- AlicenseBqualityDmaintenanceMCP server for debugging Node.js programs through the V8 Inspector Protocol, allowing AI agents to set breakpoints, inspect variables, and step through code.117 npm5MIT