Skip to main content
Glama

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

Related MCP server: MCP Debugger

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

Tool

Description

connect_debugger

Connect to a CDP endpoint via WebSocket URL

disconnect_debugger

Disconnect from a debugging session

set_breakpoint

Set a breakpoint by URL and line number

remove_breakpoint

Remove a breakpoint by ID

list_breakpoints

List all breakpoints in a session

resume_execution

Resume execution after pause

step_over

Step over the current statement

step_into

Step into a function call

step_out

Step out of the current function

pause_execution

Pause running execution

get_call_stack

Get the current call stack with source locations

evaluate_expression

Evaluate a JavaScript expression

get_scope_variables

Get variables in a scope

set_variable_value

Modify a variable's value

set_pause_on_exceptions

Configure exception handling

get_original_location

Map generated to original source location

get_script_source

Get script source code

list_scripts

List 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

Available Tools

18 tools
connect_debuggerA

Establishes a new debugging session by connecting to a Chrome DevTools Protocol (CDP) endpoint. Use this to connect to Node.js (started with --inspect), Chrome, Edge, or other CDP-compatible runtimes. Returns a session_id that must be used in all subsequent debugging operations.

Inputs: websocket_url (required), session_name.

disconnect_debuggerA

Closes an active debugging session and releases all resources. Any breakpoints set in the session will be removed.

Inputs: session_id (required).

evaluate_expressionA

Evaluates a JavaScript expression in the context of a specific call frame or global context. Use this to inspect variables, test expressions, or understand the program state. The expression is evaluated in the JavaScript runtime, so you can call methods, access properties, etc.

Inputs: session_id (required), expression (required), call_frame_id, return_by_value.

get_call_stackA

Retrieves the current call stack when execution is paused. Shows the chain of function calls that led to the current location, including function names, file locations, and scope information. If source maps are available, original source locations are included.

Inputs: session_id (required), include_async.

get_original_locationA

Maps a generated code location back to the original source location using source maps. Essential for debugging bundled or transpiled code (TypeScript, Babel, webpack, esbuild, etc.).

Inputs: session_id (required), script_id (required), line_number (required), column_number (required).

get_scope_variablesA

Retrieves all variables in a specific scope. Use this to see all local variables, closure variables, or global variables at a given point in execution.

Inputs: session_id (required), call_frame_id (required), scope_index.

get_script_sourceA

Retrieves the source code for a script. If source maps are available, can return the original source instead of the generated/bundled code.

Inputs: session_id (required), script_id (required), prefer_original.

list_breakpointsA

Lists all breakpoints set in a debugging session, including their locations and conditions.

Inputs: session_id (required).

list_scriptsA

Lists all scripts loaded in the debugging session. Includes source map information where available, showing which original sources are mapped.

Inputs: session_id (required), include_internal.

pause_executionA

Pauses execution at the next possible opportunity. Use this when the program is running and you want to inspect its state.

Inputs: session_id (required).

remove_breakpointA

Removes a previously set breakpoint. Use list_breakpoints to find breakpoint IDs.

Inputs: session_id (required), breakpoint_id (required).

resume_executionA

Resumes execution after being paused at a breakpoint or by pause_execution. Execution continues until the next breakpoint or the program ends.

Inputs: session_id (required).

set_breakpointB

Sets a breakpoint at a specific location in the code. The breakpoint will pause execution when the specified line is reached. You can set conditional breakpoints that only trigger when an expression evaluates to true.

Inputs: session_id (required), url (required), line_number (required), column_number, +1 more.

set_pause_on_exceptionsB

Configures whether the debugger should pause when exceptions are thrown. Useful for catching errors as they occur.

Inputs: session_id (required), state (required).

set_variable_valueA

Modifies the value of a variable in a specific call frame. Use this to test different scenarios or fix values during debugging.

Inputs: session_id (required), call_frame_id (required), scope_index (required), variable_name (required), +1 more.

step_intoA

Steps into a function call if the current line contains one, otherwise steps to the next statement. Use this to examine what happens inside a function. The session must be paused.

Inputs: session_id (required).

step_outA

Steps out of the current function and pauses at the calling code. Use this to quickly exit a function you've stepped into. The session must be paused.

Inputs: session_id (required).

step_overA

Steps over the current statement to the next line in the same function. If the current line contains a function call, the entire function executes without stepping into it. The session must be paused.

Inputs: session_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 18 tools

    Disambiguation5/5

    Each tool maps to a distinct debugging operation—session lifecycle, breakpoint management, stepping, execution control, state inspection, and source mapping—so there is no meaningful overlap between tools. Even similar stepping tools are clearly differentiated by whether they step over, into, or out of function calls.

    Naming Consistency5/5

    All tool names consistently follow a verb_noun pattern using clear, predictable verbs like connect, disconnect, set, remove, list, get, resume, pause, step, and evaluate. This makes the toolset easy to navigate and anticipate.

    Tool Count4/5

    At 18 tools, the server is slightly above the typical 3–15 sweet spot, but the count is well justified for a debugger covering session management, breakpoints, stepping, inspection, and source maps. The tools are organized around the complete debugging workflow rather than being redundant.

    Completeness5/5

    The toolset covers the full debugging lifecycle: connect/disconnect sessions, breakpoint CRUD, execution control, call stack and scope inspection, variable mutation, exception handling, and source map support. There are no obvious dead ends or missing operations for standard JavaScript debugging via CDP.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables 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 npm
      351
      MIT
    • A
      license
      A
      quality
      A
      maintenance
      Enables AI agents to perform step-through debugging of Python, JavaScript/Node.js, and Rust programs using the Debug Adapter Protocol, with support for breakpoints, variable inspection, and stack traces.
      29
      193
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Wraps Chrome DevTools Protocol to provide AI agents with low-level browser debugging tools including breakpoints, stack traces, stepping, network interception, and source maps.
      79 npm
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to debug code and automate browsers using Chrome DevTools Protocol, supporting breakpoints, variable inspection, and replayable interaction recording.
      35
      611 npm
      19
      MIT