electron-mcp
MCP server for interacting with and debugging Electron apps, providing tools for window automation, IPC, logs, and main-process state via CDP and Node inspector.
README
@iamvinitk/electron-mcp
MCP server for interacting with and debugging an Electron app. Spawns (or attaches to) an Electron process with the Chrome DevTools Protocol on the renderer and the Node inspector on the main process, then exposes ~20 tools for driving / inspecting both sides.
Works with any Electron or Electron Forge project.
Install
Run it on demand with npx (no install needed):
npx -y @iamvinitk/electron-mcp
…or install the electron-mcp binary globally:
npm i -g @iamvinitk/electron-mcp
electron-mcp
Use it from an MCP client
The server speaks MCP over stdio — point any MCP client at it. For a
typical mcpServers config:
{
"mcpServers": {
"electron": {
"command": "npx",
"args": ["-y", "@iamvinitk/electron-mcp"]
}
}
}
(To run from a local clone instead, npm install && npm run build, then
point your client's command/args at node /path/to/build/index.js.)
Tools
Lifecycle
| Tool | Purpose |
|---|---|
launch_via_npm |
Spawn via npm run <script> (electron-forge dev). |
launch_app |
Spawn the electron binary directly (for packaged/test builds). |
attach_app |
Register an already-running Electron instance. |
stop_app |
Close CDP clients, kill spawned process, drop the session. |
list_apps |
Snapshot every active session (pid, ports, status, uptime). |
ping_inspector |
Zero-cost sanity check that the Node inspector is reachable. |
Window automation
| Tool | Purpose |
|---|---|
list_windows |
Enumerate renderer CDP targets. Skips devtools:// pages. |
evaluate |
Run JS in the renderer via Runtime.evaluate. |
navigate |
Page-navigate the renderer. |
screenshot |
Capture a PNG/JPEG via Page.captureScreenshot. |
Logs & network
| Tool | Purpose |
|---|---|
get_main_logs |
Read captured stdout/stderr from the spawned process. |
get_console_messages |
Read renderer console.* output and exceptions. |
get_network_requests |
Read renderer fetch/XHR activity (e.g. the app's API calls). |
clear_logs |
Wipe one or more ring buffers — useful before recording. |
IPC
| Tool | Purpose |
|---|---|
list_electron_api_methods |
Object.keys(window.electronAPI). |
invoke_electron_api |
Call any preload-exposed IPC method directly. |
enable_ipc_logging |
Inject a proxy that captures every IPC call the renderer makes. |
get_ipc_log |
Drain + read the captured IPC events. |
Main-process state
| Tool | Purpose |
|---|---|
get_app_paths |
app.getPath(...), app.isPackaged, process.resourcesPath, versions. |
read_user_data_file |
Path-traversal-guarded read under app.getPath('userData'). |
Resources
| URI | Purpose |
|---|---|
electron://sessions |
JSON list of every tracked session. |
electron://session/{id} |
Detailed snapshot of one session (windows, recent logs, buffer sizes). |
Typical debug flow
1. launch_via_npm → id=electron-abcd1234
2. list_windows id=... → pick the target id
3. evaluate id=... expr=… → probe renderer state
4. invoke_electron_api → test an IPC handler
5. get_main_logs / get_console_messages / get_network_requests
6. stop_app → tear down
How it works
-
Launch modes.
launch_appinvokes theelectronbinary with--remote-debugging-port=<N> --inspect=<N+?> <appPath>.launch_via_npmwrapsnpm run <script>and smuggles--inspect-electronthrough forge's flag plumbing (double--separators), because forge only exposes main-process inspection that way. -
Two debug channels. Electron renderers are Chromium pages, so they speak CDP on
--remote-debugging-port. The main process is Node, which speaks the (near-identical) Node inspector protocol on--inspect. Both usechrome-remote-interface; we keep per-session client caches so repeated tool calls don't reconnect. -
Log capture. Main-process stdout/stderr flow into a ring buffer on spawn. Renderer console, exceptions, and network events flow into separate ring buffers via CDP event subscribers set up the first time each target's client opens.
enable_ipc_logginginstalls aProxyoverwindow.electronAPIso every IPC call the renderer makes (regardless of origin) is observable; re-injected onPage.frameNavigated. -
Stdin stays open. Electron-forge's
startcommand interprets an EOF on its stdin as "the user left the interactive REPL" and shuts down the child Electron. We hold stdin open (never write to it) so forge keeps running as long as we want.
Limitations
-
Packaged builds. If the app's Electron Forge config disables the
EnableNodeCliInspectArgumentsfuse, that blocks--inspectat the fuse layer in packaged builds. Window automation and renderer-side tools still work against a packaged build if you pass--remote-debugging-port, but main-process tools (get_app_paths,read_user_data_file) need a non-fused dev build. -
Single-process model. One MCP server → any number of tracked sessions. Sessions don't persist across MCP restarts; restart the MCP server to refresh.
-
macOS stdin quirk. Some terminal emulators (rare) block SIGINT delivery through
npm's stdin pipe. Ifstop_appleaves a zombie forge process,pkill -f electron-forgeis the backup.
Development
npm run watch # tsc --watch
npm run typecheck # tsc --noEmit
There are no unit tests in this package. Verification is end-to-end against a running Electron app.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。