electron-mcp-bridge
In-process MCP server that lives inside an Electron app's main process, letting agents attach to an already-running desktop app to enumerate windows and bounds, inspect and invoke ipcMain channels, evaluate JavaScript in the renderer, capture screenshots, and read process/diagnostics data, with built-in permission tiers and path/secret redaction.
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-bridgeclick Save on the invoice form, then verify the row actually landed in SQLite"
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-bridge
In-process Model Context Protocol (MCP) Server for Electron Desktop Applications.
Connect AI Agents (Anthropic Claude Desktop, Google Antigravity, Cursor, Windsurf) directly to your running Electron app to inspect state, trigger actions, and verify on-disk oracles with zero runtime dependencies.
The Problem in the Open-Source Ecosystem
In 2026, AI coding and execution agents interact with software via the Model Context Protocol (MCP):
Web apps have Playwright MCP and Puppeteer MCP.
Mobile apps have Maestro MCP.
Desktop Electron apps only had outside-in Chrome DevTools Protocol (CDP) wrappers.
Existing CDP wrappers (@laststance/electron-mcp-server, playwright-mcp-electron) suffer from three fundamental architectural flaws:
Blind to the Node.js Main Process: CDP only sees the Chromium renderer DOM. It cannot inspect SQLite databases,
ipcMainchannels, background worker threads, filesystem locks, or event-loop stalls.The "Green Click" Fallacy (The Oracle Deficit): If an agent clicks a button and it turns blue, CDP says "passed"—even if the SQLite transaction rolled back or the file write hung.
Cannot Attach to Running Desktop Sessions: CDP wrappers require cold-launching an isolated browser window with debugging flags; developers cannot connect agents to their active, already-running desktop app.
Related MCP server: Electron MCP Server
What electron-mcp-bridge Does
electron-mcp-bridge sits directly inside your Electron main process, bridging BOTH the Node.js backend and Chromium renderer:
┌────────────────────────────────────────────────────────────────┐
│ AI Agents (Claude Desktop, Cursor, Windsurf, Antigravity) │
└───────────────────────────────┬────────────────────────────────┘
│ stdio (JSON-RPC 2.0)
┌───────────────────────────────▼────────────────────────────────┐
│ npx electron-mcp-bridge attach │
└───────────────────────────────┬────────────────────────────────┘
│ Unix Domain Socket / Pipe (0600)
┌───────────────────────────────▼────────────────────────────────┐
│ Electron Application (Main Process) │
│ ├── Desktop Safety Firewall & Redactor │
│ ├── 6 Universal Tools (inspect_ipc, invoke_ipc, windows, etc) │
│ ├── Application Verification Oracles (SQLite / Disk / DB) │
│ └── Performance Diagnostics (electron-workflow-observer) │
└───────────────────────────────┬────────────────────────────────┘
│ webContents.executeJavaScript()
┌───────────────────────────────▼────────────────────────────────┐
│ Chromium Renderer (DOM, Active Routes, Visual Paint) │
└────────────────────────────────────────────────────────────────┘Zero Runtime Dependencies: Pure Node.js standard library (
node:net,node:crypto,node:stream).Live App Attachment: Attach Claude Desktop or Cursor to your already-running app with
npx electron-mcp-bridge attach.True Verification Oracles: Run actions and assert that on-disk sidecars, database rows, and hash receipts actually changed.
Workflow Observer Synergy: Directly exposes event-loop stall alerts and IPC latency bottlenecks from
electron-workflow-observer.Desktop Guardrails: Built-in permission tiers (
query,action,destructive) and sensitive token/home-path redaction.
Installation
npm install electron-mcp-bridgeQuick Start (1 Line in Electron)
In your main.js or electron/main.ts:
const { setupMcpBridge } = require('electron-mcp-bridge')
// 1-line setup automatically opens a secure local domain socket:
setupMcpBridge({
app,
ipcMain,
appName: 'my-desktop-app', // defaults to app.getName()
enabled: process.env.NODE_ENV !== 'production' || process.env.ENABLE_MCP === '1',
})Connecting AI Agents
1. Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"my-app": {
"command": "npx",
"args": ["electron-mcp-bridge", "attach", "--app", "my-desktop-app"]
}
}
}Now, Claude Desktop can inspect your running Electron app, trigger commands, and verify data!
2. Cursor / Windsurf / Antigravity
In your agent's MCP configuration:
{
"mcpServers": {
"my-app": {
"command": "npx",
"args": ["electron-mcp-bridge", "attach", "--app", "my-desktop-app"]
}
}
}Universal Built-in Tools
Every Electron app using electron-mcp-bridge immediately exposes 6 universal tools to agents:
Tool | Tier | Description |
|
| Enumerates all open |
|
| Lists registered |
|
| Dispatches an invocation to an |
|
| Evaluates safe JavaScript inside the active window's |
|
| Captures the window or sub-rectangle and returns a base64 PNG image. |
|
| Returns process memory, CPU usage, and integrates with |
Domain Oracles (The Killer Validation Feature)
In addition to universal tools, apps can declare application-specific oracles to prove business effects (SQLite rows, file sidecars, native metadata):
setupMcpBridge({
app,
ipcMain,
oracles: [
{
name: 'verify_xmp_oracle',
description: 'Verifies on-disk .xmp sidecar exists, parses rating, and verifies SHA-256 hash',
schema: {
type: 'object',
properties: { photoId: { type: 'string' } },
required: ['photoId'],
},
handler: async ({ photoId }) => {
const xmpPath = `/photos/${photoId}.xmp`
const exists = fs.existsSync(xmpPath)
const content = exists ? fs.readFileSync(xmpPath, 'utf8') : ''
return {
onDisk: exists,
hasRating: content.includes('<xmp:Rating>5</xmp:Rating>'),
bytes: content.length,
}
},
},
],
})Now an AI agent or test script can run:
tools/call { name: "verify_xmp_oracle", arguments: { photoId: "img_001" } }And verify real disk persistence without guessing!
Desktop Safety Firewall & Guardrails
To prevent agents from executing unintended destructive operations:
setupMcpBridge({
app,
ipcMain,
// Safety options:
allowDestructive: false, // Blocks destructive actions (default: false)
allowActions: true, // Allows idempotent mutations (default: true)
allowedChannels: ['catalog:read', 'catalog:rate'], // Whitelist specific IPC channels
blockedChannels: ['auth:login', 'crypto:keys'], // Explicitly blocked channels
})Tool outputs are automatically sanitized:
User home directory paths (
/Users/username/...) are redacted to~/...Common credentials, tokens, and secret keys are automatically replaced with
[REDACTED].
CLI Utilities
# Attach stdio to running app (used by Claude Desktop / Cursor)
npx electron-mcp-bridge attach --app shotselect
# Inspect available tools from the command line
npx electron-mcp-bridge tools --app shotselect
# One-shot tool invocation
npx electron-mcp-bridge call app:list_windows --app shotselectLicense
MIT © 2026 Rudra Pratap Singh
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect AI agents to your own Chrome with scoped access, approvals, and verified task results.
Drive real devices from your AI Coding tool. Embed a client SDK (Unity, Godot, Flutter, iOS/macOS, Android, React Native, Web) in your app, then capture screenshots, traverse the UI tree, inject taps and key events, and run automated test tasks on the physical device over a secure relay.
Context and control for any AI. Agent identity, scoped access, and proof across tools.
Build, test and publish agentic workflows from your AI client: approve steps, read tables, see runs.
Related MCP Servers
- AlicenseAqualityDmaintenanceDrive Electron apps from AI agents via MCP - click, type, drag, screenshot, eval JS, and more.3945 npm3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI-powered automation, debugging, and observability of Electron applications through Chrome DevTools Protocol integration, providing real-time UI interaction and inspection capabilities.65 npm24MIT
- AlicenseCqualityDmaintenanceEnables AI models to test and interact with Electron applications using Playwright, supporting CDP connection and app launch modes.2840 npmMIT
- AlicenseCqualityDmaintenanceEnables AI coding tools to interact with Electron applications for automated testing, including app lifecycle, element interaction, and visual testing.489 npm1MIT