Electron Viewer
v1.1.0Drive Electron apps over CDP: screenshots, clicks, drags, keys, JS in renderer and main, logs.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_windows List windows
Lists the running Electron apps (found on CDP ports 9222–9231, launched or attached) and their windows. main=true means the main process is reachable (evaluate_main, real window resizing). Includes the viewer URL to watch a window live in a browser pane.
launch_app Launch app
Starts the Electron project on free debugging ports, so both the renderer (CDP) and the main process (Node inspector) are reachable, and waits for the first window. It runs `electron .` with the project's own Electron, or the launch command configured with --launch-cmd (e.g. a dev server).
| Parameter | Type | Description |
|---|---|---|
project | string | Project folder (default: the folder the viewer or MCP was started in) |
attach Attach to app
Attaches to an Electron app already running with --remote-debugging-port=<port> (and optionally --inspect=<inspect_port> for the main process). Apps on ports 9222–9231 are found without attaching.
| Parameter | Type | Description |
|---|---|---|
port * | integer | CDP port (--remote-debugging-port) |
inspect_port | integer | Main process inspector port (--inspect) |
screenshot Screenshot
Captures the window content (PNG). For click, drag, hover and scroll use normalized coordinates: x = pixel_x / image width, y = pixel_y / image height. Native UI (title bar, menus, dialogs) is not included.
| Parameter | Type | Description |
|---|---|---|
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
click Click
Clicks a point of the window content (Input.dispatchMouseEvent). count=2 is a double click.
| Parameter | Type | Description |
|---|---|---|
x * | number | x coordinate, normalized 0–1 over the screenshot |
y * | number | y coordinate, normalized 0–1 over the screenshot |
button | string | Mouse button |
count | integer | Click count (2 = double click) |
modifiers | array | Modifier keys held during the action (meta = ⌘ on macOS) |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
drag Drag
Presses the left button at one point, moves to another with intermediate steps and releases (a real drag).
| Parameter | Type | Description |
|---|---|---|
x1 * | number | Start x, normalized 0–1 over the screenshot |
x2 * | number | End x, normalized 0–1 over the screenshot |
y1 * | number | Start y, normalized 0–1 over the screenshot |
y2 * | number | End y, normalized 0–1 over the screenshot |
duration_ms | integer | Drag duration in ms |
modifiers | array | Modifier keys held during the action (meta = ⌘ on macOS) |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
hover Hover
Moves the mouse to a point without clicking (hover effects, tooltips).
| Parameter | Type | Description |
|---|---|---|
x * | number | x coordinate, normalized 0–1 over the screenshot |
y * | number | y coordinate, normalized 0–1 over the screenshot |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
tap Tap
Taps a point with one finger (Input.dispatchTouchEvent): the page gets touch and pointer events with pointerType "touch". The first touch action turns on touch emulation for the window (maxTouchPoints, pointer: coarse).
| Parameter | Type | Description |
|---|---|---|
x * | number | x coordinate, normalized 0–1 over the screenshot |
y * | number | y coordinate, normalized 0–1 over the screenshot |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
swipe Swipe
Swipes one finger from one point to another (touch events; use drag for the mouse). Scrolls touch lists and drives swipe gestures.
| Parameter | Type | Description |
|---|---|---|
x1 * | number | Start x, normalized 0–1 over the screenshot |
x2 * | number | End x, normalized 0–1 over the screenshot |
y1 * | number | Start y, normalized 0–1 over the screenshot |
y2 * | number | End y, normalized 0–1 over the screenshot |
duration_ms | integer | Gesture duration in ms |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
long_press Long press
Holds one finger on a point and releases it. Apps that time touchstart themselves see a long press; Chromium on desktop doesn't turn it into a context menu.
| Parameter | Type | Description |
|---|---|---|
x * | number | x coordinate, normalized 0–1 over the screenshot |
y * | number | y coordinate, normalized 0–1 over the screenshot |
duration_ms | integer | How long the finger stays down, in ms |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
pinch Pinch
Two-finger pinch centered on a point: scale > 1 spreads the fingers (zoom in), scale < 1 brings them together.
| Parameter | Type | Description |
|---|---|---|
scale * | number | Final finger distance ÷ initial distance, e.g. 2 or 0.5 |
duration_ms | integer | Gesture duration in ms |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
x | number | Center x, normalized 0–1 over the screenshot |
y | number | Center y, normalized 0–1 over the screenshot |
scroll Scroll
Scrolls with the mouse wheel at a point. Positive delta_y scrolls down; deltas are in CSS pixels.
| Parameter | Type | Description |
|---|---|---|
delta_x | number | Horizontal delta in CSS px |
delta_y | number | Vertical delta in CSS px |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
x | number | x coordinate, normalized 0–1 over the screenshot |
y | number | y coordinate, normalized 0–1 over the screenshot |
type_text Type text
Types text into the focused element (Input.insertText; any Unicode). Click the field first; for Enter or shortcuts use press_key.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to type |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
press_key Press key
Presses a key, optionally with modifiers (e.g. key "a" + ["meta"] selects all on macOS). Named keys: Enter, Tab, Backspace, Delete, Escape, Space, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Home, End, PageUp, PageDown, Insert, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12; or any single character.
| Parameter | Type | Description |
|---|---|---|
key * | string | Key name or single character |
modifiers | array | Modifier keys held during the action (meta = ⌘ on macOS) |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
resize_window Resize window
Sets the size of the window content area in CSS px. With the main process it resizes the real window; if the window cannot reach that size (smaller screen, kiosk, full screen), without the main process or with emulate=true, the page viewport is emulated at the exact size instead. Width and height 0 restore the window size.
| Parameter | Type | Description |
|---|---|---|
height * | integer | Content height in CSS px |
width * | integer | Content width in CSS px |
emulate | boolean | Emulate the viewport without touching the real window |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
reload Reload
Reloads the page of the window (renderer only; the main process keeps running).
| Parameter | Type | Description |
|---|---|---|
ignore_cache | boolean | Bypass the cache |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
evaluate Evaluate in renderer
Evaluates a JavaScript expression in the window page (main world) and returns its JSON value. Promises are awaited.
| Parameter | Type | Description |
|---|---|---|
expression * | string | JavaScript expression |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
evaluate_main Evaluate in main process
Evaluates a JavaScript expression in the app's main process (Node inspector) and returns its JSON value. `require` is available, e.g. require('electron').BrowserWindow.getAllWindows().map(w => w.getTitle()). Promises are awaited. Needs main=true in list_windows.
| Parameter | Type | Description |
|---|---|---|
expression * | string | JavaScript expression |
app | string | App: id (its CDP port) or name from list_windows. Optional with a single app. |
get_accessibility_tree Accessibility tree
Returns the accessibility tree of the window as indented text (role "name" value [state]). Interactive elements carry @(x, y): their center, normalized like click coordinates.
| Parameter | Type | Description |
|---|---|---|
interactive_only | boolean | Only interactive elements, as a flat list |
window | string | Window: target id from list_windows or part of its title. Optional when only one window is open. |
get_console_logs Console logs
Console messages and uncaught exceptions of the app: renderer windows and main process (up to the last 1000). source "stdout" returns the raw output of an app started with launch_app.
| Parameter | Type | Description |
|---|---|---|
app | string | App: id (its CDP port) or name from list_windows. Optional with a single app. |
level | string | Comma-separated levels to keep: log, info, warn, error, debug |
limit | integer | Most recent entries to return |
source | string | Where the messages come from |
window | string | Only this window (plus the main process) |