Enables debugging of Node.js applications through the Chrome DevTools Protocol, allowing breakpoint management, code stepping, call stack inspection, variable examination, and expression evaluation with source map support for transpiled code.
MCP JS Debugger
An MCP (Model Context Protocol) server that exposes Chrome DevTools Protocol debugging capabilities, enabling AI assistants to debug JavaScript and TypeScript applications.
Features
Connect to any CDP-compatible debugger (Node.js, Chrome, Edge)
Set, list, and remove breakpoints
Step through code (over, into, out)
Inspect call stacks with source map support
Evaluate expressions in any stack frame
View and modify variables
Pause on exceptions
Full source map support for debugging transpiled code
Installation
Claude Code integration
Add to your Claude Code configuration:
Or add to .mcp.json:
Usage
Starting a debug target
Start your Node.js application with the inspector:
Available tools
Tool | Description |
| Connect to a CDP endpoint via WebSocket URL |
| Disconnect from a debugging session |
| Set a breakpoint by URL and line number |
| Remove a breakpoint by ID |
| List all breakpoints in a session |
| Resume execution after pause |
| Step over the current statement |
| Step into a function call |
| Step out of the current function |
| Pause running execution |
| Get the current call stack with source locations |
| Evaluate a JavaScript expression |
| Get variables in a scope |
| Modify a variable's value |
| Configure exception handling |
| Map generated to original source location |
| Get script source code |
| List loaded scripts |
Example workflow
Start your application with
--inspect-brk:node --inspect-brk=9229 app.jsGet the WebSocket URL:
curl http://localhost:9229/jsonConnect the debugger:
connect_debugger(websocket_url: "ws://localhost:9229/<id>")Set breakpoints:
set_breakpoint(session_id: "...", url: "file:///path/to/app.js", line_number: 10)Resume execution to hit the breakpoint:
resume_execution(session_id: "...")Inspect state when paused:
get_call_stack(session_id: "...") get_scope_variables(session_id: "...", call_frame_id: "...", scope_index: 0) evaluate_expression(session_id: "...", expression: "myVariable")Continue debugging:
step_over(session_id: "...") resume_execution(session_id: "...")
Source map support
The server automatically loads source maps for transpiled code (TypeScript, bundled JavaScript, etc.). When source maps are available:
Call stacks show original source locations
Breakpoints can be set on original source files
get_original_locationmaps generated positions to original sourceget_script_sourcecan return original source content
Development
Architecture
cdp-client.ts - Low-level Chrome DevTools Protocol client wrapper
session-manager.ts - Manages multiple debugging sessions
source-map-manager.ts - Handles source map loading and position mapping
server.ts - MCP server implementation with tool handlers
types.ts - TypeScript type definitions
Requirements
Node.js 18.0.0 or later
A CDP-compatible debug target (Node.js, Chrome, Edge, etc.)
Licence
Apache-2.0