Skip to main content
Glama

Electron MCP Server

An MCP (Model Context Protocol) server for testing Electron desktop applications using WebdriverIO. This server enables AI agents to interact with, test, and automate Electron apps.

Features

  • App Lifecycle Management: Launch and close Electron applications

  • Element Discovery: Capture UI snapshots with element references for interactions

  • Element Interactions: Click, type, and interact with UI elements

  • Screenshots: Capture visual state of the application

  • Action Recording: Record interactions for test generation

  • Test Generation: Generate WebdriverIO or Playwright test code

  • CDP Integration: Network monitoring, console capture, performance metrics, JS evaluation

Related MCP server: electron-test-mcp

Installation

cd electron-mcp-server
npm install
npm run build

Usage

As an MCP Server

Add to your MCP client configuration:

{
  "mcpServers": {
    "electron": {
      "command": "node",
      "args": ["/path/to/electron-mcp-server/dist/bin/cli.js"]
    }
  }
}

Programmatic Usage

import { createServer, runServer } from 'electron-mcp-server';

// Run as stdio server
await runServer();

// Or create server instance
const server = await createServer();

Available Tools

App Lifecycle (2)

Tool

Description

electron_launch

Launch an Electron app with WebdriverIO

electron_close

Close the Electron app session

Element Interactions (3)

Tool

Description

electron_snapshot

Discover UI elements with references

electron_click

Click element by reference

electron_type

Type text into element

Page (1)

Tool

Description

electron_screenshot

Take a screenshot

Recording (3)

Tool

Description

electron_start_recording

Start action recording

electron_stop_recording

Stop recording

electron_recording_status

Get recording status

Generator (1)

Tool

Description

electron_generate_test

Generate test code (WebdriverIO/Playwright)

CDP Tools (4)

Tool

Description

electron_cdp_network

Network interception/mocking

electron_cdp_console

Console log capture

electron_cdp_performance

Performance metrics

electron_cdp_evaluate

Execute JS in app context

Example Workflow

1. electron_launch(binaryPath: "/path/to/your-electron-app")
2. electron_snapshot() -> Returns element list with refs (e1, e2, e3...)
3. electron_click(ref: "e1") -> Click first element
4. electron_type(ref: "e2", text: "Hello") -> Type into input
5. electron_screenshot() -> Capture current state
6. electron_close()

Recording and Test Generation

1. electron_launch(binaryPath: "/path/to/app")
2. electron_start_recording()
3. electron_snapshot()
4. electron_click(ref: "e1")
5. electron_type(ref: "e2", text: "test")
6. electron_stop_recording()
7. electron_generate_test(format: "webdriverio_ts", testName: "my_test")

Supported Test Formats

  • webdriverio_js - WebdriverIO JavaScript

  • webdriverio_ts - WebdriverIO TypeScript

  • playwright_js - Playwright JavaScript

  • playwright_ts - Playwright TypeScript

CDP Tools Usage

Network Monitoring

electron_cdp_network(action: "get")                    // Get captured requests
electron_cdp_network(action: "clear")                  // Clear history
electron_cdp_network(action: "mock", mock: {...})      // Set up mock response

Console Capture

electron_cdp_console(action: "start")                  // Start monitoring
electron_cdp_console(action: "get")                    // Get logs
electron_cdp_console(action: "get", level: "error")    // Get only errors
electron_cdp_console(action: "stop")                   // Stop and retrieve

Performance Metrics

electron_cdp_performance(action: "get")                // General metrics
electron_cdp_performance(action: "timing")             // Navigation timing
electron_cdp_performance(action: "memory")             // Memory usage

JavaScript Evaluation

electron_cdp_evaluate(script: "return document.title")
electron_cdp_evaluate(script: "localStorage.getItem('key')")

Requirements

  • Node.js >= 18.0.0

  • Electron app built for testing

  • ChromeDriver (handled by wdio-electron-service)

Dependencies

  • @modelcontextprotocol/sdk - MCP protocol implementation

  • webdriverio - WebDriver client

  • wdio-electron-service - Electron testing service

  • zod - Schema validation

License

MIT

Available Tools

28 tools
electron_cdp_consoleC

Capture and retrieve console logs from the Electron app

Inputs: action (required), level.

electron_cdp_evaluateC

Execute JavaScript code in the Electron app context and return the result

Inputs: script (required), returnValue (required), args.

electron_cdp_networkB

Interact with network requests via CDP: get captured requests, clear history, or set up mocks

Inputs: action (required), mock, filter.

electron_cdp_performanceC

Get performance metrics from the Electron app including timing and memory

Inputs: action (required).

electron_clickB

Click on an element using its reference from the snapshot

Inputs: ref (required).

electron_closeA

Close the Electron application and end the WebdriverIO session

Inputs: no named parameters.

electron_generate_locatorC

Generate a robust locator strategy for an element based on description.

Inputs: description (required).

electron_generate_testB

Generate executable test code from recorded actions for WebdriverIO or Playwright

Inputs: format (required), testName (required), appPath, filename.

electron_generator_read_logC

Read the action log from the current generation session. Shows all recorded actions.

Inputs: format (required).

electron_generator_setupC

Initialize a test generation session. Provide a test plan and target framework.

Inputs: testPlan (required), framework (required), outputDir.

electron_generator_write_testC

Save generated test code to a file in the output directory.

Inputs: filename (required), testCode (required), overwrite (required).

electron_healer_debug_testC

Run a specific test in debug mode with enhanced logging to diagnose failures.

Inputs: verbose (required), testName (required), testPath (required), framework (required), +1 more.

electron_healer_fix_testB

Apply fixes to a test file. Creates a backup and saves the corrected code.

Inputs: testPath (required), fixedCode (required), createBackup (required), fixDescription (required).

electron_healer_run_testsC

Execute test suite and collect failure information for debugging.

Inputs: timeout (required), testPath (required), framework (required), configPath.

electron_launchC

Launch an Electron application for testing. Connects via WebdriverIO with the Electron service.

Inputs: binaryPath (required), waitTimeout (required), windowWidth (required), windowHeight (required), +3 more.

electron_planner_exploreC

Document a screen or feature during test planning. Captures the current state and adds it to the planning session.

Inputs: screenName (required), notes, features, description.

electron_planner_saveB

Generate and save the test plan document based on the planning session.

Inputs: includeScreenshots (required), filename, additionalNotes.

electron_planner_setupC

Initialize a test planning session for an Electron application. Call this before exploring the app.

Inputs: appName (required), appPath (required), scope, outputDir.

electron_recording_statusA

Get the current recording status and action count

Inputs: no named parameters.

electron_resize_windowC

Resize the Electron app window to specified dimensions using JavaScript. Also supports setting window position.

Inputs: width (required), height (required), x, y.

electron_screenshotB

Take a screenshot of the current Electron app window. Returns the screenshot as base64 image.

Inputs: filename.

electron_snapshotA

Capture the current UI state including all interactive elements. Returns element references (e1, e2, etc.) that can be used for interactions.

Inputs: no named parameters.

electron_start_recordingB

Start recording user actions to generate test scripts later

Inputs: no named parameters.

electron_stop_recordingB

Stop recording actions and return the recorded action list

Inputs: no named parameters.

electron_typeC

Type text into an input field or textarea

Inputs: ref (required), text (required), clear (required).

electron_verify_element_visibleC

Verify that an element is visible on the screen.

Inputs: ref (required), timeout (required).

electron_verify_text_visibleC

Verify that specific text is visible on the page.

Inputs: text (required), exact (required), timeout (required).

electron_verify_valueB

Verify that an input element has the expected value.

Inputs: ref (required), timeout (required), expectedValue (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 28 tools

    Disambiguation3/5

    Most tools target distinct operations, but several phase-specific tools overlap conceptually: snapshot/screenshot/planner_explore all capture UI state, while start_recording/generator_setup/generate_test/generator_write_test require understanding of the recording-to-generation workflow. Descriptions generally clarify the boundaries, but an agent can still misselect without knowing the intended workflow phase.

    Naming Consistency4/5

    All tools use the electron_ prefix and snake_case, which is highly predictable. There are minor internal pattern deviations: core tools tend to be verb_object while subsystem tools use group_action, and a few names are noun-only (snapshot, screenshot, cdp_network).

    Tool Count2/5

    At 28 tools, the surface is heavy for an agent and exceeds the typical well-scoped range. The tools span many separate workflows (recording, generation, CDP, planning, healing, verification), and some could likely be consolidated or hidden behind higher-level entry points.

    Completeness4/5

    The server covers a broad Electron testing lifecycle: launch/close, snapshot-based interaction, screenshots, recording, test generation, CDP inspection/evaluation, verification, planning, and healing. Minor gaps exist in common UI actions such as hover, scroll, select, keyboard shortcuts, and richer element attribute retrieval, though cdp_evaluate provides a workaround.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Lets an AI agent launch or attach to a running Electron app and control it directly over the Chrome DevTools Protocol: capture screenshots (optionally with the native window frame), click, drag, hover, scroll, type, press keys, resize and reload. It also exposes JavaScript execution in both the renderer and main process, an accessibility tree with click-ready coordinates, and console logs, so an agent can inspect and operate the app without adding any code to it.
      96 npm
      MIT