Skip to main content
Glama
debugtron-mcp
by xrntkk

debugtron-mcp

An MCP server that lets AI agents debug installed Electron apps end-to-end: discover apps, launch them with debug ports, evaluate JavaScript in the main process and renderer pages, capture console/IPC/network traffic, take screenshots, simulate input, profile CPU and heap, set breakpoints, read script sources, and inspect workers.

App discovery and launch adapters are vendored from debugtron (MIT); the debugging surface (Chrome DevTools Protocol + Node inspector) is exposed as 40+ MCP tools.

Requirements

  • Node.js >= 22

  • macOS / Windows / Linux (remote Android debugging via adb is supported by the underlying adapters but currently limited to page-level CDP)

Related MCP server: @nebula-agents/electron-mcp

Build

yarn install
yarn build        # outputs dist/index.js (single-file ESM bundle)
yarn typecheck    # optional

Usage

Register with your MCP client over stdio. For Claude Code:

claude mcp add debugtron -- node /path/to/debugtron-mcp/dist/index.js

Or explore interactively with the MCP inspector:

npx @modelcontextprotocol/inspector node dist/index.js

Typical agent session

  1. list_apps — discover installed Electron apps

  2. launch_app — launch one (by appId or direct exePath), get a sessionId

  3. list_pages — find renderer windows/webviews/workers (retry until they appear)

  4. evaluate_in_main / evaluate_in_renderer — run JS in either process

  5. get_console_logs / get_network_log / get_process_logs — observe behavior

  6. get_response_body / get_cookies / get_local_storage — inspect network/state

  7. screenshot / click / type / navigate — drive the UI

  8. monitor_ipc + get_ipc_log — capture IPC traffic

  9. monitor_events + get_event_log — capture lifecycle/navigation/crash events

  10. list_scripts + get_script_source — read app bundles for static analysis

  11. set_breakpoint / evaluate_on_call_frame / step_over — debug at source level

  12. get_heap_snapshot / start_cpu_profile — deep performance diagnostics

  13. list_workers / evaluate_in_worker — debug service/shared/dedicated workers

  14. stop_session — terminate the app and clean up

Tools

Sessions & discovery

Tool

Description

list_apps

Discover installed Electron apps (targetId?, refresh?)

launch_app

Launch an app with --inspect + --remote-debugging-port (appId? or exePath?, env?, cwd?)

stop_session

Close CDP connections and terminate the app (idempotent)

list_sessions

List active sessions with status and ports

list_pages

List renderer targets: pages, webviews, workers

get_process_logs

App process stdout/stderr (works after exit)

Execution & observation

Tool

Description

evaluate_in_main

Run JS in the Electron main process (Node inspector)

evaluate_in_renderer

Run JS in a renderer page (CDP Runtime.evaluate)

get_console_logs

Console messages + uncaught exceptions from main and pages

get_network_log

Network requests captured per page (includes requestId)

get_response_body

Get the response body of a captured request by requestId

get_cookies

Read all cookies from the browser network stack (incl HttpOnly)

get_local_storage

Read localStorage or sessionStorage entries

get_app_info

Electron/Chromium/Node versions, app paths, BrowserWindow list

get_process_metrics

Per-process CPU% and memory (app.getAppMetrics)

Page control & DOM

Tool

Description

navigate / reload

Page navigation (waits for load event, non-fatal)

screenshot

PNG/JPEG screenshot returned as MCP image content

get_dom_snapshot

outerHTML of the document or a selector (truncatable)

query_selector

Element tag/text/attributes/bounding rect by CSS selector

click / type

Input simulation by selector or coordinates (unicode-safe)

get_performance_metrics

Renderer metrics: JS heap, DOM nodes, layout counts

Electron-specific

Tool

Description

monitor_ipc / get_ipc_log

Capture IPC traffic (ipcMain send/invoke, webContents.send)

monitor_events / get_event_log

Capture lifecycle events (crashes, unresponsive, navigation, window creation)

Debugging & profiling

Tool

Description

list_scripts

List parsed scripts (filter by URL substring)

get_script_source

Read script source by scriptId (for static analysis of app.asar bundles)

set_breakpoint / remove_breakpoint / list_breakpoints

Breakpoints by script URL or regex, main or renderer

pause / resume / get_paused_state

Execution control and paused call-stack inspection

evaluate_on_call_frame

Evaluate in a paused frame context (access local variables)

step_over / step_into / step_out

Single-step execution

get_heap_snapshot

V8 heap snapshot written to a .heapsnapshot file

start_cpu_profile / stop_cpu_profile

CPU profile to .cpuprofile + hottest-functions summary

Workers

Tool

Description

list_workers

List service workers, shared workers, dedicated workers (Target domain)

evaluate_in_worker

Run JS in a worker target via the flatten protocol

Heap snapshots and CPU profiles are written to files (default: system temp dir, override with filePath) and can be opened in Chrome DevTools.

