The in-app runtime of electron-agent-bridge:
it lets AI agents, scripts and tests see and drive your Electron app (its pages, IPC, logs, network,
state and main process) through the eab CLI, the MCP server and the Node API.
Off unless EAB_ENABLE=1, refused in packaged builds unless you opt in, reachable only through a
private local socket with a token. Electron 35 or later.
npm install --save-dev @electron-agent-bridge/electron @electron-agent-bridge/mcp
@electron-agent-bridge/mcp brings the eab CLI and the
eab-mcp server that talk to the runtime.
Make it the first import of your main process:
import '@electron-agent-bridge/electron/register'; // ESM
// require('@electron-agent-bridge/electron/register'); // CommonJS
Start the app with the bridge on, then look at it from another terminal:
EAB_ENABLE=1 npm start
npx eab list # running apps the bridge can reach
npx eab snapshot # what the focused window shows
Or give an agent the app: claude mcp add eab -- npx eab-mcp (any MCP host works).
No code change at all? npx eab launch ./node_modules/.bin/electron -- . injects the runtime into an
unmodified development build (Launch mode).
register uses the defaults. For options, call enableAgentBridge first thing instead:
import { enableAgentBridge } from '@electron-agent-bridge/electron';
enableAgentBridge({
ipc: { values: ['settings:*'] }, // record argument values (redacted) for these channels; others: shapes only
logs: { mainConsole: true }, // also record the main process's console
capabilities: ['observe', 'interact'], // what clients may do (no `eval` unless listed)
});
| Option | What it does |
|---|---|
allowPackaged |
Run in packaged builds too (still needs EAB_ENABLE=1). |
capabilities |
Ceiling for clients: observe, interact, eval. |
ipc.values |
Channel globs whose argument values are recorded (redacted). |
logs.mainConsole, logs.sources, logs.sourceMaps |
Main-process console, custom loggers (addLogSource, loggerSource), source-mapped stacks (default on). |
state.devtoolsShim |
Find Redux / Zustand / MobX stores through a devtools-extension shim. |
audit |
Audit log path, or false. |
| Import | For |
|---|---|
@electron-agent-bridge/electron/register |
One-line install with defaults (main process). |
@electron-agent-bridge/electron |
enableAgentBridge, nameTarget, addLogSource, loggerSource. |
@electron-agent-bridge/electron/renderer |
registerState(name, store) to expose a store to agents (renderer). |
@electron-agent-bridge/electron/inject |
Used by Launch mode; not imported by apps. |
Modes · IPC · Logs and network · State · Main control · Bundlers · Security
MIT licensed.
@electron-agent-bridge/electron: In-app runtime for the Electron main process, preload and renderer. Off unless explicitly enabled.