debugtron-mcp
MCP server for debugging Electron apps: discover, launch, and control apps via Chrome DevTools Protocol and Node inspector, enabling JavaScript evaluation, network/console monitoring, screenshots, profiling, and breakpoints.
README
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
adbis supported by the underlying adapters but currently limited to page-level CDP)
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
list_apps— discover installed Electron appslaunch_app— launch one (byappIdor directexePath), get asessionIdlist_pages— find renderer windows/webviews/workers (retry until they appear)evaluate_in_main/evaluate_in_renderer— run JS in either processget_console_logs/get_network_log/get_process_logs— observe behaviorget_response_body/get_cookies/get_local_storage— inspect network/statescreenshot/click/type/navigate— drive the UImonitor_ipc+get_ipc_log— capture IPC trafficmonitor_events+get_event_log— capture lifecycle/navigation/crash eventslist_scripts+get_script_source— read app bundles for static analysisset_breakpoint/evaluate_on_call_frame/step_over— debug at source levelget_heap_snapshot/start_cpu_profile— deep performance diagnosticslist_workers/evaluate_in_worker— debug service/shared/dedicated workersstop_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 beforelaunch_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_pagesfor a few seconds after launch. monitor_ipccapturessendmessages onipcMainat any time, butinvokehandlers only if they were registered after monitoring started (Electron dispatcheshandle()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 theAppInfotype are vendored from debugtron by Rongjian Zhang (MIT License).
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。