Electron Debug MCP Server
Provides debugging capabilities for Electron applications, including process management, Chrome DevTools Protocol integration for inspecting targets, executing JavaScript, and controlling application execution.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Electron Debug MCP Serverlist running Electron processes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🌟 Overview
Electron Debug MCP is a local MCP server that gives AI coding agents eyes, hands, and Chrome DevTools inside your Electron app.
Instead of guessing from source alone, the agent can:
🎯 Goal | 🛠️ How |
Boot your app under a debugger |
|
Hook an app you already launched |
|
See the UI |
|
Read renderer failures |
|
Stream console live |
|
Inspect markup |
|
Run JS in the page |
|
Run JS in main |
|
Cookies & web storage |
|
Watch network |
|
Drive the UI |
|
Perf deep-dive |
|
One-shot health check |
|
Full DevTools power |
|
It speaks MCP over stdio (Cursor / Claude Desktop friendly), bridges to Chrome DevTools Protocol, buffers console + network on monitored page targets, and keeps stdout clean (all server logs go to stderr).
👤 Who it’s for
🧑💻 Cursor / Claude users pair-programming on Electron desktop apps
🐛 Maintainers tired of “white screen / silent exception” bugs agents can’t see
🧰 Tooling authors who need a stdio MCP ↔ CDP bridge for Electron/Chromium
💬 Example things you can ask the agent
“Start
D:/apps/my-appon port 9222 and tell me if the renderer threw on boot.”
“Find my running Electron app, attach by PID, screenshot#sidebar, and dump localStorage.”
“Type into
“Start a CDP trace, click through settings, stop tracing, and save the JSON.”
“Diagnose why this Electron window is blank.”
📊 At a glance
Aspect | Details |
🔌 Transport | MCP stdio JSON-RPC |
🧬 Debug bridge | Chrome DevTools Protocol (Runtime · Page · Network · Debugger · Input · Log · Tracing) |
🚀 App control | Spawn Electron or attach by port / PID / process scan |
📦 Surface area | 36 tools · 6 resources · 3 prompts · logging + resource list-changed |
🖥️ Platforms | Windows · macOS · Linux (CI: Xvfb + no-sandbox) |
📦 Requires | Node ≥ 18, npm, one-time Electron binary download |
🛡️ Safety | Optional |
✅ Verify |
|
✅ Status
🟢 Ready for local agent-driven Electron debugging
🟢 E2E smoke: start → UI/automation → storage/cookies → tracing → find/attach-by-pid → stop
🟢 Windows binary repair:
scripts/fix-electron.cmdwhen npm blocks postinstall🟢 v1.5.0 — element screenshots, cookies/storage, tracing, attach-by-pid
🟢 Built on TypeScript 7 (native Go compiler) — ~10x faster builds
Related MCP server: Electron Native MCP Server
📖 Table of contents
✨ Why this exists
Electron bugs are often invisible to coding agents:
😣 Pain | 🙈 What agents usually see | 👁️ What this server adds |
Blank / white window | Source files only | Live screenshot + DOM (+ element clip) |
Silent renderer crash | Nothing | Console + exception buffer (+ live stream) |
Failed API calls | Guesswork | Network event log |
Wrong route / URL | Unknown | page_info / |
UI not responding | Can't interact | click / type_text / press_key / wait_for |
Auth / state bugs | Blind | cookies + localStorage/sessionStorage |
Perf jank | Guesswork | CDP tracing export |
App already running | Manual port hunt | find_apps / attach_by_pid |
Need DevTools power | Manual only | Full cdp_command escape hatch |
🚀 Feature tour
🔌 Lifecycle
▶️
start_app— launch with remote debugging (+ optionalinspectMain)🔗
attach— connect to an existing debug port🆔
attach_by_pid— resolve port from process argv🧭
find_apps— list Electron PIDs + debug ports🔎
discover_apps— scan local CDP ports⏹️
stop_app— kill owned / detach attached📋
list_apps— sessions, ports, buffer counts🩺
diagnose— port health + recent errors
🔍 Inspection
📸
screenshot/ 💾save_screenshot— full page or selector clip🌳
get_dom/query_selector🧮
evaluate/evaluate_main🍪
get_cookies/set_cookie🗄️
get_storage/set_storage🧾
get_console_messages— log/warn/error/exceptions🌐
get_network_log— request/response/fail📜
get_logs— Electron stdout/stderr🎯
list_targets/page_info
🖱️ Interaction
🧭
navigate+ load wait⏳
wait_for— selector / hidden / enabled / count / text / URL / console🖱️
clickleft/right/middle⌨️
type_text(+ clear / Enter) ·press_key(+ modifiers)🔄
reload· ⏸️pause· ▶️resume🧹
clear_buffers
🧠 Agent UX & power
📝 MCP handshake instructions
💬 Prompts: blank window · exceptions · UI smoke
🏷️ Target roles: page / worker / browser / main
🔔
set_console_live+ resource list-changed📈
start_tracing/stop_tracing🛡️ stderr-only diagnostics (stdio-safe)
🧰
cdp_commandfor any DevTools method
⚡ 60-second quick start
git clone https://github.com/amafjarkasi/electron-mcp-server.git
cd electron-mcp-server
npm install
npm run ensure-electron
npm run build
npm test🪟 Windows binary missing?
If npm warns about allowScripts / Electron postinstall:
.\scripts\fix-electron.cmdThat reinstalls Electron, extracts electron.exe with system tar, then runs tests.
🖥️ Cursor & Claude Desktop setup
Cursor
npm run buildOpen Cursor → MCP settings
Add (use your absolute path):
Windows
{
"mcpServers": {
"electron-debug": {
"command": "node",
"args": ["C:/Users/you/code/electron-mcp-server/build/index.js"]
}
}
}macOS / Linux
{
"mcpServers": {
"electron-debug": {
"command": "node",
"args": ["/Users/you/code/electron-mcp-server/build/index.js"],
"env": {
"ELECTRON_MCP_NO_SANDBOX": "1"
}
}
}
}Restart Cursor
Confirm tools:
start_app,attach,find_apps,screenshot,get_console_messages,click,start_tracing, …
📄 Template: examples/cursor-mcp.json
Claude Desktop
Same mcpServers block in claude_desktop_config.json, pointing at build/index.js. Edit the file at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
📄 Template: examples/claude-desktop-config.json
⚠️ Don’t run
node build/index.jsin a normal terminal for daily use — it waits on stdio for an MCP client. Let Cursor/Claude spawn it.
🧩 How it works
┌──────────────────────────┐
│ Cursor / Claude / MCP │
│ client (agent) │
└────────────┬─────────────┘
│ stdio JSON-RPC
▼
┌──────────────────────────┐
│ Electron Debug MCP │
│ 🛠️ tools (36) │
│ 📡 resources │
│ 💬 prompts │
│ 📣 logging / list-changed│
└────────────┬─────────────┘
│ spawn / attach / PID resolve
│ CDP WebSocket
▼
┌──────────────────────────┐
│ Electron application │
│ --remote-debugging-port │
│ Runtime·Page·Network·… │
│ optional --inspect (main)│
└──────────────────────────┘After start_app / attach / attach_by_pid, page targets get Runtime / Log / Network / Page enabled so console + network events keep buffering between tool calls.
Finding a running app
find_apps— OS process scan (Electron PIDs +--remote-debugging-portfrom argv)discover_apps— HTTP probe of local CDP ports (/json/version,/json/list)attach/attach_by_pid— open a managed session (detach-only onstop_app)
🗂️ Complete tools cheatsheet
Category | Tools |
🚀 Lifecycle |
|
🔍 Inspect |
|
🖱️ Interact |
|
🧰 Power |
|
🛠️ Tools reference (all options)
All APIs below are MCP tools. Schemas match the live Zod definitions in src/index.ts.
🚀 Lifecycle
start_app
Launch Electron with remote debugging.
Param | Type | Req | Default | Description |
| string | ✅ | — | App directory or main script |
| int | ❌ | random | CDP port |
| string[] | ❌ |
| Extra CLI flags |
| bool | ❌ |
| Pass |
Auto flags: --remote-debugging-port, --enable-logging, --disable-gpu, and --no-sandbox when ELECTRON_MCP_NO_SANDBOX=1 / CI=true / no DISPLAY.
Returns: id, pid, debugPort, targets, attached: false, …
attach
Param | Type | Req | Description |
| int | ✅ | Existing DevTools port |
| string | ❌ | Friendly session name |
stop_app on attached sessions detaches only (does not kill the external app).
attach_by_pid
Attach by OS process id. Resolves --remote-debugging-port from the process command line (Linux/macOS/ps, Windows PowerShell). Falls back to listening sockets owned by the PID on Linux when needed.
Param | Type | Req | Description |
| int | ✅ | Electron main process id |
| string | ❌ | Friendly session name |
Tip: Prefer the main process PID from find_apps (helpers with --type=renderer / gpu-process are filtered unless they expose a debug port).
find_apps
List running Electron-like processes.
Returns: { apps: [{ pid, command, debugPort?, inspectPort?, likelyElectron }], count }
Use this when you launched the app yourself and don’t remember the port.
discover_apps
Param | Type | Default |
| int |
|
| int |
|
HTTP-probes each port for Chromium/Electron DevTools (/json/version + /json/list).
stop_app — { processId }
list_apps — no params
diagnose — optional { processId } (omit = all sessions)
diagnose reports port reachability, target role counts, recent console errors, and monitoring state.
🔍 Inspection
screenshot / save_screenshot
Param | Type | Default | Description |
| string ✅ | — | Session id |
| string | first page | CDP page target |
|
|
| Image format |
| int | — | JPEG only |
| string | — | Element clip — capture only that node’s bounding box |
| string ✅ ( | — | File path to write |
screenshot returns MCP image content (+ JSON meta including clip when used).save_screenshot writes bytes to disk and returns { path, bytes, mimeType, clip? }.
get_dom — { processId, selector?, targetId? }
query_selector — { processId, selector, targetId?, limit?=20 }
evaluate
Param | Type | Default |
| string ✅ | — |
| string ✅ | — |
| string | auto |
|
|
|
| bool |
|
evaluate_main
Evaluate in the Electron main/node CDP target.
Param | Type | Default |
| string ✅ | — |
| string ✅ | — |
| string | auto-pick node/main |
| bool |
|
Requires a node-like target — start with inspectMain: true, or pass an explicit targetId from list_targets.
get_cookies
Param | Type | Description |
| string ✅ | — |
| string[] | Optional URL filter |
| string | Page target |
set_cookie
Param | Type | Description |
| string ✅ | — |
| string ✅ | Cookie pair |
| string | One required (defaults |
| string | Cookie path |
| bool | Flags |
|
| SameSite |
| number | Unix seconds |
| string | Page target |
Note: Chromium often rejects cookies on
file://pages — use anhttp(s)URL or pass an expliciturl/domain.
get_storage / set_storage
Param | Type | Default | Description |
| string ✅ | — | — |
|
|
| Store |
|
| — | Keys to write |
| bool ( |
| Clear store before write |
| string | — | Page target |
get_console_messages — { processId, tail?, level? }
get_network_log — { processId, tail? }
get_logs — { processId, tail? }
list_targets — { processId? }
page_info — { processId, targetId? } → url / title / readyState / userAgent
Console capture includes console.*, CDP Log entries, and Runtime.exceptionThrown.
🖱️ Interaction & control
navigate — { processId, url, targetId?, waitUntilLoad?=true, timeoutMs?=15000 }
wait_for
Provide at least one condition:
Param | Meaning |
| Element must exist |
| Element absent or not visible |
| Element exists and is not disabled |
|
|
|
|
|
|
| Buffered console text includes |
| Default |
| Save a PNG under the OS temp dir on failure |
| Page target |
click — { processId, selector, targetId?, button?=left }
type_text — { processId, text, selector?, clear?, pressEnter?, targetId? }
press_key
Param | Type | Description |
| string ✅ | — |
| string ✅ | e.g. |
| string | Focus/click before keypress |
|
| Chord modifiers |
| int | Repeat count |
| string | Page target |
set_console_live — { enabled }
Errors/asserts always emit MCP logs. When enabled, log/info/warn/debug also stream live.
reload — { processId, targetId?, ignoreCache?=false }
pause / resume — { processId, targetId? }
clear_buffers — { processId, console?=true, network?=true, logs?=false }
🧰 Power / tracing
start_tracing
Param | Type | Description |
| string ✅ | — |
| string | Comma-separated CDP categories (default: timeline + v8 profiler set) |
| string | Page target |
Only one active trace per process session.
stop_tracing
Param | Type | Description |
| string ✅ | — |
| string | Output JSON path (default: OS temp dir) |
Returns: { path, eventCount, elapsedMs, targetId, … }
Open the file in Chrome’s chrome://tracing (or Perfetto UI).
cdp_command — { processId, method:"Domain.method", targetId?, params? }
Escape hatch for any DevTools method not wrapped above.
📡 Resources (read-only)
URI | MIME | Description |
| JSON | Managed processes overview |
| JSON | All CDP targets |
| JSON | Process details + webContents + recent errors |
| text | stdout/stderr capture |
| JSON | Buffered console / exceptions |
| JSON | Target metadata |
💬 Prompts
Prompt | Args | Use when |
|
| White/blank window |
|
| Hunting console/exceptions |
|
| Wait → interact → verify |
📚 Usage examples
1️⃣ Start app → read title
// tool: start_app
{
"appPath": "D:/apps/my-electron-app",
"debugPort": 9222,
"extraArgs": ["--no-sandbox"]
}// tool: evaluate
{
"processId": "electron-1710000000000",
"expression": "document.title"
}2️⃣ Attach to a running app (port)
electron . --remote-debugging-port=9222// tool: attach
{ "debugPort": 9222, "name": "my-app" }3️⃣ Find by PID → attach
// tool: find_apps
{}// tool: attach_by_pid
{ "pid": 43210, "name": "my-app" }4️⃣ Catch console errors (+ live stream)
// tool: set_console_live
{ "enabled": true }// tool: get_console_messages
{
"processId": "electron-1710000000000",
"level": "error",
"tail": 50
}Also: resource electron://console/{processId}
5️⃣ Screenshot — full page, file, or element
// tool: screenshot
{ "processId": "electron-…", "format": "png" }// tool: save_screenshot
{
"processId": "electron-…",
"path": "D:/tmp/app.png",
"format": "png"
}// tool: save_screenshot (element clip)
{
"processId": "electron-…",
"path": "D:/tmp/sidebar.png",
"selector": "#sidebar"
}6️⃣ UI automation flow
// wait_for
{ "processId": "electron-…", "selector": "#email", "timeoutMs": 8000 }// type_text
{
"processId": "electron-…",
"selector": "#email",
"text": "ada@example.com",
"clear": true
}// press_key
{ "processId": "electron-…", "key": "Enter" }// click
{ "processId": "electron-…", "selector": "button[type=submit]" }// wait_for (richer conditions)
{
"processId": "electron-…",
"text": "Welcome",
"timeoutMs": 8000,
"screenshotOnTimeout": true
}// wait_for enabled / count / hidden
{ "processId": "electron-…", "enabled": "#submit" }{
"processId": "electron-…",
"countSelector": ".row",
"minCount": 3
}{ "processId": "electron-…", "hidden": ".spinner" }7️⃣ Cookies & storage
// set_storage
{
"processId": "electron-…",
"kind": "localStorage",
"clear": true,
"entries": { "theme": "dark", "onboardingDone": "1" }
}// get_storage
{ "processId": "electron-…", "kind": "localStorage" }// set_cookie
{
"processId": "electron-…",
"name": "session",
"value": "abc",
"url": "https://app.local/"
}// get_cookies
{ "processId": "electron-…", "urls": ["https://app.local/"] }8️⃣ Main-process evaluate
// start_app with inspectMain
{
"appPath": "D:/apps/my-electron-app",
"debugPort": 9222,
"inspectMain": true
}// evaluate_main
{
"processId": "electron-…",
"expression": "process.versions.electron"
}9️⃣ Performance tracing
// start_tracing
{ "processId": "electron-…" }…reproduce the slow interaction (click / navigate / wait_for)…// stop_tracing
{
"processId": "electron-…",
"path": "D:/tmp/app-trace.json"
}Open app-trace.json in chrome://tracing.
🔟 Diagnose a sick session
// tool: diagnose
{ "processId": "electron-1710000000000" }1️⃣1️⃣ Navigate + page info
// navigate
{
"processId": "electron-…",
"url": "file:///path/to/renderer/settings.html",
"waitUntilLoad": true
}// page_info
{ "processId": "electron-…" }1️⃣2️⃣ Raw CDP escape hatch
// cdp_command
{
"processId": "electron-…",
"method": "Page.captureScreenshot",
"params": { "format": "png", "fromSurface": true }
}1️⃣3️⃣ Recommended agent loop
find_apps / discover_apps / start_app / attach / attach_by_pid
→ diagnose
→ set_console_live(true) # optional
→ get_console_messages(level="error")
→ screenshot / save_screenshot(selector?)
→ wait_for (if UI)
→ click / type_text / press_key / evaluate / get_dom
→ get_storage / get_cookies # if state matters
→ start_tracing … stop_tracing # if perf
→ stop_app🔐 Configuration
Environment variables
Variable | Purpose |
| Force a specific Electron binary |
| Always pass |
|
|
|
|
| Download mirror for Electron zips |
| Cleared by |
| Zip cache directory |
| Enables no-sandbox auto flag |
unset | Enables no-sandbox auto flag |
Path allowlist example
$env:ELECTRON_MCP_ALLOWED_ROOTS="D:\apps;D:\GH"📜 npm scripts
Script | Does |
| Download/repair Electron binary |
| Alias of ensure-electron |
| Compile TS → |
| Run MCP server (stdio) |
| build + start |
|
|
| ensure + build + unit + smoke |
| Helper unit tests |
| Full MCP e2e vs fixture app |
| Runs ensure-electron |
Windows helpers: scripts/fix-electron.cmd · scripts/fix-electron.ps1
🧪 Testing
npm testSmoke path (v1.5):
initialize → tool/prompt/resource lists → start_app → evaluate → console/network/DOM → page_info / type_text / click / wait_for / press_key → save_screenshot (+ selector clip) → storage / cookies → start/stop_tracing → find_apps / attach_by_pid → screenshot → diagnose → attach → discover → stop
CI: .github/workflows/ci.yml (Ubuntu + Xvfb).
🗂️ Project layout
electron-mcp-server/
├── assets/logo.svg · logo.png
├── examples/cursor-mcp.json · claude-desktop-config.json
├── fixtures/minimal-electron-app/
├── scripts/ensure-electron.mjs · fix-electron.cmd · fix-electron.ps1
├── src/index.ts · process-manager.ts · events.ts · log.ts
├── src/types/chrome-remote-interface.d.ts
├── test/mcp-smoke.mjs · unit-helpers.test.mjs
├── .github/workflows/ci.yml
└── README.md · LICENSE · package.json · tsconfig.json🛡️ Security
Can launch local binaries, evaluate JS in app contexts, read page content, cookies, and storage — treat as a powerful local debugger.
Use
ELECTRON_MCP_ALLOWED_ROOTSon shared machines.save_screenshot/stop_tracingreject writes to sensitive locations (~/.ssh,/etc,/proc,/usr,C:\Windows,C:\Program Files, …). SetELECTRON_MCP_OUTPUT_ROOTSto further restrict output to specific directories.Don’t expose stdio over an open network without auth.
Only
attach/attach_by_pidto apps you trust (remote debugging is powerful).In-memory console/network buffers and exported traces may contain secrets from the app under test.
🧯 Troubleshooting
Symptom | Fix |
|
|
| Corrupt cache — repair script clears + uses |
| Expected on newer npm — run ensure/fix scripts |
Hang + console title | Windows QuickEdit — press Esc; disable QuickEdit |
Empty console buffer | Wait for page activity; monitoring starts on start/attach; try |
| Selector not ready — wait first; screenshot to verify |
Element screenshot hangs / times out | Headless/GPU quirks — server retries without |
| Pass an |
| Restart with |
| App must be started with |
| Outside |
| Waiting on MCP stdio — use Cursor config |
Port in use | Change |
Linux headless |
|
Tracing empty / fails | Call |
🤝 Contributing
Fork + branch
npm testPR with tool/behavior notes
Keep stdout MCP-clean (log to stderr only)
📄 License
ISC © Electron Debug MCP contributors
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityCmaintenanceA Model Context Protocol server that provides comprehensive Electron application automation, debugging, and observability capabilities through Chrome DevTools Protocol integration.Last updated415770MIT
- FlicenseAqualityDmaintenanceEnables debugging and automation of native Electron applications on macOS through DOM inspection, UI automation, global hotkeys, and Chrome DevTools Protocol integration.Last updated23
- Alicense-qualityDmaintenanceEnables Electron app automation via Chrome DevTools Protocol (CDP), allowing MCP clients like Cursor or Claude Desktop to interact with Electron apps.Last updated3MIT
- Alicense-qualityCmaintenanceEnables AI-powered automation, debugging, and observability of Electron applications through Chrome DevTools Protocol integration, providing real-time UI interaction and inspection capabilities.Last updated4418MIT
Related MCP Connectors
Live browser debugging for AI assistants — DOM, console, network via MCP.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/amafjarkasi/electron-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server