claude-chrome-parallel 2.1.0 → 2.1.1
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 +165 -201
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,85 +1,82 @@
|
|
|
1
1
|
# Claude Chrome Parallel
|
|
2
2
|
|
|
3
|
-
> **Run multiple Claude Code sessions
|
|
3
|
+
> **Run multiple Claude Code browser sessions in parallel - no more "Detached" errors.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/claude-chrome-parallel)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Why This Exists
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- **Browser Automation**: Independent CDP connections for parallel browser control
|
|
12
|
-
- **Auto Recovery**: Detects and recovers corrupted config files
|
|
10
|
+
[Claude Chrome](https://claude.ai/chrome) is a powerful tool that lets you debug **production environments while logged in** - no need to replicate auth states or mock sessions. But when you try to run multiple Claude Code sessions with browser automation simultaneously, you get:
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
```
|
|
13
|
+
Error: Detached while handling command
|
|
14
|
+
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
This happens because the Chrome extension uses **shared internal state**. When Session A takes a screenshot, Session B's connection gets "detached."
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
**Claude Chrome Parallel** solves this by creating **independent CDP connections** for each session:
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Result: {"key":"value"}{"key":"value"} ← Two JSON objects concatenated = CORRUPT
|
|
21
|
+
Claude Code 1 ──► Process 1 ──► CDP Connection 1 ──┐
|
|
22
|
+
├──► Chrome (port 9222)
|
|
23
|
+
Claude Code 2 ──► Process 2 ──► CDP Connection 2 ──┘
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
- Claude Code crashes on startup
|
|
30
|
-
- "Unexpected token" JSON parse errors
|
|
31
|
-
- Lost settings and preferences
|
|
26
|
+
Each session gets isolated browser control. No shared state = No conflicts.
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
---
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
# Instead of running claude directly...
|
|
37
|
-
claude-chrome-parallel launch
|
|
30
|
+
## Use Cases
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
Terminal 1: claude-chrome-parallel launch ──► ~/.claude-chrome-parallel/sessions/abc123/.claude.json
|
|
41
|
-
Terminal 2: claude-chrome-parallel launch ──► ~/.claude-chrome-parallel/sessions/def456/.claude.json
|
|
42
|
-
```
|
|
32
|
+
### Multi-Session QA Testing
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
Run parallel test scenarios against your production or staging environment:
|
|
45
35
|
|
|
46
36
|
```bash
|
|
47
|
-
|
|
48
|
-
claude-
|
|
49
|
-
claude-chrome-parallel launch -p "Fix the bug"
|
|
50
|
-
claude-chrome-parallel launch --model opus --resume
|
|
51
|
-
```
|
|
37
|
+
# Terminal 1: Test user login flow
|
|
38
|
+
claude -p "Test the login flow on https://myapp.com/login"
|
|
52
39
|
|
|
53
|
-
|
|
40
|
+
# Terminal 2: Test checkout process (simultaneously!)
|
|
41
|
+
claude -p "Test the checkout flow on https://myapp.com/cart"
|
|
54
42
|
|
|
55
|
-
|
|
43
|
+
# Terminal 3: Monitor admin dashboard
|
|
44
|
+
claude -p "Take screenshots of https://myapp.com/admin every 30 seconds"
|
|
45
|
+
```
|
|
56
46
|
|
|
57
|
-
|
|
47
|
+
### Parallel Debugging
|
|
58
48
|
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
Debug multiple pages or user journeys at the same time:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Debug as different users
|
|
53
|
+
Terminal 1: "Log in as admin and check permissions on /settings"
|
|
54
|
+
Terminal 2: "Log in as regular user and verify they can't access /settings"
|
|
61
55
|
```
|
|
62
56
|
|
|
63
|
-
|
|
57
|
+
### Automated Regression Testing
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
Run comprehensive browser tests across multiple sessions:
|
|
66
60
|
|
|
61
|
+
```bash
|
|
62
|
+
# Run 5 parallel test sessions
|
|
63
|
+
for i in {1..5}; do
|
|
64
|
+
claude -p "Run test suite $i on https://staging.myapp.com" &
|
|
65
|
+
done
|
|
67
66
|
```
|
|
68
|
-
Claude Code 1 ──► puppeteer process 1 ──► CDP connection 1 ──┐
|
|
69
|
-
├──► Chrome
|
|
70
|
-
Claude Code 2 ──► puppeteer process 2 ──► CDP connection 2 ──┘
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
---
|
|
74
67
|
|
|
75
|
-
|
|
68
|
+
### Tested Concurrency
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
| Sessions | Success Rate |
|
|
71
|
+
|----------|-------------|
|
|
72
|
+
| 5 | 100% |
|
|
73
|
+
| 10 | 100% |
|
|
74
|
+
| 15 | 100% |
|
|
75
|
+
| 20 | 100% |
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
- Google Chrome (for browser automation)
|
|
77
|
+
---
|
|
81
78
|
|
|
82
|
-
|
|
79
|
+
## Installation
|
|
83
80
|
|
|
84
81
|
```bash
|
|
85
82
|
# From npm
|
|
@@ -89,207 +86,185 @@ npm install -g claude-chrome-parallel
|
|
|
89
86
|
npm install -g github:shaun0927/claude-chrome-parallel
|
|
90
87
|
```
|
|
91
88
|
|
|
89
|
+
### Configure Claude Code
|
|
90
|
+
|
|
91
|
+
Add to your Claude Code MCP settings (`~/.claude.json`):
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"chrome-parallel": {
|
|
97
|
+
"command": "claude-chrome-parallel",
|
|
98
|
+
"args": ["serve"]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Restart Claude Code for changes to take effect.
|
|
105
|
+
|
|
92
106
|
---
|
|
93
107
|
|
|
94
108
|
## Usage
|
|
95
109
|
|
|
96
|
-
###
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
# Start Claude Code with isolated config
|
|
100
|
-
claude-chrome-parallel launch
|
|
110
|
+
### Basic Usage
|
|
101
111
|
|
|
102
|
-
|
|
103
|
-
claude-chrome-parallel launch --dangerously-skip-permissions
|
|
104
|
-
claude-chrome-parallel launch --resume <session-id>
|
|
105
|
-
claude-chrome-parallel launch -p "Your prompt here"
|
|
112
|
+
Once configured, browser automation works in any Claude Code session:
|
|
106
113
|
|
|
107
|
-
|
|
108
|
-
|
|
114
|
+
```
|
|
115
|
+
You: Take a screenshot of https://github.com
|
|
109
116
|
|
|
110
|
-
|
|
111
|
-
claude-chrome-parallel launch --keep-session
|
|
117
|
+
Claude: [Uses chrome-parallel tools automatically]
|
|
112
118
|
```
|
|
113
119
|
|
|
114
|
-
###
|
|
120
|
+
### Multiple Parallel Sessions
|
|
121
|
+
|
|
122
|
+
Run multiple Claude Code terminals simultaneously:
|
|
115
123
|
|
|
116
124
|
```bash
|
|
117
|
-
#
|
|
118
|
-
claude
|
|
119
|
-
|
|
120
|
-
# With arguments
|
|
121
|
-
claude-session "Fix the authentication bug"
|
|
122
|
-
claude-session --list # List active sessions
|
|
123
|
-
claude-session --cleanup # Clean up stale sessions
|
|
124
|
-
claude-session --recover # Recover corrupted config
|
|
125
|
-
```
|
|
125
|
+
# Terminal 1
|
|
126
|
+
claude
|
|
127
|
+
> Navigate to myapp.com/dashboard and take a screenshot
|
|
126
128
|
|
|
127
|
-
|
|
129
|
+
# Terminal 2 (at the same time!)
|
|
130
|
+
claude
|
|
131
|
+
> Fill out the form on myapp.com/contact and submit
|
|
128
132
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
# Terminal 3 (also at the same time!)
|
|
134
|
+
claude
|
|
135
|
+
> Monitor network requests on myapp.com/api
|
|
136
|
+
```
|
|
132
137
|
|
|
133
|
-
|
|
134
|
-
claude-chrome-parallel recover
|
|
138
|
+
All sessions work without conflicts!
|
|
135
139
|
|
|
136
|
-
|
|
137
|
-
claude-chrome-parallel recover --list-backups
|
|
140
|
+
### Available Browser Tools
|
|
138
141
|
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
| Tool | Description |
|
|
143
|
+
|------|-------------|
|
|
144
|
+
| `navigate` | Navigate to URL or use history |
|
|
145
|
+
| `computer` | Screenshots, mouse clicks, keyboard input, scrolling |
|
|
146
|
+
| `read_page` | Read page content via accessibility tree |
|
|
147
|
+
| `find` | Find elements by description |
|
|
148
|
+
| `form_input` | Fill form fields |
|
|
149
|
+
| `javascript_tool` | Execute JavaScript |
|
|
150
|
+
| `tabs_context_mcp` | Get available tabs |
|
|
151
|
+
| `tabs_create_mcp` | Create new tab |
|
|
141
152
|
|
|
142
|
-
|
|
143
|
-
claude-chrome-parallel recover --force-new
|
|
153
|
+
---
|
|
144
154
|
|
|
145
|
-
|
|
146
|
-
claude-chrome-parallel cleanup
|
|
147
|
-
claude-chrome-parallel cleanup --max-age 12 # Sessions older than 12 hours
|
|
148
|
-
claude-chrome-parallel cleanup --keep-backups 5 # Keep only 5 most recent backups
|
|
149
|
-
```
|
|
155
|
+
## How It Works
|
|
150
156
|
|
|
151
|
-
###
|
|
157
|
+
### The Problem: Shared Extension State
|
|
152
158
|
|
|
153
|
-
|
|
159
|
+
The official Chrome extension maintains a single shared state:
|
|
154
160
|
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
161
|
+
```
|
|
162
|
+
Claude Code 1 ─┐
|
|
163
|
+
├─► Chrome Extension (shared state) ─► Chrome
|
|
164
|
+
Claude Code 2 ─┘
|
|
165
|
+
↑
|
|
166
|
+
State conflicts here!
|
|
164
167
|
```
|
|
165
168
|
|
|
166
|
-
|
|
169
|
+
### The Solution: Independent CDP Connections
|
|
170
|
+
|
|
171
|
+
Chrome's DevTools Protocol natively supports multiple simultaneous connections:
|
|
167
172
|
|
|
168
173
|
```
|
|
169
|
-
|
|
174
|
+
Claude Code 1 ─► Process 1 ─► CDP Connection 1 ─┐
|
|
175
|
+
├─► Chrome (port 9222)
|
|
176
|
+
Claude Code 2 ─► Process 2 ─► CDP Connection 2 ─┘
|
|
170
177
|
|
|
171
|
-
|
|
178
|
+
Independent connections, no shared state!
|
|
172
179
|
```
|
|
173
180
|
|
|
174
|
-
|
|
181
|
+
Each Claude Code session spawns its own MCP server process with a dedicated CDP connection.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## CLI Commands
|
|
175
186
|
|
|
176
187
|
```bash
|
|
177
|
-
#
|
|
178
|
-
claude-chrome-parallel
|
|
179
|
-
> Take a screenshot of github.com
|
|
188
|
+
# Start MCP server (used by Claude Code automatically)
|
|
189
|
+
claude-chrome-parallel serve
|
|
180
190
|
|
|
181
|
-
#
|
|
182
|
-
claude-chrome-parallel
|
|
183
|
-
> Take a screenshot of google.com
|
|
184
|
-
```
|
|
191
|
+
# Check Chrome connection status
|
|
192
|
+
claude-chrome-parallel check
|
|
185
193
|
|
|
186
|
-
|
|
194
|
+
# Use custom Chrome debugging port
|
|
195
|
+
claude-chrome-parallel serve --port 9223
|
|
187
196
|
|
|
188
|
-
|
|
197
|
+
# Check installation health
|
|
198
|
+
claude-chrome-parallel doctor
|
|
199
|
+
```
|
|
189
200
|
|
|
190
|
-
|
|
201
|
+
---
|
|
191
202
|
|
|
192
|
-
|
|
193
|
-
|---------|-------------|
|
|
194
|
-
| `launch [args...]` | Start Claude with isolated config |
|
|
195
|
-
| `recover` | Recover corrupted .claude.json |
|
|
196
|
-
| `cleanup` | Clean up stale sessions and backups |
|
|
197
|
-
| `doctor` | Check installation and config health |
|
|
198
|
-
| `serve` | Start MCP server for browser automation |
|
|
199
|
-
| `install` | Install browser extension and native host |
|
|
200
|
-
| `uninstall` | Remove extension and native host |
|
|
203
|
+
## Chrome Configuration
|
|
201
204
|
|
|
202
|
-
|
|
205
|
+
By default, connects to Chrome on port 9222.
|
|
203
206
|
|
|
204
|
-
|
|
205
|
-
|--------|-------------|
|
|
206
|
-
| `--sync-back` | Sync config changes back to original on exit |
|
|
207
|
-
| `--keep-session` | Keep session directory after exit (debugging) |
|
|
207
|
+
**Auto-launch**: If Chrome isn't running with debugging enabled, the package will start it automatically.
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
**Manual start** (if needed):
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
| `--backup <name>` | Restore from specific backup |
|
|
215
|
-
| `--force-new` | Create new empty config (loses all data) |
|
|
211
|
+
```bash
|
|
212
|
+
# Windows
|
|
213
|
+
chrome.exe --remote-debugging-port=9222
|
|
216
214
|
|
|
217
|
-
|
|
215
|
+
# macOS
|
|
216
|
+
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
|
|
218
217
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
| `--keep-backups <n>` | Number of backups to keep (default: 10) |
|
|
218
|
+
# Linux
|
|
219
|
+
google-chrome --remote-debugging-port=9222
|
|
220
|
+
```
|
|
223
221
|
|
|
224
222
|
---
|
|
225
223
|
|
|
226
|
-
##
|
|
224
|
+
## Additional Features
|
|
227
225
|
|
|
228
|
-
|
|
229
|
-
|------|-------------|
|
|
230
|
-
| `navigate` | Navigate to URL or use history |
|
|
231
|
-
| `tabs_context_mcp` | Get available tabs |
|
|
232
|
-
| `tabs_create_mcp` | Create new tab |
|
|
233
|
-
| `computer` | Screenshots, mouse/keyboard, scrolling |
|
|
234
|
-
| `read_page` | Read accessibility tree |
|
|
235
|
-
| `find` | Find elements by description |
|
|
236
|
-
| `form_input` | Fill form fields |
|
|
237
|
-
| `javascript_tool` | Execute JavaScript |
|
|
238
|
-
|
|
239
|
-
---
|
|
226
|
+
### Session Isolation (Bonus)
|
|
240
227
|
|
|
241
|
-
|
|
228
|
+
When running multiple Claude Code instances, they can corrupt `~/.claude.json` due to race conditions. Use the `launch` command to run Claude with isolated config:
|
|
242
229
|
|
|
243
|
-
|
|
230
|
+
```bash
|
|
231
|
+
# Run Claude Code with isolated config directory
|
|
232
|
+
claude-chrome-parallel launch
|
|
244
233
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
│ Terminal 1: claude ──┐ │
|
|
249
|
-
│ ├─► ~/.claude.json │ ← Race condition!
|
|
250
|
-
│ Terminal 2: claude ──┘ │
|
|
251
|
-
└─────────────────────────────────────────────┘
|
|
252
|
-
|
|
253
|
-
After (Safe):
|
|
254
|
-
┌─────────────────────────────────────────────┐
|
|
255
|
-
│ Terminal 1: launch ─► sessions/abc/.claude.json │
|
|
256
|
-
│ │ ← No conflict!
|
|
257
|
-
│ Terminal 2: launch ─► sessions/def/.claude.json │
|
|
258
|
-
└─────────────────────────────────────────────┘
|
|
234
|
+
# Pass any claude flags
|
|
235
|
+
claude-chrome-parallel launch --dangerously-skip-permissions
|
|
236
|
+
claude-chrome-parallel launch -p "Your prompt"
|
|
259
237
|
```
|
|
260
238
|
|
|
261
|
-
|
|
262
|
-
1. Creates a unique session directory
|
|
263
|
-
2. Copies existing `.claude.json` (if valid)
|
|
264
|
-
3. Sets `HOME` environment variable to session directory
|
|
265
|
-
4. Runs `claude` with all your arguments
|
|
266
|
-
5. Cleans up session on exit
|
|
239
|
+
### Config Recovery
|
|
267
240
|
|
|
268
|
-
|
|
241
|
+
If your `.claude.json` gets corrupted:
|
|
269
242
|
|
|
270
|
-
|
|
243
|
+
```bash
|
|
244
|
+
# Auto-recover corrupted config
|
|
245
|
+
claude-chrome-parallel recover
|
|
271
246
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
├─► Chrome (port 9222)
|
|
275
|
-
Process 2 ─► CDP Connection 2 ─┘
|
|
247
|
+
# List available backups
|
|
248
|
+
claude-chrome-parallel recover --list-backups
|
|
276
249
|
```
|
|
277
250
|
|
|
278
251
|
---
|
|
279
252
|
|
|
280
|
-
##
|
|
253
|
+
## Comparison
|
|
281
254
|
|
|
282
|
-
|
|
255
|
+
| Feature | Claude in Chrome (Extension) | Claude Chrome Parallel |
|
|
256
|
+
|---------|------------------------------|----------------------|
|
|
257
|
+
| Multiple sessions | ❌ Detached errors | ✅ Works perfectly |
|
|
258
|
+
| Parallel QA testing | ❌ | ✅ |
|
|
259
|
+
| Connection type | Shared extension state | Independent CDP |
|
|
260
|
+
| Max concurrent sessions | 1 | 20+ tested |
|
|
261
|
+
| Auto Chrome launch | ❌ | ✅ |
|
|
283
262
|
|
|
284
|
-
|
|
285
|
-
# Check health
|
|
286
|
-
claude-chrome-parallel doctor
|
|
263
|
+
---
|
|
287
264
|
|
|
288
|
-
|
|
289
|
-
claude-chrome-parallel recover
|
|
290
|
-
```
|
|
265
|
+
## Troubleshooting
|
|
291
266
|
|
|
292
|
-
### Chrome
|
|
267
|
+
### Chrome not connecting
|
|
293
268
|
|
|
294
269
|
```bash
|
|
295
270
|
# Check status
|
|
@@ -299,7 +274,7 @@ claude-chrome-parallel check
|
|
|
299
274
|
chrome --remote-debugging-port=9222
|
|
300
275
|
```
|
|
301
276
|
|
|
302
|
-
### Tools
|
|
277
|
+
### Tools not appearing in Claude Code
|
|
303
278
|
|
|
304
279
|
1. Check MCP config in `~/.claude.json`
|
|
305
280
|
2. Restart Claude Code
|
|
@@ -322,17 +297,6 @@ npm install -g .
|
|
|
322
297
|
|
|
323
298
|
---
|
|
324
299
|
|
|
325
|
-
## Comparison
|
|
326
|
-
|
|
327
|
-
| Feature | Plain `claude` | `claude-chrome-parallel launch` |
|
|
328
|
-
|---------|----------------|--------------------------------|
|
|
329
|
-
| Multiple instances | Config corruption risk | Safe (isolated) |
|
|
330
|
-
| Browser automation | Detached errors | Works perfectly |
|
|
331
|
-
| Auto backup | | Config backed up |
|
|
332
|
-
| Recovery tools | | Built-in |
|
|
333
|
-
|
|
334
|
-
---
|
|
335
|
-
|
|
336
300
|
## License
|
|
337
301
|
|
|
338
302
|
MIT License - see [LICENSE](LICENSE) for details.
|