chromex-mcp 1.0.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/LICENSE +21 -0
- package/README.md +411 -0
- package/package.json +50 -0
- package/plugins/chromex/skills/chromex/scripts/chromex.mjs +343 -0
- package/plugins/chromex/skills/chromex/scripts/lib/browser.mjs +66 -0
- package/plugins/chromex/skills/chromex/scripts/lib/client.mjs +98 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/console.mjs +37 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/cookies.mjs +77 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/coverage.mjs +95 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/cpu.mjs +14 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/dialog.mjs +38 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/domsnapshot.mjs +84 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/download.mjs +25 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/drag.mjs +71 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/emulate.mjs +44 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/evaluate.mjs +31 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/form.mjs +163 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/geo.mjs +37 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/har.mjs +101 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/heap.mjs +24 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/highlight.mjs +36 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/html.mjs +10 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/inject.mjs +39 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/interact.mjs +88 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/intercept.mjs +99 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/navigate.mjs +45 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/network.mjs +13 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/pdf.mjs +16 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/perf.mjs +98 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/refs.mjs +67 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/screenshot.mjs +54 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/scroll.mjs +44 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/snapshot.mjs +100 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/storage.mjs +47 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/tab.mjs +31 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/throttle.mjs +38 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/touch.mjs +62 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/trace.mjs +51 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/upload.mjs +43 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/wait.mjs +84 -0
- package/plugins/chromex/skills/chromex/scripts/lib/commands/webauthn.mjs +47 -0
- package/plugins/chromex/skills/chromex/scripts/lib/config.mjs +100 -0
- package/plugins/chromex/skills/chromex/scripts/lib/daemon.mjs +368 -0
- package/plugins/chromex/skills/chromex/scripts/lib/ipc.mjs +178 -0
- package/plugins/chromex/skills/chromex/scripts/lib/launcher.mjs +111 -0
- package/plugins/chromex/skills/chromex/scripts/lib/security.mjs +48 -0
- package/plugins/chromex/skills/chromex/scripts/lib/utils.mjs +47 -0
- package/plugins/chromex/skills/chromex/scripts/mcp-server.mjs +726 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Whallysson Avelino
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
# Chromex
|
|
2
|
+
|
|
3
|
+
Zero-dependency Chrome DevTools Protocol CLI for AI agents. Connects directly to Chrome, Brave, Edge, or Chromium via WebSocket. No Puppeteer, no npm install, no bloat.
|
|
4
|
+
|
|
5
|
+
Built as a [Claude Code](https://claude.ai/code) plugin but works standalone with any AI agent or from the terminal.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **45+ commands** -- screenshots, form filling, cookies, PDF, device emulation, network interception, performance tracing, touch gestures, and more
|
|
10
|
+
- **Zero dependencies** -- uses only Node.js 22+ built-in modules (WebSocket, fs, net, crypto)
|
|
11
|
+
- **Ref-based selection** -- `snap --refs` assigns `@e1`, `@e2`... to interactive elements, then `click @e5` or `fill @e3 "value"`. No fragile CSS selectors
|
|
12
|
+
- **Per-tab persistent daemons** -- each tab gets a background process connected via Unix socket. Chrome's "Allow debugging" modal fires once, not on every command
|
|
13
|
+
- **Security hardened** -- domain filtering (allow/blocklist), CDP method blocklist, token-authenticated sockets, full audit log
|
|
14
|
+
- **Multi-browser** -- auto-detects Brave, Chrome, Chrome Canary, Chromium, Edge, Vivaldi (macOS + Linux)
|
|
15
|
+
- **Network control** -- throttle to 3G/offline, intercept & mock requests, record HAR files
|
|
16
|
+
- **Form filling** -- fill inputs, select dropdowns, toggle checkboxes, upload files, batch fill entire forms. Works with React/Vue/Angular
|
|
17
|
+
- **Browser launcher** -- launch browser with remote debugging pre-enabled (skips the "Allow debugging" modal entirely)
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Node.js 22+ (for built-in WebSocket)
|
|
22
|
+
- Any Chromium-based browser
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
### As a Claude Code plugin
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Add the marketplace
|
|
30
|
+
/plugin marketplace add github:whallysson/chromex
|
|
31
|
+
|
|
32
|
+
# Install
|
|
33
|
+
/plugin install chromex
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Standalone
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git clone https://github.com/whallysson/chromex.git
|
|
40
|
+
cd chromex
|
|
41
|
+
chmod +x skills/chromex/scripts/chromex.mjs
|
|
42
|
+
|
|
43
|
+
# Optional: create an alias
|
|
44
|
+
alias chromex="node $(pwd)/skills/chromex/scripts/chromex.mjs"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Connect to your browser
|
|
48
|
+
|
|
49
|
+
**Option A: Launch a new browser** (recommended -- no setup needed)
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
chromex launch --url https://example.com
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This starts Chrome/Brave/Edge with remote debugging pre-enabled. No manual configuration required.
|
|
56
|
+
|
|
57
|
+
**Option B: Connect to an already-running browser**
|
|
58
|
+
|
|
59
|
+
You **must** enable remote debugging first:
|
|
60
|
+
|
|
61
|
+
1. Open your browser (Chrome, Brave, Edge, etc.)
|
|
62
|
+
2. Navigate to `chrome://inspect/#remote-debugging`
|
|
63
|
+
3. **Toggle the switch ON** to enable remote debugging
|
|
64
|
+
4. Run `chromex list` to verify the connection
|
|
65
|
+
|
|
66
|
+
> **Important:** Without step 3, chromex cannot connect to your browser. This is a one-time setup -- the setting persists across browser restarts.
|
|
67
|
+
|
|
68
|
+
> **Note:** With Option B, Chrome will show an "Allow debugging" dialog the first time you access each tab. Click "Allow" once per tab -- the daemon keeps the session alive after that.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
chromex list
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Your first commands
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# List open tabs
|
|
78
|
+
chromex list
|
|
79
|
+
# Output: 6BE827FA Example Domain https://example.com
|
|
80
|
+
|
|
81
|
+
# Take a screenshot
|
|
82
|
+
chromex shot 6BE8 /tmp/page.png
|
|
83
|
+
|
|
84
|
+
# Get the accessibility tree with interactive refs
|
|
85
|
+
chromex snap 6BE8 --refs
|
|
86
|
+
# Output:
|
|
87
|
+
# @e1 [textbox] Email
|
|
88
|
+
# @e2 [textbox] Password
|
|
89
|
+
# @e3 [button] Sign in
|
|
90
|
+
|
|
91
|
+
# Fill a form using refs (no CSS selectors needed!)
|
|
92
|
+
chromex fill 6BE8 @e1 "user@example.com"
|
|
93
|
+
chromex fill 6BE8 @e2 "secret123"
|
|
94
|
+
chromex click 6BE8 @e3
|
|
95
|
+
|
|
96
|
+
# Check Core Web Vitals
|
|
97
|
+
chromex perf 6BE8
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Commands
|
|
101
|
+
|
|
102
|
+
`<target>` is a unique prefix of the targetId shown by `list` (e.g. `6BE827FA`).
|
|
103
|
+
|
|
104
|
+
### Pages & Browser
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
chromex list # List open pages
|
|
108
|
+
chromex open "https://example.com" # Open new tab
|
|
109
|
+
chromex close <target> # Close tab
|
|
110
|
+
chromex focus <target> # Activate/focus tab
|
|
111
|
+
chromex launch # Launch browser with debugging
|
|
112
|
+
chromex launch --incognito --browser brave # Launch Brave in incognito
|
|
113
|
+
chromex launch --profile testing --url https://... # Isolated profile + URL
|
|
114
|
+
chromex incognito https://example.com # Isolated context (no relaunch)
|
|
115
|
+
chromex stop # Stop all daemons
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Inspect
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
chromex snap <target> # Accessibility tree (prefer over html)
|
|
122
|
+
chromex snap <target> --refs # With interactive refs (@e1, @e2...)
|
|
123
|
+
chromex html <target> "#main" # Element HTML by selector
|
|
124
|
+
chromex shot <target> /tmp/page.png # Viewport screenshot
|
|
125
|
+
chromex shot <target> /tmp/full.png --full # Full page screenshot
|
|
126
|
+
chromex net <target> # Network resource timing
|
|
127
|
+
chromex perf <target> # Core Web Vitals + memory + DOM stats
|
|
128
|
+
chromex console <target> 5000 # Capture console.log/error for 5s
|
|
129
|
+
chromex domsnapshot <target> # Structured DOM with bounding rects
|
|
130
|
+
chromex domsnapshot <target> --styles # Include computed styles
|
|
131
|
+
chromex highlight <target> "h1" # Highlight element with overlay
|
|
132
|
+
chromex highlight <target> clear # Remove highlight
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Evaluate
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
chromex eval <target> "document.title" # Run JS
|
|
139
|
+
chromex eval <target> "document.querySelectorAll('a').length" # Count links
|
|
140
|
+
chromex evalraw <target> "DOM.getDocument" # Raw CDP command
|
|
141
|
+
chromex evalraw <target> "Page.getLayoutMetrics" # Layout info
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Navigate & Wait
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
chromex nav <target> "https://example.com" # Navigate + wait for load
|
|
148
|
+
chromex waitfor <target> ".results" 10000 # Wait for CSS selector (10s)
|
|
149
|
+
chromex wait <target> networkidle # Wait for network idle
|
|
150
|
+
chromex wait <target> load # Wait for page load
|
|
151
|
+
chromex wait <target> domready # Wait for DOMContentLoaded
|
|
152
|
+
chromex wait <target> fcp # Wait for First Contentful Paint
|
|
153
|
+
chromex scroll <target> down 500 # Scroll down 500px
|
|
154
|
+
chromex scroll <target> to "#footer" # Scroll to element
|
|
155
|
+
chromex scroll <target> top # Scroll to top
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Interact
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
chromex click <target> "button.submit" # Click by CSS selector
|
|
162
|
+
chromex click <target> @e5 # Click by ref (from snap --refs)
|
|
163
|
+
chromex clickxy <target> 100 200 # Click at CSS pixel coords
|
|
164
|
+
chromex type <target> "hello world" # Type text (works cross-origin)
|
|
165
|
+
chromex hover <target> @e12 # Hover element by ref
|
|
166
|
+
chromex drag <target> "#source" "#dest" # Drag & drop by selector
|
|
167
|
+
chromex drag <target> 100,200 400,500 # Drag & drop by coordinates
|
|
168
|
+
chromex touch <target> tap 200 300 # Touch tap
|
|
169
|
+
chromex touch <target> swipe 200,400 200,100 # Swipe gesture
|
|
170
|
+
chromex touch <target> pinch 200 300 2.0 # Pinch zoom in
|
|
171
|
+
chromex touch <target> longpress 200 300 1000 # Long press (1s)
|
|
172
|
+
chromex dialog <target> accept # Accept alert/confirm
|
|
173
|
+
chromex dialog <target> dismiss # Dismiss dialog
|
|
174
|
+
chromex dialog <target> auto # Auto-accept all dialogs
|
|
175
|
+
chromex loadall <target> ".load-more" 500 # Click until element disappears
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Forms
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
chromex fill <target> "#email" "user@test.com" # Fill input/textarea
|
|
182
|
+
chromex fill <target> @e1 "user@test.com" # Fill by ref
|
|
183
|
+
chromex clear <target> "#search" # Clear field
|
|
184
|
+
chromex select <target> "#country" "BR" # Select dropdown option
|
|
185
|
+
chromex check <target> "#terms" # Check checkbox
|
|
186
|
+
chromex check <target> "#newsletter" false # Uncheck checkbox
|
|
187
|
+
chromex upload <target> "#avatar" /tmp/photo.png # Upload file
|
|
188
|
+
|
|
189
|
+
# Batch fill entire form
|
|
190
|
+
chromex form <target> '{"#name":"John","#email":"john@test.com","#terms":true}'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Data
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
chromex cookies <target> # List cookies
|
|
197
|
+
chromex cookies <target> set '{"name":"x","value":"y"}' # Set cookie
|
|
198
|
+
chromex cookies <target> clear # Clear all cookies
|
|
199
|
+
chromex storage <target> local # Dump localStorage
|
|
200
|
+
chromex storage <target> session # Dump sessionStorage
|
|
201
|
+
chromex storage <target> clear # Clear both
|
|
202
|
+
chromex pdf <target> /tmp/page.pdf # Export as PDF
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Network
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
chromex throttle <target> 3g # Throttle to 3G
|
|
209
|
+
chromex throttle <target> slow-3g # Throttle to slow 3G
|
|
210
|
+
chromex throttle <target> offline # Go offline
|
|
211
|
+
chromex throttle <target> custom 200 1000 500 # Custom: latency, down, up (kbps)
|
|
212
|
+
chromex throttle <target> reset # Remove throttling
|
|
213
|
+
|
|
214
|
+
chromex intercept <target> block "*.analytics.*" # Block matching requests
|
|
215
|
+
chromex intercept <target> mock "/api/user" '{"name":"test"}' # Mock response
|
|
216
|
+
chromex intercept <target> rules # List active rules
|
|
217
|
+
chromex intercept <target> off # Disable interception
|
|
218
|
+
|
|
219
|
+
chromex har <target> start # Start recording
|
|
220
|
+
chromex har <target> stop /tmp/trace.har # Save HAR file
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Emulate
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
chromex emulate <target> iphone-14 # 390x844 @3x mobile
|
|
227
|
+
chromex emulate <target> ipad-pro # 1024x1366 @2x tablet
|
|
228
|
+
chromex emulate <target> pixel-7 # 412x915 @2.625x mobile
|
|
229
|
+
chromex emulate <target> desktop-4k # 3840x2160 @1x
|
|
230
|
+
chromex emulate <target> reset # Reset to default
|
|
231
|
+
chromex geo <target> -23.55 -46.63 # Set geolocation (Sao Paulo)
|
|
232
|
+
chromex geo <target> reset # Clear geolocation
|
|
233
|
+
chromex timezone <target> "America/Sao_Paulo" # Set timezone
|
|
234
|
+
chromex locale <target> "pt-BR" # Set locale
|
|
235
|
+
chromex cpu <target> 4 # CPU 4x slower
|
|
236
|
+
chromex cpu <target> reset # Reset CPU speed
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Available devices: `iphone-14`, `iphone-15-pro`, `ipad-pro`, `pixel-7`, `galaxy-s23`, `macbook-air`, `desktop-1080p`, `desktop-4k`.
|
|
240
|
+
|
|
241
|
+
### Advanced
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
chromex inject <target> "window.DEBUG=true" # Inject JS on every page load
|
|
245
|
+
chromex inject <target> --file /tmp/preload.js # Inject from file
|
|
246
|
+
chromex inject <target> --list # List injected scripts
|
|
247
|
+
chromex inject <target> --remove <id> # Remove injected script
|
|
248
|
+
chromex download <target> allow /tmp/downloads # Auto-accept downloads
|
|
249
|
+
chromex download <target> deny # Block downloads
|
|
250
|
+
chromex coverage <target> start # Start code coverage
|
|
251
|
+
chromex coverage <target> stop # Coverage report (JS + CSS %)
|
|
252
|
+
chromex trace <target> start # Start performance trace
|
|
253
|
+
chromex trace <target> stop /tmp/trace.json # Save trace (chrome://tracing)
|
|
254
|
+
chromex heap <target> snapshot /tmp/heap.hs # Heap snapshot (memory analysis)
|
|
255
|
+
chromex webauthn <target> enable # Virtual authenticator (passkeys)
|
|
256
|
+
chromex webauthn <target> creds # List stored credentials
|
|
257
|
+
chromex webauthn <target> disable # Remove authenticator
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Ref-Based Selection
|
|
261
|
+
|
|
262
|
+
The killer feature for AI agents. Instead of fragile CSS selectors, use numbered refs:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# 1. Get interactive elements with refs
|
|
266
|
+
chromex snap <target> --refs
|
|
267
|
+
# Output:
|
|
268
|
+
# @e1 [textbox] Username
|
|
269
|
+
# @e2 [textbox] Password
|
|
270
|
+
# @e3 [checkbox] Remember me
|
|
271
|
+
# @e4 [button] Sign in
|
|
272
|
+
# @e5 [link] Forgot password?
|
|
273
|
+
|
|
274
|
+
# 2. Interact using refs
|
|
275
|
+
chromex fill <target> @e1 "admin"
|
|
276
|
+
chromex fill <target> @e2 "secret123"
|
|
277
|
+
chromex click <target> @e3
|
|
278
|
+
chromex click <target> @e4
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Refs are assigned to all interactive elements (buttons, links, inputs, checkboxes, radios, dropdowns, tabs, switches). They persist until the next `snap --refs` call.
|
|
282
|
+
|
|
283
|
+
Supported ref commands: `click @eN`, `fill @eN "value"`, `hover @eN`.
|
|
284
|
+
|
|
285
|
+
## MCP Server (Recommended for Claude Code)
|
|
286
|
+
|
|
287
|
+
Chromex also ships as an MCP server -- typed tools, auto-approve with one line, no Bash globs.
|
|
288
|
+
|
|
289
|
+
### Setup
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
# Via npx (recommended)
|
|
293
|
+
claude mcp add chromex npx chromex-mcp@latest
|
|
294
|
+
|
|
295
|
+
# Or with absolute path (no npm needed)
|
|
296
|
+
claude mcp add chromex node /path/to/plugins/chromex/skills/chromex/scripts/mcp-server.mjs
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Auto-Approve
|
|
300
|
+
|
|
301
|
+
Add to `~/.claude/settings.json`:
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"permissions": {
|
|
306
|
+
"allow": ["mcp__chromex"]
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
This approves all 52 MCP tools at once. For granular control, approve individual tools:
|
|
312
|
+
|
|
313
|
+
```json
|
|
314
|
+
{
|
|
315
|
+
"permissions": {
|
|
316
|
+
"allow": [
|
|
317
|
+
"mcp__chromex__chromex_list",
|
|
318
|
+
"mcp__chromex__chromex_snapshot",
|
|
319
|
+
"mcp__chromex__chromex_screenshot",
|
|
320
|
+
"mcp__chromex__chromex_perf"
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Why MCP over CLI?
|
|
327
|
+
|
|
328
|
+
| | CLI (Bash) | MCP Server |
|
|
329
|
+
|---|---|---|
|
|
330
|
+
| Auto-approve | Fragile glob pattern | `"mcp__chromex"` -- one line |
|
|
331
|
+
| Permissions | All-or-nothing | Per-tool granularity |
|
|
332
|
+
| Parameters | Positional string args | Typed JSON Schema |
|
|
333
|
+
| Annotations | None | `readOnlyHint`, `destructiveHint` |
|
|
334
|
+
| Token cost | ~60-80 overhead/call | ~15-25 overhead/call |
|
|
335
|
+
| Screenshots | Returns file path | Returns inline image (base64) |
|
|
336
|
+
|
|
337
|
+
The CLI still works and is useful for terminal, scripts, and CI/CD. The MCP server is the recommended interface for Claude Code.
|
|
338
|
+
|
|
339
|
+
### npm
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npm install -g chromex-mcp # Global install
|
|
343
|
+
chromex-mcp # Run MCP server
|
|
344
|
+
chromex-cli list # CLI also available
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Auto-Approve for CLI (Alternative)
|
|
348
|
+
|
|
349
|
+
If you prefer the CLI interface, add this to `~/.claude/settings.json`:
|
|
350
|
+
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"permissions": {
|
|
354
|
+
"allow": [
|
|
355
|
+
"Bash(node *chromex/scripts/chromex.mjs *)"
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
> **Warning:** This approves all chromex commands without distinction. The security config (`~/.chromex/config.json`) still applies -- domain filtering, CDP blocklist, and audit log remain active.
|
|
362
|
+
|
|
363
|
+
## Security
|
|
364
|
+
|
|
365
|
+
Config at `~/.chromex/config.json` (auto-created on first run):
|
|
366
|
+
|
|
367
|
+
```json
|
|
368
|
+
{
|
|
369
|
+
"blockedDomains": ["mail.google.com", "bank.example.com"],
|
|
370
|
+
"allowedDomains": [],
|
|
371
|
+
"blockedCdpMethods": ["Browser.close", "Storage.getCookies", "..."],
|
|
372
|
+
"socketAuth": true,
|
|
373
|
+
"auditLog": true
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
- **Domain filtering**: block sensitive sites or restrict to a whitelist
|
|
378
|
+
- **CDP blocklist**: dangerous methods blocked by default in `evalraw`
|
|
379
|
+
- **Socket auth**: 32-byte random token per session
|
|
380
|
+
- **Audit log**: every command logged with timestamp and status
|
|
381
|
+
|
|
382
|
+
See [docs/security.md](docs/security.md) for full details.
|
|
383
|
+
|
|
384
|
+
## Documentation
|
|
385
|
+
|
|
386
|
+
| Guide | Description |
|
|
387
|
+
|-------|-------------|
|
|
388
|
+
| [Getting Started](docs/getting-started.md) | Installation, connection methods, first commands |
|
|
389
|
+
| [Inspect & Debug](docs/inspect.md) | Screenshots, accessibility tree, refs, HTML, eval, network, performance, console |
|
|
390
|
+
| [Navigate & Interact](docs/navigate.md) | Navigation, clicking, typing, scrolling, drag & drop, touch, dialogs |
|
|
391
|
+
| [Form Filling](docs/forms.md) | Fill, clear, select, check, upload, batch fill with examples |
|
|
392
|
+
| [Data Access](docs/data.md) | Cookies, localStorage, sessionStorage, PDF export |
|
|
393
|
+
| [Network Control](docs/network.md) | Throttling, interception, mocking, HAR recording |
|
|
394
|
+
| [Device Emulation](docs/emulation.md) | Responsive testing, geolocation, timezone, CPU throttling |
|
|
395
|
+
| [Security](docs/security.md) | Domain filtering, CDP blocklist, audit log, best practices |
|
|
396
|
+
| [Advanced](docs/advanced.md) | Script injection, code coverage, tracing, heap snapshots, WebAuthn |
|
|
397
|
+
| [Architecture](docs/architecture.md) | How it works: daemon model, connection modes, file layout |
|
|
398
|
+
|
|
399
|
+
## How It Works
|
|
400
|
+
|
|
401
|
+
1. **Browser detection** -- scans ~30 paths for `DevToolsActivePort` (or use `CDP_PORT_FILE` env var)
|
|
402
|
+
2. **Daemon spawn** -- first command to a tab spawns a background Node.js process connected via CDP WebSocket
|
|
403
|
+
3. **Session persistence** -- daemon holds the session open; Chrome's "Allow" modal fires once per daemon
|
|
404
|
+
4. **Unix sockets** -- CLI communicates with daemon via authenticated Unix sockets
|
|
405
|
+
5. **Auto-exit** -- daemons shut down after 20 minutes of inactivity (configurable)
|
|
406
|
+
|
|
407
|
+
See [docs/architecture.md](docs/architecture.md) for the full deep dive.
|
|
408
|
+
|
|
409
|
+
## License
|
|
410
|
+
|
|
411
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chromex-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Zero-dependency Chrome DevTools Protocol MCP server for AI agents. 52 typed tools, per-tab daemons, security hardened.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"chromex-mcp": "./plugins/chromex/skills/chromex/scripts/mcp-server.mjs",
|
|
8
|
+
"chromex-cli": "./plugins/chromex/skills/chromex/scripts/chromex.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"plugins/chromex/skills/chromex/scripts/",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "vitest run",
|
|
17
|
+
"test:watch": "vitest"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"mcp-server",
|
|
22
|
+
"chrome",
|
|
23
|
+
"devtools",
|
|
24
|
+
"cdp",
|
|
25
|
+
"automation",
|
|
26
|
+
"ai-agent",
|
|
27
|
+
"claude-code",
|
|
28
|
+
"browser",
|
|
29
|
+
"testing",
|
|
30
|
+
"scraping",
|
|
31
|
+
"playwright-alternative"
|
|
32
|
+
],
|
|
33
|
+
"author": {
|
|
34
|
+
"name": "Whallysson Avelino",
|
|
35
|
+
"email": "whallysson.dev@gmail.com",
|
|
36
|
+
"url": "https://github.com/whallysson"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/whallysson/chromex"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/whallysson/chromex#mcp-server-recommended-for-claude-code",
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"vitest": "^3.0.0"
|
|
49
|
+
}
|
|
50
|
+
}
|