electron-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ELECTRON_PATH | No | Electron executable used by `start_app` (full path to electron.exe or electron). | |
| ELECTRON_MCP_NO_SANDBOX | No | `1` adds `--no-sandbox` (CI and containers). Also on when `CI=true` or no `DISPLAY` is set. | |
| ELECTRON_MCP_OUTPUT_ROOTS | No | `;`-separated folders that screenshots, traces, HAR, PDF and other output may be written to. | |
| ELECTRON_MCP_ALLOWED_ROOTS | No | `;`-separated folders. When set, `start_app` only launches apps inside them. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Runtime tools control and inspect running Electron apps over Chrome DevTools Protocol. Start with doctor when the environment is unknown (Electron binary, DISPLAY, sandbox flags, free port sample). Preferred workflow: start_app (inspectMain:true if you will touch main) or find_apps/attach → vision or snapshot → get_console_messages(level=error) → wait_for → click_ax/type_ax or click/hover/type_text → assert_ui. vision is the one-shot look (screenshot, page, console errors, network failures). snapshot is the accessibility tree. Use click_ax/type_ax when you have an accessible name; use CSS click/hover/drag/scroll/type_text otherwise. assert_ui returns pass:false with per-check detail. That is a failed check, not a tool error. For a failed request use get_network_log, then get_response_body with a finished requestId. network_stub fulfills or fails a urlPattern (* wildcard). export_har has no bodies. inspectMain on start_app opens a pinned --inspect port. These tools need it: evaluate_main, main_state, ipc_tap, get_ipc_log, webcontents_topology, open_deep_link, focus_window, set_window_bounds, get_clipboard, set_clipboard, get_downloads, set_permission. emulate_network sets offline, latency, and throughput. select_option sets a by value or label. print_pdf writes the page to a PDF. get_downloads must be called before the download (or pass url to start one). It returns savePath. delete_cookie removes a cookie set with set_cookie. file:// pages need an http(s) url or domain for cookies. screenshot/save_screenshot accept selector to clip an element. resume after pause or later screenshots fail. stop_app kills an owned app and only detaches an attached one, then drops the processId. Read electron://server for package version, uptime, and capability counts without calling a tool. Read electron://artifacts for exported screenshots, traces, heap snapshots, and HAR files.
Knowledge tools (electron_* prefix) never touch a running app. Electron development knowledge. Every tool is read-only and pure over its arguments: it reads no project file, runs nothing and makes no network call, so pass the code, config or error text to analyze as a string argument.
Routing:
Reviewing existing code: electron_audit_security, electron_lint_security, electron_audit_ipc_security, electron_audit_performance.
Writing new code or config: electron_scaffold_project, electron_scaffold_ipc_channel, electron_generate_preload_bridge, electron_generate_window_manager, electron_configure_csp, electron_configure_fuses, electron_configure_auto_update, electron_configure_deep_linking.
Upgrading Electron: electron_migrate_version for a version-to-version checklist, electron_check_deprecated_apis to scan code for removed or deprecated APIs.
Build or packaging failures: electron_diagnose_build_error with the error output.
Concepts: electron_explain_process_model, electron_explain_concept.
electron_knowledge_version reports which Electron releases the embedded knowledge covers.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| start_appB | Start an Electron application with remote debugging enabled. Example: {"appPath":"D:/apps/my-electron-app","debugPort":9222} |
| attachA | Attach to an already-running Electron/Chromium app that was started with --remote-debugging-port. Example: {"debugPort":9222} |
| attach_by_pidA | Attach to a running Electron app by PID. Resolves the remote-debugging port from process arguments. App must have been started with --remote-debugging-port. |
| find_appsA | Scan running OS processes for Electron apps. Returns PID, command, and any detected --remote-debugging-port / --inspect ports. Use to find targets for attach or attach_by_pid. |
| discover_appsA | Scan a local port range (default: 9222-9235) for reachable Chrome DevTools Protocol endpoints. Useful when an app was started with an unknown debug port. |
| stop_appA | Stop a process started by start_app, or detach bookkeeping for an attached session |
| list_appsB | List Electron applications managed or attached by this server |
| diagnoseA | Summarize process health: debug port reachability, target roles (page/worker/browser), recent console errors, and discovered local debug ports |
| doctorA | Local environment health check: package/node/platform, Electron binary, env flags, managed process count, optional free-port sample (localhost bind only) |
| get_logsA | Get captured stdout/stderr logs for a managed Electron process |
| get_console_messagesB | Get buffered page console/log/exception messages captured via CDP |
| list_targetsA | List Chrome DevTools Protocol targets with role classification (page/worker/browser/other) |
| evaluateB | Evaluate JavaScript in an Electron target via CDP Runtime.evaluate. Defaults to the first page/renderer target. |
| screenshotB | Capture a PNG/JPEG screenshot of a page target via Page.captureScreenshot (optional CSS selector clips to element bounds) |
| save_screenshotB | Capture a screenshot and write it to a local file path (PNG/JPEG); optional selector clips to element |
| get_domB | Read documentElement.outerHTML or a specific element's outerHTML |
| query_selectorB | Query DOM nodes with document.querySelectorAll and return tag/id/class/text summary |
| reloadC | Reload a page target (or all page targets) in an Electron app |
| pauseC | Pause JavaScript execution on a target via Debugger.pause |
| resumeC | Resume JavaScript execution on a target via Debugger.resume |
| cdp_commandC | Execute an arbitrary Chrome DevTools Protocol method on a target (Domain.method) |
| page_infoB | Get URL, title, readyState, and userAgent for a page target |
| navigateB | Navigate a page target to a URL (Page.navigate) and optionally wait for load |
| wait_forC | Wait until a selector exists/hides/enables, text/URL/console matches, or node count is met |
| clickC | Click the center of a CSS selector via CDP Input.dispatchMouseEvent |
| hoverA | Move the pointer over a CSS selector (mouseover / hover menus). Does not click. |
| scrollA | Scroll the page or an element. With a selector and no deltas, scrolls that element into view. With deltaY/deltaX, sends a mouse wheel at the element (or the viewport). |
| dragA | Press on fromSelector, move to toSelector, and release. Also sends an HTML5 drag with text/plain dataTransfer so drop listeners receive the payload. Pass data to override the source text. |
| type_textC | Type text into the focused element (optionally click a selector first) |
| press_keyC | Press a key or shortcut (Enter, Escape, Tab, Arrow*, or a character) with optional modifiers |
| set_console_liveA | Enable/disable live MCP log notifications for console events (all levels when enabled; errors always notify) |
| get_cookiesC | Read cookies for the page (optionally filtered by URL) |
| set_cookieB | Set a cookie on the page (provide url or domain; defaults to current location.href). file:// pages usually reject cookies unless you pass an http(s) url or domain. |
| delete_cookieB | Delete a cookie by name. Provide url or domain, same as set_cookie. Defaults url to the page location. |
| get_storageB | Read localStorage or sessionStorage key/value pairs from the page |
| set_storageB | Write localStorage or sessionStorage entries (optionally clear first) |
| clear_buffersB | Clear buffered console messages, network events, process logs, ipc, and/or audits |
| snapshotB | Accessibility tree snapshot (roles/names) via CDP Accessibility.getFullAXTree — agent-friendly UI map |
| visionB | One-shot app state: screenshot + page_info + recent console errors + network failures + windows |
| highlightC | Scroll a CSS selector into view and paint a CDP overlay highlight (auto-hides when durationMs > 0) |
| click_axA | Click an element by accessibility name (optional role). Uses the AX tree, not CSS. |
| type_axB | Focus an element by accessibility name and insert text (optional clear) |
| handle_dialogA | Auto accept or dismiss the next JavaScript dialogs (alert/confirm/prompt). clear:true disarms. |
| assert_uiB | Check url/title/text/selector/console-error budget/expression. Returns pass:false with per-check detail (does not throw on a failed check). |
| select_optionA | Choose an option in a by value or visible label, then fire input and change. |
| act_and_verifyB | Composite action & assertion: performs a UI action (click, click_ax, type_text, type_ax), waits for network idle, verifies assertion (assert_ui), and captures a screenshot immediately if assertion fails. |
| triageA | One-shot crash and failure triage: inspects page state, collects console errors, failed network calls, audit issues, log tail, and resolves the stack trace of the top exception. |
| save_storage_stateB | Export all page cookies, localStorage, and sessionStorage into a standardized JSON storage state artifact (Playwright-compatible format) |
| load_storage_stateB | Restore page cookies, localStorage, and sessionStorage from a saved JSON storage state file or payload |
| fill_formA | Fill multiple input fields (text, password, checkboxes, radio buttons, dropdowns) and optionally submit in a single turn. Supports {{secret:ELECTRON_MCP_*}} resolution and accessibility refs. |
| repro_bundleB | Package a complete, self-contained repro investigation bundle (screenshot, MHTML DOM archive, HAR network replay, source-mapped stack traces, logs, and system/health info) into a zip artifact. |
| responsive_theme_matrixA | Run a multi-theme (dark/light) and multi-viewport responsive sweep, verifying UI layout, detecting text clipping/horizontal overflow, and capturing screenshot artifacts. |
| get_network_logA | Get buffered network request/response events captured via CDP Network domain. Supports optional filtering by tail, status code, failure status, or URL pattern. |
| get_response_bodyA | Fetch body for a buffered network requestId (call after Network.loadingFinished) |
| block_urlsB | Block URL patterns via Network.setBlockedURLs (e.g. .analytics.com/) |
| set_extra_headersC | Set extra HTTP headers for subsequent requests (Network.setExtraHTTPHeaders) |
| network_stubA | Intercept matching URLs via Fetch and fulfill or fail them. Replaces a rule with the same urlPattern. Pair with clear_network_stubs. |
| clear_network_stubsB | Disable Fetch interception and drop stub rules for this session |
| wait_network_idleA | Wait until no network request is in flight and the log has been quiet for idleMs |
| export_harB | Write the buffered network log as HAR 1.2 JSON (method, URL, status; no bodies). Also exposes the file as an artifact resource. |
| emulate_networkA | Set the page offline, or slow it with latency and throughput in bytes per second. clear:true restores a normal network. Does not change viewport, user agent, geolocation, or media; use emulate for those. |
| get_downloadsA | Arm download capture and list files saved by the app. Requires inspectMain. The first call installs a will-download listener that writes into directory (default: OS temp) and suppresses the save dialog. Call it before the download starts, then call again for savePath. |
| network_failure_reportA | Composite network diagnostics: gathers all failed HTTP requests (status >= 400 or failed requests), fetches response bodies inline, and exports a HAR artifact. |
| offline_resilience_checkA | Audit how gracefully the Electron app handles network loss, high latency, or HTTP 500 server faults during interactions. Emulates faults, checks for crashes or unhandled rejections, restores network, and computes a Resilience Grade (A-F). |
| start_tracingB | Start Chrome DevTools Protocol performance tracing (pair with stop_tracing) |
| stop_tracingA | Stop CDP tracing and write a JSON trace file (open in chrome://tracing) |
| get_performance_metricsC | Renderer Performance.getMetrics (JS heap, layout count, task duration, …) |
| start_cpu_profileA | Start V8 CPU profiler on a page target (pair with stop_cpu_profile) |
| stop_cpu_profileA | Stop CPU profiler and write a .cpuprofile JSON file |
| heap_snapshotB | Take a V8 heap snapshot (.heapsnapshot) for leak investigation |
| diff_screenshotC | Capture (or compare) a screenshot against a baseline PNG; reports identical + byte similarity |
| get_audit_issuesB | Buffered Chromium Audits issues (cookie/CORS/mixed-content/deprecations) captured since attach |
| start_coverageB | Start JS precise coverage (optional CSS rule usage). Pair with stop_coverage. |
| stop_coverageC | Stop coverage and return JS (and optional CSS) coverage data; optionally write JSON |
| set_file_inputA | Set files on an via DOM.setFileInputFiles (host paths) |
| emulateC | Device metrics / UA / geolocation / media emulation (or clear=true to reset) |
| start_screencastB | Start Page.startScreencast; buffers up to maxFrames (ack frames). Pair with stop_screencast. |
| stop_screencastA | Stop screencast; optionally write last frame PNG/JPEG to path |
| set_breakpointC | Debugger.setBreakpointByUrl (0-based lineNumber). Keep debugger enabled while BPs exist. |
| remove_breakpointC | Debugger.removeBreakpoint by breakpointId from set_breakpoint |
| resolve_stackB | Resolve stack frames to source snippets (Debugger.getScriptSource / file://) |
| perf_auditB | Lighthouse-lite: Performance.getMetrics + nav/paint timing + recent Audits issues (not full Lighthouse) |
| capture_mhtmlC | Save page as MHTML via Page.captureSnapshot. Also registers the file as an artifact resource. |
| virtual_clockB | Emulation.setVirtualTimePolicy — pause / advance virtual time (use budget when advancing) |
| print_pdfB | Write the page to a PDF. Uses Page.printToPDF, and falls back to webContents.printToPDF when that method is missing (needs inspectMain). printBackground defaults to true. Also registers as an artifact resource. |
| perf_snapshotA | Composite performance profiler: coordinates start_tracing + start_cpu_profile + start_coverage, optionally captures an interaction or reload, stops all collectors, and bundles perf audit, metrics, and artifact URIs. |
| leak_checkA | Memory leak detector: triggers garbage collection, measures baseline DOM and heap counters, repeats an action or wait, runs GC again, and reports retained node/listener/heap growth. |
| evaluate_mainC | Evaluate JavaScript in the Electron main/node CDP target (use start_app with inspectMain:true for best results) |
| main_stateC | Electron main-process nervous system: windows, app paths, versions, metrics (requires inspectMain / node target) |
| ipc_tapA | Install main-process IPC tap (ipcMain.handle wrap + webContents send/ipc-message). Requires inspectMain. |
| get_ipc_logB | Drain / read captured IPC entries after ipc_tap. Requires inspectMain. |
| find_installed_appsA | Scan common install locations for packaged Electron apps (.app / exe / .desktop) |
| webcontents_topologyA | Map BrowserWindows / webContents (main) to CDP targets. Requires inspectMain. |
| open_deep_linkA | Emit Electron open-url and second-instance (requires inspectMain). Returns the URL the app recorded and mirrors it to window.DEEP_LINK. |
| focus_windowA | Bring an Electron BrowserWindow forward (show, focus, moveTop). Requires inspectMain. Omit windowId to use the first window. Pass show:false to focus without showing a hidden window. |
| get_clipboardA | Read the OS clipboard. Returns text and, when present, imageDataUrl (PNG). Requires inspectMain. |
| set_clipboardA | Write the OS clipboard. Pass text, imageDataUrl (a data:image/... URL), or both. Requires inspectMain. |
| set_permissionA | Allow or deny an Electron permission and grant it to the page via Browser.grantPermissions. Returns checked, the page's Notification.permission or equivalent. Requires inspectMain. Unlisted permissions are denied after the handler is installed. |
| set_window_boundsA | Move or resize a BrowserWindow. Omit a field to leave it unchanged. Requires inspectMain. Does not show a hidden window. |
| electron_security_auditA | Run security audit against Electron security recommendations (inspects webPreferences, sandbox, nodeIntegration, contextIsolation, setWindowOpenHandler, will-navigate guards, and binary fuses). Requires inspectMain. |
| ipc_invokeA | Directly invoke a main-process IPC handle channel or emit an IPC event with arguments. Requires inspectMain. |
| ipc_schema_inferenceA | Infer IPC channel contracts, argument shapes, and generate TypeScript interfaces from captured IPC tap traffic. Requires inspectMain. |
| mock_electron_apiB | Mock an Electron main-process API (e.g. dialog.showOpenDialog, shell.openExternal, app.getPath) with a custom return value or implementation. Requires inspectMain. |
| get_mock_callsB | Get recorded invocations and arguments for a mocked Electron API method |
| restore_electron_mocksB | Restore original implementations of mocked Electron APIs |
| get_application_menuB | Inspect the native Electron application menu hierarchy, items, roles, accelerators, and enabled states |
| click_menu_itemC | Trigger a click on a native application menu item by path (e.g. 'File > Open File...'), id, or role |
| trigger_shortcutC | Trigger an Electron global shortcut accelerator (e.g. 'CommandOrControl+Shift+P') |
| get_process_healthB | Watchdog health check diagnosing renderer crashes (OOM, killed), window hangs, responsiveness, and process memory |
| ipc_fuzz_and_verifyB | Fuzz test renderer-to-main IPC channels with boundary and malformed payloads (null, prototype pollution, path traversal, oversized buffers) and verify process crash resistance. |
| run_scriptA | Advanced server-side step runner & workflow engine: executes an array of tool steps sequentially with templating ({{vars.x}}, {{steps[0].result.x}}, {{secret:ELECTRON_MCP_KEY}}; only ELECTRON_MCP_* env vars), conditional branching (if), assertions (expect), automatic retries, diagnostic failure screenshots, and optional export to Playwright test specs. |
| electron_scaffold_ipc_channelA | Generate complete IPC boilerplate for a new feature: ipcMain handler in the main process, preload bridge function with contextBridge, TypeScript type declarations, and renderer-side usage example. Produces all the files needed for a secure, type-safe IPC channel. |
| electron_generate_preload_bridgeA | Generate a complete, secure preload.ts with contextBridge.exposeInMainWorld for multiple API methods. Produces the preload script, TypeScript declarations for window.electronAPI, and security best practices. Use this when you need to expose several main-process APIs to the renderer at once. |
| electron_audit_ipc_securityB | Analyze preload script and main process IPC code for security issues. Checks for: raw ipcRenderer exposure, missing sender validation, synchronous IPC usage, listener memory leaks, prototype pollution via contextBridge, and insecure channel patterns. Provide the actual code content to analyze. |
| electron_generate_window_managerB | Generate multi-window management boilerplate for Electron apps. Creates a WindowManager class that handles window lifecycle, inter-window communication, window state persistence, and proper cleanup. Supports common patterns like main + child windows, modal dialogs, and detached panels. |
| electron_explain_process_modelA | Get a clear, version-aware explanation of Electron's multi-process architecture. Covers the main process, renderer processes, preload scripts, utility processes, contextBridge, and how they interact. Useful for understanding the mental model before building features. |
| electron_audit_securityA | Audit an Electron app against the official security checklist. Covers 19 of the items that can be detected from static inputs (BrowserWindow configuration, main process code, package.json, preload, HTML): HTTPS-only content, nodeIntegration, contextIsolation, sandbox, webSecurity, CSP, allowRunningInsecureContent, experimentalFeatures, enableBlinkFeatures, raw ipcRenderer exposure, direct window assignment, @electron/remote, supported Electron version, shell.openExternal validation, file:// usage, tag, will-navigate handler, setWindowOpenHandler, and IPC sender validation. The remaining checklist items (session permissions, fuse configuration) require runtime / packaging context and are flagged in the report's footer. |
| electron_configure_fusesA | Generate @electron/fuses configuration to harden your Electron app. Fuses are compile-time toggles that disable dangerous Electron features (like ELECTRON_RUN_AS_NODE, NODE_OPTIONS) and cannot be re-enabled by end users. Essential for production apps. |
| electron_configure_cspA | Generate a Content Security Policy for an Electron app. Accounts for the bundler (Vite, webpack), framework (React, Vue, Svelte), and whether dev-mode exceptions are needed. Returns both meta-tag and session.webRequest approaches. |
| electron_lint_securityA | Static analysis of Electron code for dangerous patterns: shell.openExternal with user input, @electron/remote usage, disabled webSecurity, missing navigation restrictions, unrestricted window creation, and other OWASP-style vulnerabilities specific to Electron. |
| electron_diagnose_build_errorA | Diagnose Electron build/packaging errors from electron-builder, electron-forge, or electron-packager output. Identifies common failures: code signing errors, native module rebuild issues, ASAR packaging problems, missing platform-specific configuration, and __dirname path resolution bugs. |
| electron_configure_auto_updateB | Generate complete auto-update configuration using electron-updater. Produces main process setup, update event handling, renderer notification UI code, and platform-specific signing requirements. Supports GitHub releases, S3, and generic HTTP update servers. |
| electron_configure_deep_linkingA | Generate complete custom protocol / deep linking setup for Electron. Produces protocol registration, URL handling in both single-instance and multi-instance modes, platform-specific configuration (macOS Info.plist, Windows registry, Linux .desktop), and electron-builder/forge config. |
| electron_scaffold_projectB | Generate a complete, secure, modern Electron project scaffold. Includes proper process separation, TypeScript configuration, framework integration, build tooling, security defaults, and an example IPC channel. Produces a full project structure ready to develop. |
| electron_migrate_versionA | Generate a migration checklist for upgrading between Electron versions. Lists all breaking changes, deprecated APIs, and required code modifications between the current and target versions. |
| electron_check_deprecated_apisB | Scan code for usage of deprecated or removed Electron APIs. Returns a list of deprecated APIs found with their replacements and the version they were deprecated/removed in. |
| electron_audit_performanceA | Analyze Electron app code for 7 official performance anti-patterns: eager module loading, synchronous main-process operations, excessive BrowserWindows at startup, unnecessary polyfills, CDN-loaded assets, heavy preload scripts, and unbundled dependencies. Returns specific fixes. |
| electron_explain_conceptA | Get a clear, authoritative explanation of an Electron concept. Counters outdated tutorial content with accurate, version-aware information. Covers: process model, context isolation, sandbox, IPC, ASAR, fuses, code signing, and build tool comparison. |
| electron_knowledge_versionA | Return metadata about the embedded Electron knowledge used by this MCP's analysis tools -- the date it was last verified against official Electron docs, the current Electron stable version at that time, and the supported version range for migration/deprecation checks. Call this when you need to know whether the advice from other tools is current. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| debug_blank_window | Workflow for diagnosing a blank or white Electron window |
| find_renderer_exception | Workflow for finding renderer exceptions and console errors |
| ui_smoke_check | Workflow for a quick interactive UI smoke check in an Electron window |
| attach_and_screenshot | Find or attach to an Electron app, then screenshot and collect console errors |
| vision_then_act | Agent loop: vision → snapshot → act → verify (screenshot/diff) |
| ax_then_assert | Agent loop: snapshot → click_ax/type_ax → assert_ui (accessibility-first) |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| server | Server identity: package version, uptime, Node/platform, capability counts |
| info | Overview of Electron apps managed by this server |
| targets | All CDP targets across running Electron processes |
| artifacts | List of all exported artifacts (screenshots, traces, heapsnapshots, HARs, PDFs) |
TDQS
Scored across 129 tools
Most tools have clear, specialized purposes, but the set contains several overlapping clusters: screenshot/save_screenshot/diff_screenshot/vision, find_apps/discover_apps/find_installed_apps/list_apps, and perf_audit/perf_snapshot/get_performance_metrics. Detailed descriptions help, but with 129 tools an agent can still reasonably hesitate between similar diagnostics or capture tools.
Names are overwhelmingly snake_case and most runtime actions follow a predictable verb_noun pattern (get_cookies, set_cookie, click_ax, start_tracing). Minor inconsistencies exist, such as noun-y tools like snapshot, vision, and triage, plus the electron_ prefix on code-generation/knowledge tools, but the convention remains readable and predictable.
With 129 tools, this is far beyond a well-scoped surface. The server mixes runtime debugging, automation, security auditing, scaffolding, migration guidance, and packaging diagnostics, making the count an extreme mismatch for a single MCP toolset.
The tool surface is exceptionally broad: app lifecycle, CDP/automation, DOM/input, network, storage, cookies, IPC inspection, security audits, performance profiling, crash triage, code generation, migration, and packaging diagnostics are all represented. For an Electron development/debugging MCP, there are no obvious major gaps.