Notes & limitations

  • Single-instance lock: apps using requestSingleInstanceLock (e.g. VS Code) must be fully closed before launch_app; otherwise the second instance forwards to the running one and the debug flags are dropped. The tool error message tells you when this happens.

  • Pages appear asynchronously: retry list_pages for a few seconds after launch.

  • monitor_ipc captures send messages on ipcMain at any time, but invoke handlers only if they were registered after monitoring started (Electron dispatches handle() internally, not through the emitter).

  • Breakpoints on inline scripts (e.g. inside data: URLs) don't bind; use them on real script files (file://.../app.asar/..., http(s)://...).

  • Workers are discovered via the browser-level Target domain (separate from /json). Some older Electron versions may not expose all worker types.

  • Diagnostics are written to stderr; stdout is reserved for the MCP protocol.

Acknowledgements

  • Target discovery/launch adapters (src/targets/) and the AppInfo type are vendored from debugtron by Rongjian Zhang (MIT License).

License

MIT

Available Tools

44 tools
clickA

Click in a renderer page, either by CSS selector (scrolled into view, clicked at its center) or by raw CSS-pixel coordinates.

Inputs: pageId (required), sessionId (required), x, y, +1 more.

evaluate_in_mainA

Evaluate a JavaScript expression in the app's main (Node/Electron) process via the inspector protocol. Electron APIs like require('electron').app or BrowserWindow are available.

Inputs: sessionId (required), expression (required), awaitPromise.

evaluate_in_rendererA

Evaluate a JavaScript expression in a renderer page via CDP. Use list_pages to find page ids.

Inputs: pageId (required), sessionId (required), expression (required), awaitPromise.

evaluate_in_workerA

Evaluate a JavaScript expression in a worker target (service worker, shared worker, dedicated worker) using the flatten protocol. Get workerTargetId from list_workers.

Inputs: sessionId (required), expression (required), workerTargetId (required), awaitPromise.

evaluate_on_call_frameA

Evaluate an expression in the context of a paused call frame (access local variables). Requires the target to be paused — get callFrameId from get_paused_state.

Inputs: sessionId (required), expression (required), callFrameId (required), pageId.

get_app_infoA

Get Electron app details from the main process: Electron/Chromium/Node versions, app name/version, standard paths (userData etc.), and the list of BrowserWindows with title, URL and bounds.

Inputs: sessionId (required).

get_console_logsB

Get console messages and uncaught exceptions captured from the main process and renderer pages (console.* calls, CDP log entries).

Inputs: sessionId (required), tail, level, pageId.

get_cookiesA

Get cookies from the browser network stack visible to a page (Network.getAllCookies). Includes HttpOnly cookies that document.cookie cannot see.

Inputs: pageId (required), sessionId (required), urlFilter.

get_dom_snapshotA

Get the outerHTML of a renderer page (or of a specific element via selector). Truncated to maxLength characters.

Inputs: pageId (required), sessionId (required), selector, maxLength.

get_event_logA

Read Electron lifecycle events captured by monitor_events (crashes, hangs, navigation, window/webContents lifecycle). Optionally clears the buffer after reading.

Inputs: sessionId (required), tail, clear.

get_heap_snapshotA

Take a V8 heap snapshot of the main process or a renderer page. The snapshot can be large, so it is written to a .heapsnapshot file (loadable in Chrome DevTools Memory panel); the file path is returned.

Inputs: sessionId (required), pageId, filePath.

get_ipc_logA

Read IPC traffic captured by monitor_ipc. Optionally clears the buffer after reading.

Inputs: sessionId (required), tail, clear.

get_local_storageB

Read localStorage or sessionStorage entries of a renderer page.

Inputs: pageId (required), sessionId (required), storageType.

get_network_logA

Get network requests captured from renderer pages (Network domain). A page's requests are recorded once any page tool has attached to it. Entries include requestId for get_response_body.

Inputs: sessionId (required), tail, pageId, urlFilter.

get_paused_stateA

Get the current paused state (reason + call stack with callFrameIds) of the main process or a renderer page, if it is paused on a breakpoint or Debugger.pause.

Inputs: sessionId (required), pageId.

get_performance_metricsB

Get renderer performance metrics (Performance.getMetrics): JS heap size, DOM node count, layout/recalc counts, timestamps, etc.

Inputs: pageId (required), sessionId (required).

get_process_logsC

Get the app process stdout/stderr output captured since launch. Works even after the process has exited.

Inputs: sessionId (required), tail.

get_process_metricsA

Get per-process CPU and memory metrics of the app (app.getAppMetrics): Browser (main), renderer, GPU and utility processes with pid, CPU % and working set size.

Inputs: sessionId (required).

get_response_bodyA

Get the response body of a captured network request. Use get_network_log to find requestIds. Only works for requests whose loading has finished while a page client was attached.

Inputs: pageId (required), requestId (required), sessionId (required).

get_script_sourceB

Get the source code of a script by scriptId (from list_scripts). Useful for static analysis of app.asar bundles.

Inputs: scriptId (required), sessionId (required), pageId, maxLength.

launch_appA

