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.
Files changed (2) hide show
  1. package/README.md +165 -201
  2. 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 safely - no more "Detached" errors or config corruption.**
3
+ > **Run multiple Claude Code browser sessions in parallel - no more "Detached" errors.**
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/claude-chrome-parallel.svg)](https://www.npmjs.com/package/claude-chrome-parallel)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- ## Features
8
+ ## Why This Exists
9
9
 
10
- - **Session Isolation**: Prevents `.claude.json` corruption when running multiple Claude instances
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
- ## Problem 1: Config File Corruption
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
- When running **multiple Claude Code instances** simultaneously, they compete to write to `~/.claude.json`, causing corruption:
18
+ **Claude Chrome Parallel** solves this by creating **independent CDP connections** for each session:
19
19
 
20
20
  ```
21
- Terminal 1: claude ──┐
22
- ├──► ~/.claude.json Race condition!
23
- Terminal 2: claude ──┘
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
- **Symptoms:**
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
- ## Solution: Session Isolation
28
+ ---
34
29
 
35
- ```bash
36
- # Instead of running claude directly...
37
- claude-chrome-parallel launch
30
+ ## Use Cases
38
31
 
39
- # Each session gets isolated config
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
- **All your existing flags work:**
34
+ Run parallel test scenarios against your production or staging environment:
45
35
 
46
36
  ```bash
47
- claude-chrome-parallel launch --dangerously-skip-permissions
48
- claude-chrome-parallel launch --resume abc123
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
- ## Problem 2: Browser "Detached" Errors
43
+ # Terminal 3: Monitor admin dashboard
44
+ claude -p "Take screenshots of https://myapp.com/admin every 30 seconds"
45
+ ```
56
46
 
57
- When using browser automation with multiple sessions:
47
+ ### Parallel Debugging
58
48
 
59
- ```
60
- Error: Detached while handling command
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
- The Chrome extension uses **shared internal state** - when Session A takes a screenshot, Session B's connection breaks.
57
+ ### Automated Regression Testing
64
58
 
65
- ## Solution: Independent CDP Connections
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
- ## Installation
68
+ ### Tested Concurrency
76
69
 
77
- ### Prerequisites
70
+ | Sessions | Success Rate |
71
+ |----------|-------------|
72
+ | 5 | 100% |
73
+ | 10 | 100% |
74
+ | 15 | 100% |
75
+ | 20 | 100% |
78
76
 
79
- - Node.js 18+
80
- - Google Chrome (for browser automation)
77
+ ---
81
78
 
82
- ### Install
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
- ### Session Isolation (Recommended for Multiple Instances)
97
-
98
- ```bash
99
- # Start Claude Code with isolated config
100
- claude-chrome-parallel launch
110
+ ### Basic Usage
101
111
 
102
- # Pass any claude flags
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
- # Sync changes back to original config on exit
108
- claude-chrome-parallel launch --sync-back
114
+ ```
115
+ You: Take a screenshot of https://github.com
109
116
 
110
- # Keep session directory for debugging
111
- claude-chrome-parallel launch --keep-session
117
+ Claude: [Uses chrome-parallel tools automatically]
112
118
  ```
113
119
 
114
- ### Standalone Wrapper (Alternative)
120
+ ### Multiple Parallel Sessions
121
+
122
+ Run multiple Claude Code terminals simultaneously:
115
123
 
116
124
  ```bash
117
- # Simpler command
118
- claude-session
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
- ### Recovery Commands
129
+ # Terminal 2 (at the same time!)
130
+ claude
131
+ > Fill out the form on myapp.com/contact and submit
128
132
 
129
- ```bash
130
- # Check config health
131
- claude-chrome-parallel doctor
133
+ # Terminal 3 (also at the same time!)
134
+ claude
135
+ > Monitor network requests on myapp.com/api
136
+ ```
132
137
 
133
- # Auto-recover corrupted .claude.json
134
- claude-chrome-parallel recover
138
+ All sessions work without conflicts!
135
139
 
136
- # List available backups
137
- claude-chrome-parallel recover --list-backups
140
+ ### Available Browser Tools
138
141
 
139
- # Restore from specific backup
140
- claude-chrome-parallel recover --backup ".claude.json.2024-01-15T10-30-00-000Z.bak"
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
- # Force create new empty config
143
- claude-chrome-parallel recover --force-new
153
+ ---
144
154
 
145
- # Clean up old sessions and backups
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
- ### Browser Automation (MCP Server)
157
+ ### The Problem: Shared Extension State
152
158
 
153
- Add to `~/.claude.json`:
159
+ The official Chrome extension maintains a single shared state:
154
160
 
155
- ```json
156
- {
157
- "mcpServers": {
158
- "chrome-parallel": {
159
- "command": "claude-chrome-parallel",
160
- "args": ["serve"]
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
- Then use in Claude Code:
169
+ ### The Solution: Independent CDP Connections
170
+
171
+ Chrome's DevTools Protocol natively supports multiple simultaneous connections:
167
172
 
168
173
  ```
169
- You: Take a screenshot of https://github.com
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
- Claude: [Uses chrome-parallel tools automatically]
178
+ Independent connections, no shared state!
172
179
  ```
173
180
 
174
- **Run multiple sessions with browser automation:**
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
- # Terminal 1
178
- claude-chrome-parallel launch
179
- > Take a screenshot of github.com
188
+ # Start MCP server (used by Claude Code automatically)
189
+ claude-chrome-parallel serve
180
190
 
181
- # Terminal 2 (simultaneously!)
182
- claude-chrome-parallel launch
183
- > Take a screenshot of google.com
184
- ```
191
+ # Check Chrome connection status
192
+ claude-chrome-parallel check
185
193
 
186
- Both work without conflicts!
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
- ## CLI Reference
201
+ ---
191
202
 
192
- | Command | Description |
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
- ### Launch Options
205
+ By default, connects to Chrome on port 9222.
203
206
 
204
- | Option | Description |
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
- ### Recover Options
209
+ **Manual start** (if needed):
210
210
 
211
- | Option | Description |
212
- |--------|-------------|
213
- | `--list-backups` | List available backup files |
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
- ### Cleanup Options
215
+ # macOS
216
+ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
218
217
 
219
- | Option | Description |
220
- |--------|-------------|
221
- | `--max-age <hours>` | Max session age in hours (default: 24) |
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
- ## Browser Automation Tools
224
+ ## Additional Features
227
225
 
228
- | Tool | Description |
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
- ## How It Works
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
- ### Session Isolation
230
+ ```bash
231
+ # Run Claude Code with isolated config directory
232
+ claude-chrome-parallel launch
244
233
 
245
- ```
246
- Before (Dangerous):
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
- The `launch` command:
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
- ### Browser Automation
241
+ If your `.claude.json` gets corrupted:
269
242
 
270
- Chrome's DevTools Protocol natively supports multiple connections:
243
+ ```bash
244
+ # Auto-recover corrupted config
245
+ claude-chrome-parallel recover
271
246
 
272
- ```
273
- Process 1 ─► CDP Connection 1 ─┐
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
- ## Troubleshooting
253
+ ## Comparison
281
254
 
282
- ### Config Corruption
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
- ```bash
285
- # Check health
286
- claude-chrome-parallel doctor
263
+ ---
287
264
 
288
- # If corrupted, recover
289
- claude-chrome-parallel recover
290
- ```
265
+ ## Troubleshooting
291
266
 
292
- ### Chrome Not Connecting
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 Not Appearing
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-chrome-parallel",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "MCP server for parallel Claude Code browser sessions - no more 'Detached' errors",
5
5
  "main": "dist/index.js",
6
6
  "bin": {