mcpField
M
MCP JS Debugger

MCP JS Debugger

Local
github.com/johngrimesDeveloper Tools2Updated 49w ago

About MCP JS Debugger

MCP JS Debugger is a debugging server for JavaScript and TypeScript developers. It controls CDP-compatible targets and uses source maps to locate original code.

Key features

  1. 01Connect to CDP-compatible targets
  2. 02Set, list, and remove breakpoints
  3. 03Step through and pause execution
  4. 04Inspect call stacks and scope variables
  5. 05Evaluate expressions and modify variables
  6. 06Map generated code to source locations

Use cases

  1. 01Debug runtime issues in Node.js applications
  2. 02Investigate breakpoints in Chrome or Edge
  3. 03Trace issues in transpiled TypeScript code

MCP support

The MCP server exposes CDP debugging operations as tools for MCP clients, including breakpoints, execution control, call stacks, expression evaluation, and variable operations.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"js-debugger": {
"command": "npx",
"args": [
"-y",
"mcp-js-debugger"
]
}
}
}
Run commandnpx -y mcp-js-debugger

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmcp-js-debugger

Tools

18

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
websocket_urlstringYesWebSocket URL for the CDP endpoint. For Node.js, this is typically ws://localhost:9229/{uuid}. For Chrome, use ws://localhost:9222/devtools/page/{pageId}. You can find available targets by visiting http://localhost:9229/json (Node.js) or http://localhost:9222/json (Chrome).
session_namestringNoOptional human-readable name for this debugging session. Useful when managing multiple concurrent sessions.

Details

From the project README

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

npm install
npm run build
Claude Code integration

Add to your Claude Code configuration:

claude mcp add mcp-js-debugger -- npx mcp-js-debugger

Or add to .mcp.json:

{
  "mcpServers": {
    "mcp-js-debugger": {
      "command": "npx",
      "args": ["mcp-js-debugger"]
    }
  }
}

Usage

Starting a debug target

Start your Node.js application with the inspector:

# Pause on first line (recommended for setting initial breakpoints)
node --inspect-brk=9229 your-script.js

# Or start without pausing
node --inspect=9229 your-script.js
Available tools
ToolDescription
connect_debuggerConnect to a CDP endpoint via WebSocket URL
disconnect_debuggerDisconnect from a debugging session
set_breakpointSet a breakpoint by URL and line number
remove_breakpointRemove a breakpoint by ID
list_breakpointsList all breakpoints in a session
resume_executionResume execution after pause
step_overStep over the current statement
step_intoStep into a function call
step_outStep out of the current function
pause_executionPause running execution
get_call_stackGet the current call stack with source locations
evaluate_expressionEvaluate a JavaScript expression
get_scope_variablesGet variables in a scope
set_variable_valueModify a variable's value
set_pause_on_exceptionsConfigure exception handling
get_original_locationMap generated to original source location
get_script_sourceGet script source code
list_scriptsList loaded scripts
Example workflow
  1. Start your application with --inspect-brk:

    node --inspect-brk=9229 app.js
    
  2. Get the WebSocket URL:

    curl http://localhost:9229/json
    
  3. Connect the debugger:

    connect_debugger(websocket_url: "ws://localhost:9229/<id>")
    
  4. Set breakpoints:

    set_breakpoint(session_id: "...", url: "file:///path/to/app.js", line_number: 10)
    
  5. Resume execution to hit the breakpoint:

    resume_execution(session_id: "...")
    
  6. 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")
    
  7. 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_location maps generated positions to original source
  • get_script_source can return original source content

Development

# Build
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Watch mode for development
npm run dev

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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.