chromex-mcp 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +242 -26
- package/docs/advanced.md +301 -0
- package/docs/architecture.md +176 -0
- package/docs/data.md +235 -0
- package/docs/emulation.md +179 -0
- package/docs/forms.md +220 -0
- package/docs/getting-started.md +196 -0
- package/docs/inspect.md +346 -0
- package/docs/navigate.md +330 -0
- package/docs/network.md +218 -0
- package/docs/security.md +178 -0
- package/docs/troubleshooting.md +113 -0
- package/package.json +5 -3
- package/plugins/chromex/skills/chromex/scripts/chromex.mjs +417 -55
- package/plugins/chromex/skills/chromex/scripts/lib/artifacts.mjs +55 -0
- package/plugins/chromex/skills/chromex/scripts/lib/browser-pipe-broker.mjs +203 -0
- package/plugins/chromex/skills/chromex/scripts/lib/browser.mjs +209 -19
- package/plugins/chromex/skills/chromex/scripts/lib/client.mjs +138 -20
- package/plugins/chromex/skills/chromex/scripts/lib/commands/app.mjs +6 -3
- package/plugins/chromex/skills/chromex/scripts/lib/commands/audit.mjs +2 -1
- package/plugins/chromex/skills/chromex/scripts/lib/commands/console.mjs +61 -16
- package/plugins/chromex/skills/chromex/scripts/lib/commands/diagnose.mjs +72 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/dialog.mjs +2 -1
- package/plugins/chromex/skills/chromex/scripts/lib/commands/doctor.mjs +8 -9
- package/plugins/chromex/skills/chromex/scripts/lib/commands/download.mjs +3 -1
- package/plugins/chromex/skills/chromex/scripts/lib/commands/evaluate.mjs +1 -1
- package/plugins/chromex/skills/chromex/scripts/lib/commands/evidence.mjs +285 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/extensions.mjs +182 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/har.mjs +14 -9
- package/plugins/chromex/skills/chromex/scripts/lib/commands/heap.mjs +78 -16
- package/plugins/chromex/skills/chromex/scripts/lib/commands/inspect.mjs +96 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/intercept.mjs +133 -38
- package/plugins/chromex/skills/chromex/scripts/lib/commands/issues.mjs +78 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/locator.mjs +173 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/network.mjs +122 -25
- package/plugins/chromex/skills/chromex/scripts/lib/commands/pdf.mjs +3 -2
- package/plugins/chromex/skills/chromex/scripts/lib/commands/perf.mjs +157 -86
- package/plugins/chromex/skills/chromex/scripts/lib/commands/screencast.mjs +167 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/screenshot.mjs +6 -4
- package/plugins/chromex/skills/chromex/scripts/lib/commands/show.mjs +308 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/snapshot.mjs +39 -3
- package/plugins/chromex/skills/chromex/scripts/lib/commands/state.mjs +86 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/stats.mjs +7 -4
- package/plugins/chromex/skills/chromex/scripts/lib/commands/tab.mjs +6 -1
- package/plugins/chromex/skills/chromex/scripts/lib/commands/third-party.mjs +128 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/trace.mjs +109 -45
- package/plugins/chromex/skills/chromex/scripts/lib/commands/wait.mjs +2 -1
- package/plugins/chromex/skills/chromex/scripts/lib/commands/webmcp.mjs +150 -0
- package/plugins/chromex/skills/chromex/scripts/lib/config.mjs +20 -3
- package/plugins/chromex/skills/chromex/scripts/lib/daemon.mjs +225 -31
- package/plugins/chromex/skills/chromex/scripts/lib/heap-analysis.mjs +434 -0
- package/plugins/chromex/skills/chromex/scripts/lib/heap-worker.mjs +12 -0
- package/plugins/chromex/skills/chromex/scripts/lib/ipc.mjs +6 -0
- package/plugins/chromex/skills/chromex/scripts/lib/json-schema.mjs +39 -0
- package/plugins/chromex/skills/chromex/scripts/lib/launcher.mjs +143 -12
- package/plugins/chromex/skills/chromex/scripts/lib/redaction.mjs +75 -0
- package/plugins/chromex/skills/chromex/scripts/lib/security.mjs +5 -3
- package/plugins/chromex/skills/chromex/scripts/lib/sessions.mjs +92 -0
- package/plugins/chromex/skills/chromex/scripts/mcp-server.mjs +412 -44
package/README.md
CHANGED
|
@@ -4,14 +4,26 @@
|
|
|
4
4
|
[](https://nodejs.org/)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
|
-
Chromex is
|
|
7
|
+
Chromex is an agent-first browser automation and DevTools toolkit that connects directly to Chrome, Brave, Edge, Chromium, and Vivaldi through CDP. It exposes the complete capability set through a token-efficient CLI and 85 typed MCP tools, with zero runtime dependencies.
|
|
8
8
|
|
|
9
|
-
Use Chromex when an agent needs to
|
|
9
|
+
Use Chromex when an agent needs to automate a real logged-in browser, inspect page and Application state, debug console/network failures, profile performance or memory, test extensions and WebMCP, or collect reproducible evidence without pulling in a heavy browser automation runtime.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g chromex-mcp
|
|
15
|
+
chromex --version
|
|
16
|
+
chromex launch --pipe --url https://example.com
|
|
17
|
+
chromex list
|
|
18
|
+
chromex snap <target> --refs
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`launch --pipe` is the recommended path for repeatable AI sessions: it starts an isolated Chromex profile and avoids Chrome's recurring debugging approval prompt. Use the normal WebSocket mode only when access to an already-running personal browser is intentional.
|
|
10
22
|
|
|
11
23
|
## Why Chromex
|
|
12
24
|
|
|
13
25
|
- **CLI-first for lower token usage**: terminal commands return compact plain text and avoid MCP tool-schema overhead.
|
|
14
|
-
- **Optional MCP server**:
|
|
26
|
+
- **Optional MCP server**: 85 typed tools in the full set, plus focused `core` and `devtools` toolsets for sessions where schema cost matters.
|
|
15
27
|
- **No runtime dependencies**: Node.js 22+ built-ins only, including native WebSocket support.
|
|
16
28
|
- **Agent-friendly page model**: accessibility snapshots, `@eN` refs, incremental diffs, query filters, auto-snapshots, and contextual hints.
|
|
17
29
|
- **Persistent per-tab daemons**: one CDP session per tab, held open through an authenticated Unix socket.
|
|
@@ -21,13 +33,29 @@ Use Chromex when an agent needs to inspect pages, take screenshots, navigate, cl
|
|
|
21
33
|
## What You Can Do Today
|
|
22
34
|
|
|
23
35
|
- Inspect and automate real logged-in browser sessions, not only fresh headless test contexts.
|
|
36
|
+
- Use `--raw` and `--json` for stable pipes, CI, MCP wrappers, and agent-to-agent integrations.
|
|
37
|
+
- Create named sessions with isolated browser contexts, reusable targets, and local session dashboards.
|
|
24
38
|
- Read page state through compact accessibility snapshots, filtered snapshots, DOM snapshots, HTML, screenshots, and highlighted elements.
|
|
25
39
|
- Act on UI through refs, CSS selectors, coordinates, keyboard input, forms, uploads, drag and drop, touch gestures, dialogs, and load-more loops.
|
|
26
40
|
- Debug production behavior with console history, network request details, response bodies, HAR export, request blocking, API mocking, throttling, and offline mode.
|
|
27
41
|
- Test browser conditions with device presets, viewport resizing, DPR, geolocation, timezone, locale, CPU throttling, incognito contexts, proxies, and custom Chrome flags.
|
|
28
42
|
- Diagnose performance and quality with Core Web Vitals, transfer size, DOM/memory counters, Lighthouse audits, JS/CSS coverage, Chrome traces, and heap snapshots.
|
|
29
|
-
-
|
|
43
|
+
- Inspect Browser Issues, computed and matched CSS, event listeners, box models, prioritized runtime diagnoses, CPU profiles, heap retaining paths, duplicate strings, and trace insights.
|
|
44
|
+
- Capture bounded screencasts with a local replay, manage extensions in trusted pipe mode, and discover or execute WebMCP and page-exposed developer tools.
|
|
45
|
+
- Build evidence packs with screenshots, snapshots, HTML, console, network timeline, action timeline, and replay HTML.
|
|
46
|
+
- Validate modern browser flows such as passkey/WebAuthn registration and login, downloads, cookies, portable storage state, PDF export, and isolated profiles.
|
|
30
47
|
- Inspect Application panel state from the terminal: origin quota, storage usage breakdown, Cache Storage entries/bodies, IndexedDB schemas/rows, and Service Worker registrations.
|
|
48
|
+
- Turn `@eN` refs into locators and optional `chromex-test` action code.
|
|
49
|
+
|
|
50
|
+
The CLI and the default MCP `full` toolset expose the same capability families. CLI commands group related operations into subcommands, while MCP presents 85 individually typed tools.
|
|
51
|
+
|
|
52
|
+
| Capability | CLI | MCP `full` |
|
|
53
|
+
|------------|-----|------------|
|
|
54
|
+
| Input, navigation, forms, uploads, dialogs, and emulation | Yes | Yes |
|
|
55
|
+
| Console, network, Application state, interception, HAR, and audits | Yes | Yes |
|
|
56
|
+
| Browser Issues, CSS/listener/box inspection, and runtime diagnosis | Yes | Yes |
|
|
57
|
+
| Web Vitals, CPU profiles, heap sampling, traces, and heap analysis | Yes | Yes |
|
|
58
|
+
| Screencasts, extensions, page developer tools, and WebMCP | Yes | Yes |
|
|
31
59
|
|
|
32
60
|
## Positioning
|
|
33
61
|
|
|
@@ -36,7 +64,7 @@ Chromex is a direct CDP layer for coding agents. It sits between raw Chrome DevT
|
|
|
36
64
|
| Alternative | Trade-off | Chromex angle |
|
|
37
65
|
|-------------|-----------|---------------|
|
|
38
66
|
| Raw CDP WebSocket | Maximum browser power, but too verbose for agents. | Compact commands, refs, snapshots, and safety defaults. |
|
|
39
|
-
|
|
|
67
|
+
| Heavy browser automation libraries | Excellent automation frameworks, but they add dependencies and framework-level abstractions. | Zero-runtime-dependency CLI/MCP that talks to your existing Chromium browser. |
|
|
40
68
|
| Browser MCP only | Easy tool discovery, but tool schemas and structured responses add token cost. | CLI-first for cheap agent loops, MCP when typed tools are worth the overhead. |
|
|
41
69
|
| Manual DevTools | Great for humans, not scriptable enough for agents. | DevTools-grade inspection exposed as terminal and MCP commands. |
|
|
42
70
|
|
|
@@ -48,7 +76,7 @@ Chromex is a direct CDP layer for coding agents. It sits between raw Chrome DevT
|
|
|
48
76
|
|
|
49
77
|
## Zero-Dependency Boundary
|
|
50
78
|
|
|
51
|
-
The core runtime uses only Node.js built-in modules. Chromex does not install
|
|
79
|
+
The core runtime uses only Node.js built-in modules. Chromex does not install heavy browser automation runtimes, Selenium, browser drivers, telemetry SDKs, update checkers, or bundled browsers.
|
|
52
80
|
|
|
53
81
|
The only exception is the optional `audit` command: it shells out to Lighthouse with `npx --yes lighthouse` when you explicitly run an audit. All other CLI and MCP commands run through Chromex's own CDP client.
|
|
54
82
|
|
|
@@ -73,11 +101,16 @@ chromex launch --browser brave --url https://example.com
|
|
|
73
101
|
chromex launch --profile testing --url https://example.com
|
|
74
102
|
chromex launch --incognito --browser chrome
|
|
75
103
|
chromex launch --headless --url https://example.com
|
|
104
|
+
chromex launch --pipe --url https://example.com
|
|
105
|
+
chromex launch --extension-tools --url about:blank
|
|
106
|
+
chromex launch --webmcp --url https://example.com
|
|
76
107
|
chromex launch --browser-path "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
|
|
77
108
|
```
|
|
78
109
|
|
|
79
110
|
Named profiles are stored under `~/.chromex/profiles/` and keep test sessions isolated from your daily browser profile.
|
|
80
111
|
|
|
112
|
+
`chromex launch --pipe` is the preferred mode for repeated AI sessions. It uses one permission-protected local Unix-socket broker over Chrome's remote-debugging pipe, avoids approval modals, and lets CLI and MCP clients share the same browser connection. `--extension-tools` implies pipe mode because Chrome restricts extension lifecycle APIs to trusted debugging sessions. WebMCP requires a visible supported Chrome build, so do not combine `--webmcp` with `--headless` when the page tools must execute.
|
|
113
|
+
|
|
81
114
|
Chrome for Testing also works well with Chromex. Download it manually from Google's official Chrome for Testing channel, then point Chromex at the executable with `--browser-path` or `CHROMEX_BROWSER_PATH`. Chromex does not download or bundle a browser.
|
|
82
115
|
|
|
83
116
|
### Option B: Connect to an Already-Running Browser
|
|
@@ -97,7 +130,9 @@ Important notes:
|
|
|
97
130
|
|
|
98
131
|
- Without remote debugging enabled, Chromex cannot discover or control your open tabs.
|
|
99
132
|
- The browser setting is usually persistent across restarts.
|
|
100
|
-
-
|
|
133
|
+
- Chrome may show an "Allow debugging" prompt for each new DevTools WebSocket connection to a normal browser profile. This is browser security behavior, so reconnecting from a new CLI or agent process can show it again.
|
|
134
|
+
- Per-tab daemons and the persistent MCP connection reduce reconnections, but they do not bypass Chrome's protection for a personal browser profile.
|
|
135
|
+
- Use `chromex launch --pipe` with a Chromex-managed isolated profile when a modal-free persistent AI connection is required.
|
|
101
136
|
|
|
102
137
|
If your browser uses a custom profile or a non-standard `DevToolsActivePort` location, set:
|
|
103
138
|
|
|
@@ -129,6 +164,15 @@ npm install -g chromex-mcp
|
|
|
129
164
|
bun add -g chromex-mcp
|
|
130
165
|
```
|
|
131
166
|
|
|
167
|
+
Verify which installation every terminal and agent session will use:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
command -v chromex
|
|
171
|
+
chromex --version
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Cloning the repository does not replace an existing global installation. To test the current checkout directly, run `node bin/chromex.mjs`. To deliberately install the current checkout globally, run `npm install -g .` from the repository root and verify the path and version again.
|
|
175
|
+
|
|
132
176
|
The package installs three binaries:
|
|
133
177
|
|
|
134
178
|
| Binary | Purpose |
|
|
@@ -163,12 +207,22 @@ chromex click 6BE8 @e3
|
|
|
163
207
|
# 5. Inspect browser state.
|
|
164
208
|
chromex console 6BE8 list
|
|
165
209
|
chromex net 6BE8
|
|
166
|
-
chromex shot 6BE8
|
|
210
|
+
chromex shot 6BE8
|
|
167
211
|
chromex app 6BE8
|
|
168
212
|
```
|
|
169
213
|
|
|
170
214
|
`<target>` is a unique prefix of the tab target ID returned by `chromex list`. If a prefix is ambiguous, Chromex rejects it and asks for more characters.
|
|
171
215
|
|
|
216
|
+
For repeatable agent workflows, use named sessions instead of carrying target IDs manually:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
chromex -s auth open https://github.com/login
|
|
220
|
+
chromex -s auth snap --refs
|
|
221
|
+
chromex -s auth fill @e1 "user@example.com"
|
|
222
|
+
chromex -s auth state save ~/.chromex/storage/auth.json
|
|
223
|
+
chromex sessions
|
|
224
|
+
```
|
|
225
|
+
|
|
172
226
|
## Token-Efficient Agent Workflow
|
|
173
227
|
|
|
174
228
|
Chromex is optimized for agents that need to act on browser state without wasting context.
|
|
@@ -180,6 +234,8 @@ Chromex is optimized for agents that need to act on browser state without wastin
|
|
|
180
234
|
5. Let auto-snapshot show post-action state after interactive commands.
|
|
181
235
|
6. Add `--no-snap` only for fast scripted batches where you do not need immediate page state.
|
|
182
236
|
7. Add `--no-hints` when another program parses output strictly.
|
|
237
|
+
8. Use `--raw` for pipes and `--json` when another tool needs the stable envelope.
|
|
238
|
+
9. Save large snapshots with `--filename` when they are better as artifacts than inline text.
|
|
183
239
|
|
|
184
240
|
Examples:
|
|
185
241
|
|
|
@@ -188,6 +244,11 @@ chromex snap 6BE8 --query=login --refs
|
|
|
188
244
|
chromex click 6BE8 @e4
|
|
189
245
|
chromex wait 6BE8 networkidle
|
|
190
246
|
chromex snap 6BE8 --query=error
|
|
247
|
+
chromex --raw eval 6BE8 "document.title"
|
|
248
|
+
chromex list --json
|
|
249
|
+
chromex snap 6BE8 --filename=~/.chromex/snapshots/login.yml --boxes
|
|
250
|
+
chromex locator 6BE8 @e4 --format=chromex-test
|
|
251
|
+
chromex click 6BE8 @e4 --code=chromex-test
|
|
191
252
|
```
|
|
192
253
|
|
|
193
254
|
## MCP Server
|
|
@@ -200,23 +261,48 @@ Global, available in all projects:
|
|
|
200
261
|
|
|
201
262
|
```bash
|
|
202
263
|
# npm
|
|
203
|
-
claude mcp add chromex
|
|
264
|
+
claude mcp add chromex --scope user -- npx -y chromex-mcp@latest
|
|
204
265
|
|
|
205
266
|
# Bun
|
|
206
|
-
claude mcp add chromex
|
|
267
|
+
claude mcp add chromex --scope user -- bunx chromex-mcp@latest
|
|
207
268
|
```
|
|
208
269
|
|
|
209
270
|
Project-only:
|
|
210
271
|
|
|
211
272
|
```bash
|
|
212
273
|
# npm
|
|
213
|
-
claude mcp add chromex npx chromex-mcp@latest
|
|
274
|
+
claude mcp add chromex -- npx -y chromex-mcp@latest
|
|
214
275
|
|
|
215
276
|
# Bun
|
|
216
|
-
claude mcp add chromex bunx chromex-mcp@latest
|
|
277
|
+
claude mcp add chromex -- bunx chromex-mcp@latest
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
For MCP clients that accept a standard stdio configuration, point the client at the installed binary:
|
|
281
|
+
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"mcpServers": {
|
|
285
|
+
"chromex": {
|
|
286
|
+
"command": "chromex-mcp",
|
|
287
|
+
"args": []
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
217
291
|
```
|
|
218
292
|
|
|
219
|
-
After setup, the MCP client can call tools such as `chromex_list`, `chromex_snapshot`, `chromex_click`, `chromex_fill`, `
|
|
293
|
+
After setup, the MCP client can call tools such as `chromex_list`, `chromex_snapshot`, `chromex_click`, `chromex_fill`, `chromex_network`, `chromex_issues`, `chromex_inspect`, `chromex_diagnose`, `chromex_perf`, `chromex_trace`, `chromex_heap`, `chromex_screencast`, `chromex_extensions`, `chromex_third_party`, `chromex_webmcp`, `chromex_app_summary`, `chromex_cache_entries`, `chromex_indexeddb_rows`, and `chromex_evidence`.
|
|
294
|
+
|
|
295
|
+
Tools that produce machine-readable data or artifacts also include MCP `structuredContent`, so agents can read paths and metadata without parsing the human text block.
|
|
296
|
+
|
|
297
|
+
The default `full` toolset exposes all 85 tools. Use a focused toolset when the MCP client sends every schema into the model context:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
chromex-mcp --toolset=core
|
|
301
|
+
chromex-mcp --toolset=devtools
|
|
302
|
+
CHROMEX_TOOLSET=full chromex-mcp
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
`core` exposes 24 navigation, inspection, input, form, and emulation tools. `devtools` exposes 26 browser-diagnostics, performance, trace, heap, Application, and audit tools. This selection changes discovery only; the complete CLI and the default MCP toolset retain every capability.
|
|
220
306
|
|
|
221
307
|
### Claude Code Auto-Approve
|
|
222
308
|
|
|
@@ -271,12 +357,20 @@ claude mcp remove chromex
|
|
|
271
357
|
|
|
272
358
|
```bash
|
|
273
359
|
chromex list
|
|
360
|
+
chromex list --include-sensitive
|
|
274
361
|
chromex open "https://example.com"
|
|
362
|
+
chromex -s auth open "https://example.com/login"
|
|
363
|
+
chromex -s auth snap --refs
|
|
364
|
+
chromex sessions
|
|
365
|
+
chromex show --annotate
|
|
275
366
|
chromex close <target>
|
|
276
367
|
chromex focus <target>
|
|
277
368
|
chromex launch --url https://example.com
|
|
278
369
|
chromex launch --browser brave --incognito
|
|
279
370
|
chromex launch --headless --url https://example.com
|
|
371
|
+
chromex launch --pipe --url https://example.com
|
|
372
|
+
chromex launch --extension-tools --url about:blank
|
|
373
|
+
chromex launch --webmcp --url https://example.com
|
|
280
374
|
chromex launch --browser-path /path/to/chrome --url https://example.com
|
|
281
375
|
chromex doctor
|
|
282
376
|
chromex incognito https://example.com
|
|
@@ -288,14 +382,25 @@ chromex stop
|
|
|
288
382
|
```bash
|
|
289
383
|
chromex snap <target> --refs
|
|
290
384
|
chromex snap <target> --query=login
|
|
385
|
+
chromex snap <target> --filename=~/.chromex/snapshots/login.yml --boxes
|
|
291
386
|
chromex html <target> "#main"
|
|
292
|
-
chromex shot <target>
|
|
293
|
-
chromex shot <target> /
|
|
387
|
+
chromex shot <target>
|
|
388
|
+
chromex shot <target> ~/.chromex/screenshots/full.png --full
|
|
294
389
|
chromex shot <target> @e5
|
|
295
390
|
chromex console <target> list
|
|
296
391
|
chromex net <target>
|
|
392
|
+
chromex net <target> <requestId> --include-sensitive
|
|
393
|
+
chromex net <target> <requestId> --body-limit=100000
|
|
297
394
|
chromex perf <target>
|
|
298
395
|
chromex domsnapshot <target> --styles
|
|
396
|
+
chromex issues <target> enable
|
|
397
|
+
chromex issues <target> list
|
|
398
|
+
chromex inspect <target> all "#checkout"
|
|
399
|
+
chromex diagnose <target>
|
|
400
|
+
chromex evidence <target> start checkout-flow
|
|
401
|
+
chromex evidence <target> mark "after login"
|
|
402
|
+
chromex evidence <target> stop
|
|
403
|
+
chromex evidence <target> replay
|
|
299
404
|
```
|
|
300
405
|
|
|
301
406
|
### Navigate and Wait
|
|
@@ -317,6 +422,8 @@ chromex clickxy <target> 100 200
|
|
|
317
422
|
chromex key <target> Enter
|
|
318
423
|
chromex type <target> "hello world"
|
|
319
424
|
chromex hover <target> @e12
|
|
425
|
+
chromex locator <target> @e12 --format=chromex-test
|
|
426
|
+
chromex click <target> @e12 --code=chromex-test
|
|
320
427
|
chromex drag <target> "#source" "#dest"
|
|
321
428
|
chromex dialog <target> accept
|
|
322
429
|
```
|
|
@@ -340,6 +447,8 @@ chromex cookies <target> set '{"name":"token","value":"abc"}'
|
|
|
340
447
|
chromex storage <target> local
|
|
341
448
|
chromex storage <target> session
|
|
342
449
|
chromex storage <target> usage
|
|
450
|
+
chromex state <target> save ~/.chromex/storage/auth.json
|
|
451
|
+
chromex state <target> load ~/.chromex/storage/auth.json
|
|
343
452
|
chromex app <target> summary
|
|
344
453
|
chromex sw <target>
|
|
345
454
|
chromex cache <target> list
|
|
@@ -347,7 +456,7 @@ chromex cache <target> entries <cacheId> --query=/api
|
|
|
347
456
|
chromex idb <target> list
|
|
348
457
|
chromex idb <target> schema <databaseName>
|
|
349
458
|
chromex idb <target> rows <databaseName> <objectStoreName> --limit=20
|
|
350
|
-
chromex pdf <target>
|
|
459
|
+
chromex pdf <target>
|
|
351
460
|
```
|
|
352
461
|
|
|
353
462
|
### Network, Emulation, and Diagnostics
|
|
@@ -355,8 +464,12 @@ chromex pdf <target> /tmp/page.pdf
|
|
|
355
464
|
```bash
|
|
356
465
|
chromex throttle <target> 3g
|
|
357
466
|
chromex intercept <target> block "*.analytics.*"
|
|
467
|
+
chromex intercept <target> mock "/api/user" --status=200 --content-type=application/json --body='{"ok":true}'
|
|
468
|
+
chromex intercept <target> mock "/api/slow" --delay=750 --status=503 --body='unavailable'
|
|
469
|
+
chromex intercept <target> block "*.tracker.*" --abort=blockedbyclient
|
|
470
|
+
chromex intercept <target> on --remove-header=authorization
|
|
358
471
|
chromex har <target> start
|
|
359
|
-
chromex har <target> stop /
|
|
472
|
+
chromex har <target> stop ~/.chromex/har/trace.har
|
|
360
473
|
chromex emulate <target> iphone-15-pro
|
|
361
474
|
chromex resize <target> 1280 720
|
|
362
475
|
chromex geo <target> -23.55 -46.63
|
|
@@ -372,10 +485,16 @@ chromex stats <target> --full
|
|
|
372
485
|
chromex eval <target> "document.title"
|
|
373
486
|
chromex evalraw <target> "Page.getLayoutMetrics"
|
|
374
487
|
chromex inject <target> "window.DEBUG=true"
|
|
375
|
-
chromex download <target> allow /
|
|
488
|
+
chromex download <target> allow ~/.chromex/downloads
|
|
376
489
|
chromex coverage <target> start
|
|
377
490
|
chromex trace <target> start
|
|
378
|
-
chromex
|
|
491
|
+
chromex trace <target> insights
|
|
492
|
+
chromex heap <target> snapshot ~/.chromex/heap/heap.heapsnapshot
|
|
493
|
+
chromex heap <target> summary
|
|
494
|
+
chromex screencast <target> start --max-frames=120
|
|
495
|
+
chromex extensions <target> list
|
|
496
|
+
chromex third-party <target> list
|
|
497
|
+
chromex webmcp <target> list
|
|
379
498
|
chromex webauthn <target> enable
|
|
380
499
|
```
|
|
381
500
|
|
|
@@ -433,9 +552,77 @@ help[3]:
|
|
|
433
552
|
|
|
434
553
|
Disable hints with `--no-hints`.
|
|
435
554
|
|
|
555
|
+
### Stable Output and Artifacts
|
|
556
|
+
|
|
557
|
+
Chromex keeps plain text as the default output, but also supports stable modes for scripts:
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
chromex --raw eval <target> "document.title"
|
|
561
|
+
chromex list --json
|
|
562
|
+
chromex snap <target> --filename=~/.chromex/snapshots/home.yml --boxes
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
`--raw` prints only the primary command output and suppresses hints and auto-snapshot noise. `--json` returns a stable envelope with `ok`, `command`, `target`, `text`, `data`, `artifacts`, and `error`.
|
|
566
|
+
|
|
567
|
+
Generated artifacts are written under `~/.chromex/artifacts/<workspace>/` by default. Paths in the Chromex namespace, such as `.chromex/storage/auth.json` or `~/.chromex/storage/auth.json`, resolve to `~/.chromex/...`. Other explicit absolute or relative file paths are respected as provided. Set `CHROMEX_ARTIFACT_ROOT` to override the default artifact root for CI or tests.
|
|
568
|
+
|
|
569
|
+
### Named Sessions
|
|
570
|
+
|
|
571
|
+
Named sessions let agents reuse isolated browser contexts without carrying target IDs:
|
|
572
|
+
|
|
573
|
+
```bash
|
|
574
|
+
chromex -s auth open https://example.com/login
|
|
575
|
+
chromex -s auth snap --refs
|
|
576
|
+
chromex -s auth click @e3
|
|
577
|
+
chromex sessions
|
|
578
|
+
chromex show --annotate
|
|
579
|
+
chromex close-all
|
|
580
|
+
chromex delete-data auth
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
`CHROMEX_SESSION=auth` can replace `-s auth` for shell scripts.
|
|
584
|
+
`chromex show` opens the generated dashboard in the default browser during normal CLI usage; set `CHROMEX_NO_OPEN=1` or use `--json`/`--raw` to only write the artifact.
|
|
585
|
+
|
|
586
|
+
Named sessions keep a private storage-state file under `~/.chromex/session-data/<name>/storage-state.json`. Chromex restores it when the named session is reopened and refreshes it after state-changing session commands.
|
|
587
|
+
|
|
588
|
+
`chromex show --annotate` generates a local dashboard with screenshot previews, region/point marking, per-mark notes, and JSON export. Browsers with File System Access support can save the exported pack directly; other browsers download the JSON file.
|
|
589
|
+
|
|
590
|
+
### Storage State and Locators
|
|
591
|
+
|
|
592
|
+
Storage state captures cookies plus localStorage for the current origin:
|
|
593
|
+
|
|
594
|
+
```bash
|
|
595
|
+
chromex state <target> save ~/.chromex/storage/auth.json
|
|
596
|
+
chromex state <target> load ~/.chromex/storage/auth.json
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
Refs can also be converted into reusable locator output or starter action code:
|
|
600
|
+
|
|
601
|
+
```bash
|
|
602
|
+
chromex locator <target> @e5 --format=chromex-test
|
|
603
|
+
chromex locator <target> @e5 --format=css
|
|
604
|
+
chromex locator <target> @e5 --format=testing-library
|
|
605
|
+
chromex fill <target> @e1 "user@example.com" --code=chromex-test
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
### Evidence Packs
|
|
609
|
+
|
|
610
|
+
Evidence packs collect browser evidence without recording video:
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
chromex evidence <target> start checkout-flow
|
|
614
|
+
chromex click <target> @e3
|
|
615
|
+
chromex fill <target> @e5 "user@example.com"
|
|
616
|
+
chromex evidence <target> mark "after login"
|
|
617
|
+
chromex evidence <target> stop
|
|
618
|
+
chromex evidence <target> replay
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
Each pack is written under `~/.chromex/artifacts/<workspace>/evidence/` and includes screenshots, accessibility snapshots with boxes, HTML captures, console JSON, network JSON, action timeline, `evidence.json`, and `index.html` for local replay. Values passed to `fill`, `type`, and `form` are redacted from the action timeline.
|
|
622
|
+
|
|
436
623
|
## Application State Suite
|
|
437
624
|
|
|
438
|
-
Chromex exposes browser Application panel state without
|
|
625
|
+
Chromex exposes browser Application panel state without heavy browser automation runtimes or extra packages. This is useful for debugging PWAs, offline behavior, stale caches, local database migrations, authentication state, and quota issues from the same logged-in browser session an agent is already using.
|
|
439
626
|
|
|
440
627
|
```bash
|
|
441
628
|
# One-line overview for the current origin
|
|
@@ -475,7 +662,24 @@ Chromex creates `~/.chromex/config.json` on first run:
|
|
|
475
662
|
"idleTimeout": 1200000,
|
|
476
663
|
"allowedDomains": [],
|
|
477
664
|
"blockedDomains": [],
|
|
478
|
-
"blockedCdpMethods": [
|
|
665
|
+
"blockedCdpMethods": [
|
|
666
|
+
"Network.enable",
|
|
667
|
+
"Network.setRequestInterception",
|
|
668
|
+
"Network.setCacheDisabled",
|
|
669
|
+
"Page.setDocumentContent",
|
|
670
|
+
"Security.disable",
|
|
671
|
+
"Security.setIgnoreCertificateErrors",
|
|
672
|
+
"Fetch.enable",
|
|
673
|
+
"Fetch.fulfillRequest",
|
|
674
|
+
"Fetch.continueRequest",
|
|
675
|
+
"Browser.close",
|
|
676
|
+
"Browser.crashGpuProcess",
|
|
677
|
+
"Target.disposeBrowserContext",
|
|
678
|
+
"SystemInfo.getProcessInfo",
|
|
679
|
+
"Storage.clearDataForOrigin",
|
|
680
|
+
"Storage.getCookies",
|
|
681
|
+
"IndexedDB.requestData"
|
|
682
|
+
],
|
|
479
683
|
"auditLog": true,
|
|
480
684
|
"socketAuth": true
|
|
481
685
|
}
|
|
@@ -489,18 +693,21 @@ Recommended security practices:
|
|
|
489
693
|
- Keep `auditLog` enabled and review `~/.chromex/audit.log` when needed.
|
|
490
694
|
- Prefer `chromex launch --profile testing` for isolated browser state.
|
|
491
695
|
|
|
696
|
+
Page URLs, network, console, extension-storage, third-party, and WebMCP outputs redact secret-shaped headers and fields by default. The browser still sends and receives the original values. Use CLI `--include-sensitive` or MCP `includeSensitive: true` only on the specific live call that needs exact values. Audit logs, page caches, stats, HAR, and structured evidence timelines, network data, and console data remain redacted even when a live response is revealed. Screenshots, screencasts, snapshots, HTML, traces, heap snapshots, and raw page content can still contain sensitive information and should be handled accordingly.
|
|
697
|
+
|
|
492
698
|
See [docs/security.md](docs/security.md) for the full security model.
|
|
493
699
|
|
|
494
700
|
## How It Works
|
|
495
701
|
|
|
496
702
|
```text
|
|
497
703
|
CLI or MCP client -> authenticated Unix socket -> per-tab daemon -> CDP WebSocket -> browser
|
|
704
|
+
\-> pipe broker -> Chrome debugging pipe
|
|
498
705
|
```
|
|
499
706
|
|
|
500
|
-
1. Chromex finds
|
|
707
|
+
1. Chromex finds a browser DevTools endpoint or a Chromex pipe-broker marker.
|
|
501
708
|
2. The first tab command starts a detached daemon for that tab.
|
|
502
709
|
3. The daemon attaches once through CDP and keeps the session open.
|
|
503
|
-
4. CLI and MCP commands talk to the daemon through an authenticated Unix socket.
|
|
710
|
+
4. CLI and MCP commands talk to the daemon through an authenticated Unix socket; pipe mode multiplexes CDP through a second local socket restricted to the current OS user.
|
|
504
711
|
5. Daemons exit after the configured idle timeout.
|
|
505
712
|
|
|
506
713
|
See [docs/architecture.md](docs/architecture.md) for implementation details.
|
|
@@ -510,15 +717,16 @@ See [docs/architecture.md](docs/architecture.md) for implementation details.
|
|
|
510
717
|
| Guide | Description |
|
|
511
718
|
|-------|-------------|
|
|
512
719
|
| [Getting Started](docs/getting-started.md) | Installation, browser setup, first commands. |
|
|
513
|
-
| [Inspect and Debug](docs/inspect.md) | Screenshots, accessibility tree, refs,
|
|
720
|
+
| [Inspect and Debug](docs/inspect.md) | Screenshots, accessibility tree, refs, Browser Issues, CSS/listener inspection, diagnostics, performance, and console. |
|
|
514
721
|
| [Navigate and Interact](docs/navigate.md) | Navigation, clicking, typing, scrolling, drag and drop, touch, dialogs. |
|
|
515
722
|
| [Form Filling](docs/forms.md) | Fill, clear, select, check, upload, batch form examples. |
|
|
516
723
|
| [Data Access](docs/data.md) | Cookies, localStorage, sessionStorage, Application state, Cache Storage, IndexedDB, Service Workers, PDF export. |
|
|
517
|
-
| [Network Control](docs/network.md) |
|
|
724
|
+
| [Network Control](docs/network.md) | Live request history and bodies, filtering, redaction, throttling, interception, mocking, and HAR. |
|
|
518
725
|
| [Device Emulation](docs/emulation.md) | Responsive testing, geolocation, timezone, CPU throttling. |
|
|
519
726
|
| [Security](docs/security.md) | Domain filtering, CDP blocklist, audit log, best practices. |
|
|
520
|
-
| [Advanced](docs/advanced.md) |
|
|
727
|
+
| [Advanced](docs/advanced.md) | CPU and heap profiles, trace insights, heap graph analysis, screencasts, extensions, page tools, WebMCP, and WebAuthn. |
|
|
521
728
|
| [Architecture](docs/architecture.md) | Daemon model, connection modes, and file layout. |
|
|
729
|
+
| [Troubleshooting](docs/troubleshooting.md) | Installation drift, connection failures, debugging prompts, Node warnings, extensions, and WebMCP. |
|
|
522
730
|
|
|
523
731
|
## Development
|
|
524
732
|
|
|
@@ -531,6 +739,14 @@ bun run test
|
|
|
531
739
|
|
|
532
740
|
The runtime package has no dependencies. Development dependencies are used only for tests and token benchmarks.
|
|
533
741
|
|
|
742
|
+
Run the browser-backed smoke flow explicitly when validating a release candidate:
|
|
743
|
+
|
|
744
|
+
```bash
|
|
745
|
+
bun run test:smoke
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
The smoke script launches a temporary headless Chromium profile through `CDP_PORT_FILE`, exercises named sessions, snapshots, locators, storage state, annotation dashboard artifacts, and then stops the launched process.
|
|
749
|
+
|
|
534
750
|
To reproduce the token-format comparison:
|
|
535
751
|
|
|
536
752
|
```bash
|