Loading...
Loading...
MCP server for comprehensive Node.js debugging via Chrome DevTools Protocol with breakpoints, stepping, variable inspection, and source maps
npx skill4agent add aradotso/devtools-skills devtools-debugger-mcp-nodejsSkill by ara.so — Devtools Skills collection.
--inspect-brk=0thisnpm install devtools-debugger-mcpnpm install -g devtools-debugger-mcpclaude_desktop_config.json{
"mcpServers": {
"devtools-debugger": {
"command": "node",
"args": ["/path/to/devtools-debugger-mcp/dist/index.js"]
}
}
}{
"mcpServers": {
"devtools-debugger": {
"command": "devtools-debugger-mcp"
}
}
}textjsonboth// Via set_output_format tool (defaults to 'text')
{
"tool": "set_output_format",
"params": { "format": "json" }
}format// Launch Node.js script with inspector
{
"tool": "start_node_debug",
"params": {
"scriptPath": "/absolute/path/to/app.js",
"format": "text" // optional: 'text' | 'json' | 'both'
}
}pauseId{
"tool": "start_node_debug",
"params": {
"scriptPath": "/path/to/server.js",
"args": ["--port", "3000"],
"env": {
"NODE_ENV": "development",
"DEBUG": "*"
}
}
}{
"tool": "set_breakpoint",
"params": {
"filePath": "/path/to/app.js",
"line": 42
}
}{
"tool": "set_breakpoint_condition",
"params": {
"filePath": "/path/to/users.js",
"line": 15,
"condition": "user.age > 18"
}
}{
"tool": "set_breakpoint_condition",
"params": {
"urlRegex": ".*express.*",
"line": 100,
"condition": "req.method === 'POST'"
}
}{
"tool": "add_logpoint",
"params": {
"filePath": "/path/to/api.js",
"line": 28,
"message": "Request received: {req.url}"
}
}{
"tool": "set_exception_breakpoints",
"params": {
"state": "uncaught" // 'none' | 'uncaught' | 'all'
}
}{
"tool": "resume_execution",
"params": {
"includeScopes": true,
"includeStack": true,
"includeConsole": true,
"format": "text"
}
}{
"tool": "step_over",
"params": {
"includeScopes": true,
"includeConsole": true
}
}{
"tool": "step_into",
"params": {
"includeStack": true
}
}{
"tool": "step_out",
"params": {
"includeScopes": true
}
}{
"tool": "continue_to_location",
"params": {
"filePath": "/path/to/app.js",
"line": 55,
"column": 10 // optional
}
}{
"tool": "inspect_scopes",
"params": {
"maxProps": 20, // max properties per object
"pauseId": "pause123", // optional, defaults to current
"frameIndex": 0, // optional, defaults to 0 (top frame)
"includeThisPreview": true,
"format": "text"
}
}// First get objectId from inspect_scopes or evaluate_expression
{
"tool": "get_object_properties",
"params": {
"objectId": "object:123",
"maxProps": 50
}
}{
"tool": "evaluate_expression",
"params": {
"expr": "user.profile.email",
"pauseId": "pause123", // optional
"frameIndex": 0, // optional, which frame to eval in
"returnByValue": true, // optional, serialize result
"format": "json"
}
}{
"tool": "evaluate_expression",
"params": {
"expr": "items.push({ id: 5, name: 'test' }); items.length"
}
}{
"tool": "list_call_stack",
"params": {
"depth": 10, // optional, max frames
"pauseId": "pause123", // optional
"includeThis": true, // optional, include 'this' preview
"format": "text"
}
}{
"tool": "get_pause_info",
"params": {
"pauseId": "pause123", // optional, defaults to current
"format": "text"
}
}{
"tool": "read_console",
"params": {
"format": "text"
}
}includeConsole: true{
"tool": "stop_debug_session"
}{
"tool": "list_scripts"
}// By scriptId
{
"tool": "get_script_source",
"params": {
"scriptId": "42"
}
}
// By URL
{
"tool": "get_script_source",
"params": {
"url": "file:///path/to/app.js"
}
}{
"tool": "blackbox_scripts",
"params": {
"patterns": [
"node_modules/express/*",
"internal/*"
]
}
}{
"tool": "restart_frame",
"params": {
"frameIndex": 2, // which frame to restart (0 = top)
"pauseId": "pause123", // optional
"format": "text"
}
}{
"tool": "start_node_debug",
"params": {
"scriptPath": "/path/to/dist/app.js"
}
}
// Set breakpoints using original .ts file paths
{
"tool": "set_breakpoint",
"params": {
"filePath": "/path/to/src/app.ts",
"line": 42
}
}// 1. Start session
start_node_debug({ scriptPath: "/path/to/app.js" })
// 2. Set conditional breakpoint
set_breakpoint_condition({
filePath: "/path/to/app.js",
line: 25,
condition: "count > 100"
})
// 3. Resume until condition met
resume_execution({ includeScopes: true, includeConsole: true })
// 4. Inspect when paused
inspect_scopes({ maxProps: 15 })
evaluate_expression({ expr: "count" })
// 5. Continue
resume_execution()// Resume with console capture
const result = await resume_execution({ includeConsole: true });
// Or read explicitly
const consoleOutput = await read_console({ format: "text" });// Get full call stack
list_call_stack({ depth: 20, includeThis: true })
// Inspect different frames
inspect_scopes({ frameIndex: 0 }) // Current frame
inspect_scopes({ frameIndex: 1 }) // Caller frame
inspect_scopes({ frameIndex: 2 }) // Caller's caller
// Evaluate in different frame context
evaluate_expression({ expr: "localVar", frameIndex: 1 })// Pause on all exceptions
set_exception_breakpoints({ state: "all" })
// Resume and wait for exception
const result = await resume_execution({ includeStack: true })
// When paused on exception:
get_pause_info() // Shows exception details
list_call_stack({ depth: 10 })
inspect_scopes({ maxProps: 20 })// 1. Start debugging an Express server
{
"tool": "start_node_debug",
"params": {
"scriptPath": "/path/to/server.js",
"env": {
"PORT": "3000",
"NODE_ENV": "development"
}
}
}
// 2. Set breakpoint in route handler
{
"tool": "set_breakpoint",
"params": {
"filePath": "/path/to/routes/users.js",
"line": 15
}
}
// 3. Set logpoint to track requests
{
"tool": "add_logpoint",
"params": {
"filePath": "/path/to/middleware/auth.js",
"line": 8,
"message": "Auth check for user: {req.user.id}"
}
}
// 4. Pause only on errors
{
"tool": "set_exception_breakpoints",
"params": { "state": "uncaught" }
}
// 5. Resume and make HTTP request (externally)
{
"tool": "resume_execution",
"params": {
"includeScopes": true,
"includeConsole": true
}
}
// 6. When paused at breakpoint, inspect request
{
"tool": "evaluate_expression",
"params": {
"expr": "req.body",
"returnByValue": true
}
}
{
"tool": "evaluate_expression",
"params": {
"expr": "req.headers['authorization']"
}
}
// 7. Check database query in scope
{
"tool": "inspect_scopes",
"params": { "maxProps": 30 }
}
// 8. Step into database function
{
"tool": "step_into",
"params": { "includeStack": true }
}
// 9. Continue execution
{
"tool": "resume_execution"
}
// 10. Stop when done
{
"tool": "stop_debug_session"
}// app.js
async function fetchUserData(userId) {
const user = await db.findUser(userId);
const posts = await db.findPosts(user.id);
return { user, posts };
}
// Debugging session:
// 1. Start
start_node_debug({ scriptPath: "/path/to/app.js" })
// 2. Break at async function
set_breakpoint({ filePath: "/path/to/app.js", line: 2 })
// 3. Resume to breakpoint
resume_execution({ includeScopes: true })
// 4. Check userId parameter
evaluate_expression({ expr: "userId" })
// 5. Step over await (resumes until promise resolves)
step_over({ includeScopes: true, includeConsole: true })
// 6. Inspect resolved user object
evaluate_expression({ expr: "user" })
get_object_properties({ objectId: "object:user123", maxProps: 20 })
// 7. Continue
resume_execution()filePathfile://// ✅ Correct
set_breakpoint({ filePath: "/home/user/project/src/app.js", line: 42 })
// ❌ Wrong (relative path)
set_breakpoint({ filePath: "./src/app.js", line: 42 })start_node_debugscriptPathconsole.log('test')// Test with minimal script
start_node_debug({ scriptPath: "/tmp/test.js" })
// test.js content: console.log('Hello');list_scripts// List all scripts to find exact URL
list_scripts()
// Use URL regex instead of file path
set_breakpoint_condition({
urlRegex: ".*app\\.js$",
line: 42
})"sourceMap": true.map// If TypeScript breakpoints fail, use compiled JS path
set_breakpoint({ filePath: "/path/to/dist/app.js", line: 58 })maxPropsget_object_propertiesevaluate_expression// Get more properties
inspect_scopes({ maxProps: 100 })
// Or drill into specific object
evaluate_expression({ expr: "largeObject.specificProperty" })includeConsole: trueread_console// Include console in step
step_over({ includeConsole: true })
// Or read explicitly
read_console({ format: "text" })stop_debug_sessionps aux | grep node# Kill orphaned debugger processes
pkill -f "node --inspect-brk"set_exception_breakpointsget_pause_info// Check why paused
get_pause_info({ format: "text" })
// Disable exception breaks if too noisy
set_exception_breakpoints({ state: "none" })includeScopesincludeStackincludeConsoleblackbox_scriptsstate: 'uncaught'stop_debug_sessionpauseIdframeIndex{
"tool": "start_node_debug",
"params": {
"scriptPath": "/path/to/app.js",
"env": {
"DATABASE_URL": process.env.DATABASE_URL,
"API_KEY": process.env.API_KEY,
"NODE_ENV": "development"
}
}
}.env