Launch an Electron app with debug ports (--inspect for the main process, --remote-debugging-port for renderers) and create a debug session. Provide either appId (from list_apps) or a direct exePath. Returns the sessionId and debug ports.

Inputs: cwd, env, appId, exePath, +1 more.

list_appsA

List installed Electron apps discovered on a target (local machine by default). Returns app id, name and executable path. Use the app id with launch_app.

Inputs: refresh, targetId.

list_breakpointsA

List breakpoints set via this server on the main process or a renderer page.

Inputs: sessionId (required), pageId.

list_pagesA

Refresh and list the debuggable targets of a session: renderer pages, webviews, workers, service workers. Pages can take a few seconds to appear after launch — retry if empty. Page-only tools (screenshot, DOM, input) do not work on worker targets.

Inputs: sessionId (required).

list_scriptsA

List scripts known to the Debugger domain (collected via scriptParsed). Use urlFilter to narrow down, then get_script_source to read source code.

Inputs: sessionId (required), pageId, urlFilter.

list_sessionsA

List active debug sessions with their app, status and debug ports.

Inputs: no named parameters.

list_workersA

List worker targets (service workers, shared workers, dedicated workers) discovered via the browser-level Target domain. Use evaluate_in_worker to run JS in them.

Inputs: sessionId (required).

monitor_eventsA

Start or stop capturing Electron lifecycle events in the main process: render-process-gone (crashes), unresponsive, navigation (did/will-navigate, redirects), window and webContents creation, child-process-gone. Read with get_event_log.

Inputs: action (required), sessionId (required).

monitor_ipcA

Start or stop IPC monitoring in the main process. Captures ipcMain messages (send/invoke) and webContents.send traffic into a buffer; read it with get_ipc_log. Note: invoke handlers registered before monitoring started are not captured (Electron dispatches them internally); 'send' messages are always captured.

Inputs: action (required), sessionId (required).

pauseA

Pause execution at the next statement in the main process or a renderer page.

Inputs: sessionId (required), pageId.

query_selectorA

Query a single element by CSS selector in a renderer page. Returns tag name, text, attributes and bounding rect.

Inputs: pageId (required), selector (required), sessionId (required).

reloadC

Reload a renderer page.

Inputs: pageId (required), sessionId (required), ignoreCache.

remove_breakpointA

Remove a breakpoint previously set with set_breakpoint.

Inputs: sessionId (required), breakpointId (required), pageId.

resumeA

Resume execution after a pause or breakpoint hit.

Inputs: sessionId (required), pageId.

screenshotB

Capture a screenshot of a renderer page. Returns a PNG (default) or JPEG image.

Inputs: pageId (required), sessionId (required), format, quality.

set_breakpointA

Set a breakpoint by script URL or URL regex in the main process or a renderer page. Works on bundled scripts too — use urlRegex to match a distinctive part of the script path (e.g. "app.asar.*main"). Use get_paused_state to observe hits.

Inputs: sessionId (required), lineNumber (required), url, pageId, +3 more.

start_cpu_profileA

Start CPU profiling on the main process or a renderer page. Call stop_cpu_profile to collect the result.

Inputs: sessionId (required), pageId.

step_intoB

Step into the current function call while paused. Use get_paused_state to observe the new location.

Inputs: sessionId (required), pageId.

step_outA

Step out of the current function while paused. Use get_paused_state to observe the new location.

Inputs: sessionId (required), pageId.

step_overA

Step over the current statement while paused. Use get_paused_state to observe the new location.

Inputs: sessionId (required), pageId.

stop_cpu_profileA

Stop CPU profiling and collect the profile. The full profile is written to a .cpuprofile file (loadable in Chrome DevTools Performance panel); a summary of the hottest functions is returned inline.

Inputs: sessionId (required), top, pageId, filePath.

stop_sessionA

Stop a debug session: close CDP connections and terminate the app process. Safe to call twice.

Inputs: sessionId (required).

typeA

Type text into a renderer page. If a selector is given, the element is clicked first to focus it. Uses Input.insertText, which is unicode-safe (CJK, emoji).

Inputs: text (required), pageId (required), sessionId (required), selector.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 44 tools

    Disambiguation5/5

    Each tool targets a specific context or action (e.g., evaluate_in_main vs evaluate_in_renderer, monitor_events vs monitor_ipc), with clear boundaries between DOM, network, debugging, and profiling tools. No two tools overlap in purpose.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern using underscores, such as get_dom_snapshot, list_pages, set_breakpoint, and stop_cpu_profile. There are no deviations or mixed conventions.

    Tool Count4/5

    44 tools is high but justified by the broad scope of Electron debugging (main process, renderer, workers, profiling, IPC, network). The count is appropriate for a comprehensive debugger, though a few utilities might be consolidated.

    Completeness5/5

    The tool set covers the full lifecycle of debugging: launch, navigation, DOM inspection, network, console, process logs, breakpoints, stepping, profiling, heap snapshots, and IPC monitoring. There are no obvious gaps for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers