electron-mcp-server
Provides tools for launching and managing Electron applications, interacting with UI elements, executing scripts in the main process, capturing screenshots, and performing visual and accessibility testing.
Click on "Deploy 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-mcp-server launch the electron app and click the 'Start' button"
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.
Electron MCP Server
A Model Context Protocol (MCP) server for testing Electron applications using Playwright. This server enables AI coding tools like Cursor and Claude Code to interact with Electron applications for automated testing and development.
Features
Electron App Lifecycle: Launch and manage Electron applications programmatically
CDP Connection: Connect to running Electron apps via Chrome DevTools Protocol with retry logic and IPv6/IPv4 fallback
Element Interaction: Click, fill, select, and interact with UI elements
Navigation: Navigate to URLs and manage page state, with CDP-backed navigation history tools
Window Management: Control Electron main windows (focus, minimize, maximize)
Main Process Access: Execute scripts in the Electron main process
Visual Testing: Capture screenshots and compare against baselines
Accessibility Testing: Retrieve accessibility tree information, structured accessibility snapshots, and role-based interactions
Session Management: Multiple concurrent test sessions with UUID tracking
Advanced CDP Features: Network emulation, geolocation override, device metrics, performance monitoring, navigation history
Code Generation: Record user flows and export Playwright tests
Robust Error Handling: Categorized errors with automatic classification and retry recommendations
Related MCP server: Electron MCP Server
Installation
Using npm (Recommended)
npm install -g @kanishka-namdeo/electron-mcp-serverFrom Source
git clone https://github.com/kanishka-namdeo/electron-mcp-server.git
cd electron-mcp-server
npm install
npm run buildUsage
Running the Server
# Development mode with hot reload
npm run dev
# Production mode
npm run start
# Build TypeScript
npm run buildAI Tool Integration
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"electron-mcp-server": {
"command": "npx",
"args": [
"-y",
"@kanishka-namdeo/electron-mcp-server"
],
"env": {
"LOG_LEVEL": "info",
"NODE_ENV": "production"
}
}
}
}Or using a global installation:
{
"mcpServers": {
"electron-mcp-server": {
"command": "electron-mcp-server",
"env": {
"LOG_LEVEL": "info",
"NODE_ENV": "production"
}
}
}
}Cursor
Add to your Cursor MCP settings (.cursor/mcp.json):
{
"mcpServers": {
"electron-mcp-server": {
"command": "npx",
"args": [
"-y",
"@kanishka-namdeo/electron-mcp-server"
]
}
}
}Or for global installation:
{
"mcpServers": {
"electron-mcp-server": {
"command": "electron-mcp-server"
}
}
}Available Tools
The Electron MCP Server provides 44 tools across 6 categories:
App Lifecycle (4 tools)
Tool | Description |
| Launch an Electron application |
| Connect to a running Electron app via CDP |
| Close a test session |
| List all active sessions |
Element Interaction (10 tools)
Tool | Description |
| Navigate to a URL |
| Click on an element |
| Fill an input field with text |
| Select an option from a dropdown |
| Get text content of an element |
| Take a screenshot of the page or element |
| Wait for an element to appear |
| Execute JavaScript in the renderer process |
| Get page URL and title |
Main Process & Window Control (8 tools)
Tool | Description |
| Execute JavaScript in the main process |
| Get window information |
| Focus the main window |
| Minimize the main window |
| Maximize the main window |
| Report capability info for unresponsive renderer callstack capture in Electron 34+ apps |
| Report capability info for HTTP shared dictionary compression in Electron 34+ apps |
| Report capability info for clearing shared dictionary cache in Electron 34+ apps |
Visual Testing & Accessibility (11 tools)
Tool | Description |
| Capture a screenshot |
| Screenshot a specific element |
| Compare against a baseline |
| Get current viewport dimensions |
| Set viewport dimensions |
| Retrieve accessibility tree |
| Get Playwright accessibility snapshot for the current page |
| Find nodes by accessibility role/name with optional fuzzy matching |
| Click or fill accessible nodes by role/name |
Advanced CDP Features (12 tools)
Tool | Description |
| Get CDP protocol version and browser info |
| Emulate slow/offline network |
| Reset to default network settings |
| Override geolocation |
| Remove geolocation override |
| Emulate mobile device |
| Capture console logs |
| Get performance metrics |
| Clear cache and cookies |
| Get current user agent |
| Get navigation history entries via CDP |
| Restore a history entry via CDP |
Codegen & Recording
Tool | Description |
| Start recording a flow for a session |
| Stop recording and return structured steps |
| Export recorded steps as a Playwright test snippet |
Links
npm: https://www.npmjs.com/package/@kanishka-namdeo/electron-mcp-server
Repository: https://github.com/kanishka-namdeo/electron-mcp-server
Issues: https://github.com/kanishka-namdeo/electron-mcp-server/issues
Development
Testing
The project has a comprehensive test suite with multiple categories:
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run unit tests only
npm run test:unit
# Run integration tests only
npm run test:integration
# Run E2E tests only (requires running Electron app)
npm run test:e2e
# Run compliance tests only
npm run test:compliance
# Run tests in watch mode
npm run test:watchLinting
# Run linter
npm run lint
# Fix linting issues
npm run lint:fixType Checking
npm run typecheckBuilding
# Build TypeScript
npm run build
# Development mode with hot reload
npm run dev
# Production mode
npm startProject Structure
electron-mcp-server/
├── src/
│ ├── core/
│ │ ├── errors.ts # Custom error classes
│ │ ├── errors-enhanced.ts # Enhanced error handling with classification
│ │ ├── cdp-utils.ts # CDP connection utilities with retry logic
│ │ ├── connection-health.ts # Connection health monitoring
│ │ ├── logger.ts # Pino logging setup
│ │ └── types.ts # TypeScript type definitions
│ ├── session/
│ │ ├── session-manager.ts # Session lifecycle management
│ │ └── index.ts
│ ├── tools/
│ │ ├── handlers/
│ │ │ ├── app-lifecycle.ts # App launch and CDP connection
│ │ │ ├── element-interaction.ts # Click, fill, select, navigate
│ │ │ ├── main-process.ts # Window control and main process scripts
│ │ │ ├── visual-testing.ts # Screenshots, viewport, accessibility
│ │ │ └── cdp-advanced.ts # Network, geolocation, device metrics
│ │ ├── tools.ts # Tool definitions
│ │ ├── validation.ts # Zod schemas
│ │ ├── validation-enhanced.ts # Enhanced validation schemas
│ │ └── index.ts
│ └── index.ts # Main MCP server
├── tests/
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ ├── e2e/ # End-to-end tests
│ ├── compliance/ # MCP protocol compliance tests
│ ├── utils/ # Test utilities
│ └── fixtures/ # Test fixtures
├── test-app/ # Electron test application
├── .trae/
│ └── docs/ # Phase 1 & 2 documentation
├── CHANGELOG.md # Version history
├── LICENSE # MIT License
├── package.json
├── tsconfig.json
└── vitest.config.tsEnvironment Variables
LOG_LEVEL: Logging level (default:info)NODE_ENV: Environment (default:production)
License
MIT
Available Tools
48 toolscapture_element_screenshotC
Take a screenshot of a specific element
Inputs: selector (required), sessionId (required), path.
clear_browser_cacheC
Clear browser cache and cookies
Inputs: sessionId (required).
clear_geolocationC
Clear geolocation override
Inputs: sessionId (required).
clear_logsB
Clear all log files from the project log directory.
Inputs: no named parameters.
clickC
Click on an element in the Electron app
Inputs: selector (required), sessionId (required), timeout.
close_sessionC
Close an Electron testing session and release resources
Inputs: sessionId (required).
compare_screenshotsC
Compare a screenshot with a baseline image
Inputs: sessionId (required), baselinePath (required), actualPath.
configure_debugC
Configure debug settings including log levels and categories.
Inputs: level, categories, addCategories, removeCategories.
connect_to_electron_cdpC
Connect to a running Electron application via Chrome DevTools Protocol
Inputs: port (required), host, timeout.
disable_debugB
Disable debug mode and stop logging.
Inputs: no named parameters.
emulate_network_conditionsC
Emulate network conditions (offline, slow network, latency)
Inputs: sessionId (required), latency, offline, uploadThroughput, +1 more.
enable_debugB
Enable debug mode with granular logging for the MCP server. Logs are stored in .electron-mcp/logs directory within the project.
Inputs: level, logToFile, categories, logDirectory, +1 more.
executeC
Execute JavaScript in the Electron app context
Inputs: script (required), sessionId (required).
execute_main_process_scriptC
Execute JavaScript in the Electron main process context
Inputs: script (required), sessionId (required).
export_recording_as_testC
Export recorded steps as a Playwright test file snippet
Inputs: sessionId (required), testName.
fillC
Fill an input field with text
Inputs: value (required), selector (required), sessionId (required), timeout.
find_accessible_nodeC
Find accessible nodes by role and/or name using the accessibility tree
Inputs: sessionId (required), name, role, exact, +1 more.
focus_main_windowC
Focus Electron main window
Inputs: sessionId (required).
get_accessibility_snapshotC
Get Playwright accessibility snapshot for the current page
Inputs: sessionId (required), includeHidden.
get_accessibility_treeC
Get accessibility tree of current page
Inputs: sessionId (required).
get_console_messagesC
Capture console messages from the page
Inputs: sessionId (required).
get_debug_statusB
Get current debug mode status and configuration.
Inputs: no named parameters.
get_logsB
Retrieve and filter log entries from the project log directory.
Inputs: level, limit, since, until, +3 more.
get_main_window_infoC
Get information about the Electron main window
Inputs: sessionId (required).
get_page_infoC
Get information about the current page (URL, title, etc.)
Inputs: sessionId (required).
get_performance_metricsC
Get performance metrics from the page
Inputs: sessionId (required).
get_protocol_infoC
Get CDP protocol information including browser version and capabilities
Inputs: sessionId (required).
get_textC
Get the text content of an element
Inputs: selector (required), sessionId (required), timeout.
get_user_agentC
Get current user agent string
Inputs: sessionId (required).
get_viewport_sizeC
Get current viewport size
Inputs: sessionId (required).
interact_accessible_nodeC
Interact with an accessible node by role and name (click or fill)
Inputs: name (required), role (required), action (required), sessionId (required), +1 more.
launch_electron_appC
Launch an Electron application for testing
Inputs: executablePath (required), args, slowMo, headless.
list_sessionsB
List all active Electron testing sessions
Inputs: no named parameters.
maximize_main_windowC
Maximize Electron main window
Inputs: sessionId (required).
minimize_main_windowC
Minimize Electron main window
Inputs: sessionId (required).
reset_network_conditionsC
Reset network conditions to default
Inputs: sessionId (required).
screenshotC
Take a screenshot of current page or an element
Inputs: sessionId (required), path, fullPage.
selectC
Select an option from a dropdown
Inputs: value (required), selector (required), sessionId (required), timeout.
set_device_metricsC
Emulate device metrics (viewport size, device scale factor, mobile)
Inputs: width (required), height (required), sessionId (required), mobile, +1 more.
set_geolocationC
Set or override geolocation for the page
Inputs: latitude (required), longitude (required), sessionId (required), accuracy.
set_viewport_sizeD
Set the viewport size
Inputs: width (required), height (required), sessionId (required).
start_recordingC
Start recording user interactions for the given session
Inputs: sessionId (required).
stop_recordingC
Stop recording interactions and return the recorded steps
Inputs: sessionId (required).
take_screenshotC
Take a screenshot of current page
Inputs: sessionId (required), path, fullPage.
wait_for_selectorC
Wait for an element to appear on the page
Inputs: selector (required), sessionId (required), state, timeout.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 48 tools
Several tools have overlapping purposes: screenshot and take_screenshot both capture the current page, get_accessibility_tree and get_accessibility_snapshot both retrieve accessibility data, and interact_accessible_node overlaps with click/fill/select. This creates multiple unclear boundaries that could easily cause misselection.
Most names use snake_case and are readable, but the conventions are mixed: some are verb_noun (take_screenshot, capture_element_screenshot), some are bare nouns or adjectives (screenshot), and some are simple verbs without objects (execute, click). This is not chaotic but is inconsistent enough to be notable.
48 tools is very heavy for an Electron testing MCP server, exceeding the 25-tool threshold where count becomes a problem. Many tools are duplicates or near-duplicates (e.g., screenshot variants, accessibility variants), indicating the surface is over-expanded rather than tightly scoped.
The server covers a wide lifecycle: launching/connecting sessions, page interaction, screenshots, accessibility, network/geolocation emulation, recording, navigation, performance, and debug logging. Some minor gaps remain, such as keyboard actions, drag-and-drop, or built-in assertions, but core Electron testing workflows are well represented.
Maintenance
Related MCP Connectors
Find UI bugs, verify fixes and run tests on your web app from your AI coding agent.
Write, run and check natural-language browser tests of your web app from your AI assistant.
Direct access to Cypress tests results and accessibility reports in your AI workflow.
Approved test intent, reviewed Playwright automation and run evidence, inside your editor.
Related MCP Servers
- AlicenseAqualityDmaintenanceDrive Electron apps from AI agents via MCP - click, type, drag, screenshot, eval JS, and more.3932 npm3MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI-powered automation, debugging, and observability of Electron applications through Chrome DevTools Protocol integration, providing real-time UI interaction and inspection capabilities.27MIT
- AlicenseCqualityDmaintenanceEnables AI models to test and interact with Electron applications using Playwright, supporting CDP connection and app launch modes.2882 npmMIT
- AlicenseAqualityBmaintenanceDrive, inspect, and assert on real Electron desktop apps from an AI agent — agent-native, Playwright-style automation with accessibility refs, stable error codes, and retrying assertions5712MIT