claude-chrome-parallel 2.3.0 → 3.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/README.md +352 -45
- package/dist/cdp/client.d.ts +27 -3
- package/dist/cdp/client.d.ts.map +1 -1
- package/dist/cdp/client.js +67 -3
- package/dist/cdp/client.js.map +1 -1
- package/dist/cdp/connection-pool.d.ts +5 -1
- package/dist/cdp/connection-pool.d.ts.map +1 -1
- package/dist/cdp/connection-pool.js +7 -1
- package/dist/cdp/connection-pool.js.map +1 -1
- package/dist/chrome/launcher.d.ts.map +1 -1
- package/dist/chrome/launcher.js +6 -0
- package/dist/chrome/launcher.js.map +1 -1
- package/dist/orchestration/state-manager.d.ts +117 -0
- package/dist/orchestration/state-manager.d.ts.map +1 -0
- package/dist/orchestration/state-manager.js +435 -0
- package/dist/orchestration/state-manager.js.map +1 -0
- package/dist/orchestration/workflow-engine.d.ts +96 -0
- package/dist/orchestration/workflow-engine.d.ts.map +1 -0
- package/dist/orchestration/workflow-engine.js +326 -0
- package/dist/orchestration/workflow-engine.js.map +1 -0
- package/dist/session-manager.d.ts +62 -18
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +274 -100
- package/dist/session-manager.js.map +1 -1
- package/dist/tools/computer.d.ts.map +1 -1
- package/dist/tools/computer.js +49 -3
- package/dist/tools/computer.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +13 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/navigate.d.ts.map +1 -1
- package/dist/tools/navigate.js +91 -8
- package/dist/tools/navigate.js.map +1 -1
- package/dist/tools/orchestration.d.ts +6 -0
- package/dist/tools/orchestration.d.ts.map +1 -0
- package/dist/tools/orchestration.js +436 -0
- package/dist/tools/orchestration.js.map +1 -0
- package/dist/tools/tabs-context.d.ts.map +1 -1
- package/dist/tools/tabs-context.js +42 -23
- package/dist/tools/tabs-context.js.map +1 -1
- package/dist/tools/tabs-create.d.ts +1 -1
- package/dist/tools/tabs-create.d.ts.map +1 -1
- package/dist/tools/tabs-create.js +30 -6
- package/dist/tools/tabs-create.js.map +1 -1
- package/dist/tools/worker-create.d.ts +7 -0
- package/dist/tools/worker-create.d.ts.map +1 -0
- package/dist/tools/worker-create.js +62 -0
- package/dist/tools/worker-create.js.map +1 -0
- package/dist/tools/worker-delete.d.ts +6 -0
- package/dist/tools/worker-delete.d.ts.map +1 -0
- package/dist/tools/worker-delete.js +80 -0
- package/dist/tools/worker-delete.js.map +1 -0
- package/dist/tools/worker-list.d.ts +6 -0
- package/dist/tools/worker-list.d.ts.map +1 -0
- package/dist/tools/worker-list.js +67 -0
- package/dist/tools/worker-list.js.map +1 -0
- package/dist/types/session.d.ts +35 -2
- package/dist/types/session.d.ts.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -5,9 +5,22 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/claude-chrome-parallel)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
+
## The Power of Authenticated Browser Sessions
|
|
9
|
+
|
|
10
|
+
Unlike traditional web scraping or automation tools, Claude Chrome Parallel operates within **your already logged-in Chrome browser**. This means:
|
|
11
|
+
|
|
12
|
+
- **Access authenticated services** - Gmail, Salesforce, LinkedIn, banking portals, admin dashboards
|
|
13
|
+
- **No credential management** - Session cookies and OAuth tokens are already active
|
|
14
|
+
- **Bypass bot detection** - Uses your real browser profile, not headless automation
|
|
15
|
+
- **Access personalized data** - Dashboards, account settings, member-only content
|
|
16
|
+
|
|
17
|
+
**This is not just a development tool.** While the parallel session feature solves a technical problem for developers, the real power lies in automating *any* web task that requires authentication - tasks that were previously impossible to automate without building complex auth flows.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
8
21
|
## Why This Exists
|
|
9
22
|
|
|
10
|
-
[Claude Chrome](https://claude.ai/chrome)
|
|
23
|
+
[Claude Chrome](https://claude.ai/chrome) lets you debug **production environments while logged in**. But when you try to run multiple Claude Code sessions with browser automation simultaneously:
|
|
11
24
|
|
|
12
25
|
```
|
|
13
26
|
Error: Detached while handling command
|
|
@@ -29,9 +42,171 @@ Each session gets isolated browser control. No shared state = No conflicts.
|
|
|
29
42
|
|
|
30
43
|
## Use Cases
|
|
31
44
|
|
|
32
|
-
###
|
|
45
|
+
### Beyond Development: Real-World Automation
|
|
46
|
+
|
|
47
|
+
The combination of **authenticated sessions** + **natural language control** + **parallel execution** enables automation scenarios that were previously impractical:
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### 1. Business Process Automation
|
|
52
|
+
|
|
53
|
+
#### ERP/SaaS Dashboard Data Collection
|
|
54
|
+
Extract reports from login-required services (Salesforce, HubSpot, Zendesk):
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
You: Navigate to our Salesforce dashboard and extract this month's sales pipeline data
|
|
58
|
+
|
|
59
|
+
Claude: [Navigates to authenticated Salesforce, parses tables, extracts structured data]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Invoice & Receipt Collection
|
|
63
|
+
Automatically download monthly invoices from multiple services:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
You: Go to AWS billing console and download last month's invoice PDF
|
|
67
|
+
|
|
68
|
+
Claude: [Navigates to authenticated AWS console, finds invoice, triggers download]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### Repetitive Admin Tasks
|
|
72
|
+
Process approvals, submit forms, update records:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
You: Go to our HR portal and approve all pending time-off requests from my team
|
|
76
|
+
|
|
77
|
+
Claude: [Navigates to HR system, finds pending items, processes each approval]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### 2. Research & Data Collection
|
|
83
|
+
|
|
84
|
+
#### Competitive Analysis (Login-Required Platforms)
|
|
85
|
+
Gather intelligence from premium platforms:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
You: Search LinkedIn Sales Navigator for CTOs at fintech startups in NYC and list their profiles
|
|
89
|
+
|
|
90
|
+
Claude: [Uses your LinkedIn Premium session to search and extract profile data]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Academic Database Research
|
|
94
|
+
Access institutional databases that require authentication:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
You: Search IEEE Xplore for papers on "transformer architecture" from 2023 and list titles with citations
|
|
98
|
+
|
|
99
|
+
Claude: [Uses your university library login to search and extract paper metadata]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Financial & Real Estate Data
|
|
103
|
+
Access member-only pricing and transaction data:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
You: Check my Schwab portfolio and summarize today's gains/losses by sector
|
|
107
|
+
|
|
108
|
+
Claude: [Navigates authenticated brokerage account, extracts and analyzes positions]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### 3. Social Media Management
|
|
114
|
+
|
|
115
|
+
#### Multi-Account Content Publishing
|
|
116
|
+
Post content across platforms:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
You: Post this announcement to our company LinkedIn, Twitter, and Facebook pages
|
|
120
|
+
|
|
121
|
+
Claude: [Navigates to each platform with saved sessions, composes and publishes posts]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Message & Inquiry Management
|
|
125
|
+
Handle customer messages with templates:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
You: Check our Instagram business inbox and reply to product inquiries with our standard response
|
|
129
|
+
|
|
130
|
+
Claude: [Reads DMs, identifies product questions, sends templated responses]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Analytics Collection
|
|
134
|
+
Gather engagement metrics across platforms:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
You: Get our Twitter analytics for the past week and summarize engagement trends
|
|
138
|
+
|
|
139
|
+
Claude: [Accesses Twitter Analytics dashboard, extracts metrics, provides summary]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### 4. E-Commerce Automation
|
|
145
|
+
|
|
146
|
+
#### Member Price Monitoring
|
|
147
|
+
Track prices that require membership login:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
You: Check the member price for this Costco item and compare with last week
|
|
151
|
+
|
|
152
|
+
Claude: [Logs into Costco account, finds item, extracts member-only pricing]
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### Inventory & Order Management
|
|
156
|
+
Manage seller accounts across marketplaces:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
You: Check our Amazon Seller Central for any new orders and list items running low on inventory
|
|
160
|
+
|
|
161
|
+
Claude: [Navigates seller dashboard, extracts order and inventory data]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Review Management
|
|
165
|
+
Respond to customer reviews at scale:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
You: Find all unanswered 4-star reviews on our Shopify store and draft personalized thank-you responses
|
|
169
|
+
|
|
170
|
+
Claude: [Navigates store admin, identifies reviews, generates contextual responses]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### 5. Personal Productivity
|
|
176
|
+
|
|
177
|
+
#### Email Organization
|
|
178
|
+
Manage your inbox intelligently:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
You: In Gmail, find all newsletters from the past month and add the "Newsletters" label
|
|
182
|
+
|
|
183
|
+
Claude: [Searches Gmail, selects matching emails, applies labels]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### Calendar Management
|
|
187
|
+
Bulk calendar operations:
|
|
33
188
|
|
|
34
|
-
|
|
189
|
+
```
|
|
190
|
+
You: Add these 5 meetings to my Google Calendar with the details from this spreadsheet
|
|
191
|
+
|
|
192
|
+
Claude: [Creates each calendar event with proper dates, times, and descriptions]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### Bookmark & Archive Management
|
|
196
|
+
Organize saved content:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
You: Save this article to my Notion reading list with its title and summary
|
|
200
|
+
|
|
201
|
+
Claude: [Extracts metadata, navigates to Notion, creates database entry]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### 6. QA & Testing
|
|
207
|
+
|
|
208
|
+
#### Multi-Session QA Testing
|
|
209
|
+
Run parallel test scenarios against production:
|
|
35
210
|
|
|
36
211
|
```bash
|
|
37
212
|
# Terminal 1: Test user login flow
|
|
@@ -44,28 +219,149 @@ claude -p "Test the checkout flow on https://myapp.com/cart"
|
|
|
44
219
|
claude -p "Take screenshots of https://myapp.com/admin every 30 seconds"
|
|
45
220
|
```
|
|
46
221
|
|
|
47
|
-
|
|
222
|
+
#### Network Condition Testing
|
|
223
|
+
Test performance under various network conditions:
|
|
48
224
|
|
|
49
|
-
|
|
225
|
+
```
|
|
226
|
+
You: Simulate 3G network and test if our checkout page loads within 5 seconds
|
|
227
|
+
|
|
228
|
+
Claude: [Applies network throttling, measures load time, reports results]
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### Accessibility Auditing
|
|
232
|
+
Analyze page accessibility via the accessibility tree:
|
|
50
233
|
|
|
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"
|
|
55
234
|
```
|
|
235
|
+
You: Check the accessibility tree of our signup form and identify any missing labels
|
|
56
236
|
|
|
57
|
-
|
|
237
|
+
Claude: [Parses full accessibility tree, identifies WCAG compliance issues]
|
|
238
|
+
```
|
|
58
239
|
|
|
59
|
-
|
|
240
|
+
---
|
|
60
241
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
242
|
+
### 7. Security & Compliance
|
|
243
|
+
|
|
244
|
+
#### Personal Data Audit
|
|
245
|
+
Check what data services have stored:
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
You: Navigate to my Google Account privacy settings and list all third-party apps with access
|
|
249
|
+
|
|
250
|
+
Claude: [Navigates account settings, extracts connected app list]
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### Session Verification
|
|
254
|
+
Verify active sessions across services:
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
You: Check my GitHub security settings and list all active sessions
|
|
258
|
+
|
|
259
|
+
Claude: [Navigates GitHub settings, extracts session information]
|
|
66
260
|
```
|
|
67
261
|
|
|
68
|
-
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Core Features
|
|
265
|
+
|
|
266
|
+
### Isolated Workers (Parallel Browser Contexts)
|
|
267
|
+
|
|
268
|
+
The killer feature of Claude Chrome Parallel is **worker isolation**. Each worker has:
|
|
269
|
+
|
|
270
|
+
- **Separate browser context** with its own cookies, localStorage, and sessionStorage
|
|
271
|
+
- **Independent tab management** - tabs are scoped to their worker
|
|
272
|
+
- **Complete state isolation** - one worker's login doesn't affect another
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
You: Create a worker named "google-shopping"
|
|
276
|
+
|
|
277
|
+
Claude: [Creates isolated browser context]
|
|
278
|
+
Worker: google-shopping
|
|
279
|
+
Context: Isolated (separate cookies/storage)
|
|
280
|
+
|
|
281
|
+
You: In google-shopping worker, search for laptops
|
|
282
|
+
|
|
283
|
+
Claude: [Opens tab in google-shopping worker context]
|
|
284
|
+
Any login, preferences, or state is isolated to this worker
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Why This Matters:**
|
|
288
|
+
- Log into different accounts simultaneously (e.g., multiple Gmail accounts)
|
|
289
|
+
- Run parallel price comparisons without cookie conflicts
|
|
290
|
+
- Test multi-user scenarios with complete isolation
|
|
291
|
+
|
|
292
|
+
### Automatic Task Distribution
|
|
293
|
+
|
|
294
|
+
When you have multiple tabs open, operations are automatically distributed:
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
You: Take screenshots of all open tabs
|
|
298
|
+
|
|
299
|
+
Claude: [Parallel execution across all tabs]
|
|
300
|
+
Tab 1: Screenshot taken (500ms)
|
|
301
|
+
Tab 2: Screenshot taken (480ms)
|
|
302
|
+
Tab 3: Screenshot taken (520ms)
|
|
303
|
+
Total: ~500ms (parallel) vs ~1500ms (sequential)
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Workflow Orchestration
|
|
307
|
+
|
|
308
|
+
For complex multi-site operations, use the orchestration tools:
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
// Initialize a parallel workflow
|
|
312
|
+
workflow_init({
|
|
313
|
+
name: "Price Comparison",
|
|
314
|
+
workers: [
|
|
315
|
+
{ name: "amazon", url: "https://amazon.com", task: "Search iPhone 15 price" },
|
|
316
|
+
{ name: "ebay", url: "https://ebay.com", task: "Search iPhone 15 price" },
|
|
317
|
+
{ name: "walmart", url: "https://walmart.com", task: "Search iPhone 15 price" }
|
|
318
|
+
]
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
// Each worker executes in parallel with isolated contexts
|
|
322
|
+
// Results are collected via workflow_collect
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Available MCP Tools
|
|
328
|
+
|
|
329
|
+
### Browser Automation Tools
|
|
330
|
+
|
|
331
|
+
| Tool | Description | Key Use Cases |
|
|
332
|
+
|------|-------------|---------------|
|
|
333
|
+
| `navigate` | Navigate to URL, back/forward history | Multi-page workflows |
|
|
334
|
+
| `computer` | Screenshots, mouse clicks, keyboard, scrolling | Non-standard UI interaction |
|
|
335
|
+
| `read_page` | Parse page via accessibility tree | Dynamic content extraction |
|
|
336
|
+
| `find` | Find elements by natural language | "search box", "submit button" |
|
|
337
|
+
| `form_input` | Set form values directly | Fast data entry |
|
|
338
|
+
| `javascript_tool` | Execute arbitrary JavaScript | Complex DOM operations |
|
|
339
|
+
| `network` | Simulate network conditions | Performance testing |
|
|
340
|
+
|
|
341
|
+
### Tab & Worker Management Tools
|
|
342
|
+
|
|
343
|
+
| Tool | Description | Key Use Cases |
|
|
344
|
+
|------|-------------|---------------|
|
|
345
|
+
| `tabs_context_mcp` | Get available tabs by worker | Session overview |
|
|
346
|
+
| `tabs_create_mcp` | Create new tab in worker | Parallel tab operations |
|
|
347
|
+
| `worker_create` | Create isolated browser context | Multi-account scenarios |
|
|
348
|
+
| `worker_list` | List all workers and their tabs | Session management |
|
|
349
|
+
| `worker_delete` | Delete worker and close its tabs | Cleanup |
|
|
350
|
+
|
|
351
|
+
### Orchestration Tools
|
|
352
|
+
|
|
353
|
+
| Tool | Description | Key Use Cases |
|
|
354
|
+
|------|-------------|---------------|
|
|
355
|
+
| `workflow_init` | Initialize multi-worker workflow | Parallel site operations |
|
|
356
|
+
| `workflow_status` | Get orchestration progress | Monitoring |
|
|
357
|
+
| `workflow_collect` | Collect results from workers | Data aggregation |
|
|
358
|
+
| `workflow_cleanup` | Clean up workflow resources | Session cleanup |
|
|
359
|
+
| `worker_update` | Update worker progress | Progress tracking |
|
|
360
|
+
| `worker_complete` | Mark worker as complete | Workflow completion |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Tested Concurrency
|
|
69
365
|
|
|
70
366
|
| Sessions | Success Rate |
|
|
71
367
|
|----------|-------------|
|
|
@@ -94,13 +390,15 @@ Add to your Claude Code MCP settings (`~/.claude.json`):
|
|
|
94
390
|
{
|
|
95
391
|
"mcpServers": {
|
|
96
392
|
"chrome-parallel": {
|
|
97
|
-
"command": "
|
|
393
|
+
"command": "ccp",
|
|
98
394
|
"args": ["serve"]
|
|
99
395
|
}
|
|
100
396
|
}
|
|
101
397
|
}
|
|
102
398
|
```
|
|
103
399
|
|
|
400
|
+
> **Note:** `ccp` is a shorthand alias. You can also use the full name `claude-chrome-parallel`.
|
|
401
|
+
|
|
104
402
|
Restart Claude Code for changes to take effect.
|
|
105
403
|
|
|
106
404
|
---
|
|
@@ -137,20 +435,6 @@ claude
|
|
|
137
435
|
|
|
138
436
|
All sessions work without conflicts!
|
|
139
437
|
|
|
140
|
-
### Available Browser Tools
|
|
141
|
-
|
|
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 |
|
|
152
|
-
| `network` | Simulate network conditions (3G, 4G, offline, custom) |
|
|
153
|
-
|
|
154
438
|
### Network Simulation
|
|
155
439
|
|
|
156
440
|
Test how your app behaves under different network conditions:
|
|
@@ -197,27 +481,29 @@ Each Claude Code session spawns its own MCP server process with a dedicated CDP
|
|
|
197
481
|
|
|
198
482
|
## CLI Commands
|
|
199
483
|
|
|
484
|
+
> **Tip:** Use `ccp` as a shorthand for `claude-chrome-parallel` in all commands below.
|
|
485
|
+
|
|
200
486
|
```bash
|
|
201
487
|
# Start MCP server (used by Claude Code automatically)
|
|
202
|
-
|
|
488
|
+
ccp serve
|
|
203
489
|
|
|
204
490
|
# Check Chrome connection status
|
|
205
|
-
|
|
491
|
+
ccp check
|
|
206
492
|
|
|
207
493
|
# Use custom Chrome debugging port
|
|
208
|
-
|
|
494
|
+
ccp serve --port 9223
|
|
209
495
|
|
|
210
496
|
# Check installation health
|
|
211
|
-
|
|
497
|
+
ccp doctor
|
|
212
498
|
|
|
213
499
|
# View session status and statistics
|
|
214
|
-
|
|
500
|
+
ccp status
|
|
215
501
|
|
|
216
502
|
# View status as JSON (for automation)
|
|
217
|
-
|
|
503
|
+
ccp status --json
|
|
218
504
|
|
|
219
505
|
# Clean up stale sessions and old backups
|
|
220
|
-
|
|
506
|
+
ccp cleanup --max-age 24 --keep-backups 10
|
|
221
507
|
```
|
|
222
508
|
|
|
223
509
|
---
|
|
@@ -251,11 +537,11 @@ When running multiple Claude Code instances, they can corrupt `~/.claude.json` d
|
|
|
251
537
|
|
|
252
538
|
```bash
|
|
253
539
|
# Run Claude Code with isolated config directory
|
|
254
|
-
|
|
540
|
+
ccp launch
|
|
255
541
|
|
|
256
542
|
# Pass any claude flags
|
|
257
|
-
|
|
258
|
-
|
|
543
|
+
ccp launch --dangerously-skip-permissions
|
|
544
|
+
ccp launch -p "Your prompt"
|
|
259
545
|
```
|
|
260
546
|
|
|
261
547
|
### Config Recovery
|
|
@@ -264,10 +550,10 @@ If your `.claude.json` gets corrupted:
|
|
|
264
550
|
|
|
265
551
|
```bash
|
|
266
552
|
# Auto-recover corrupted config
|
|
267
|
-
|
|
553
|
+
ccp recover
|
|
268
554
|
|
|
269
555
|
# List available backups
|
|
270
|
-
|
|
556
|
+
ccp recover --list-backups
|
|
271
557
|
```
|
|
272
558
|
|
|
273
559
|
---
|
|
@@ -287,13 +573,34 @@ claude-chrome-parallel recover --list-backups
|
|
|
287
573
|
|
|
288
574
|
---
|
|
289
575
|
|
|
576
|
+
## Considerations
|
|
577
|
+
|
|
578
|
+
### Strengths
|
|
579
|
+
- **Authenticated access** - Automate any login-required service
|
|
580
|
+
- **Natural language element finding** - Resilient to DOM changes
|
|
581
|
+
- **JavaScript execution** - Handle complex SPAs
|
|
582
|
+
- **Visual verification** - Screenshots for evidence/debugging
|
|
583
|
+
|
|
584
|
+
### Limitations
|
|
585
|
+
- CAPTCHA/bot detection on some services
|
|
586
|
+
- 2FA re-authentication may require manual intervention
|
|
587
|
+
- For high-volume tasks, native APIs are more efficient when available
|
|
588
|
+
- Rate limiting applies to automated interactions
|
|
589
|
+
|
|
590
|
+
### Recommended Patterns
|
|
591
|
+
1. **Small/critical tasks** → Use this MCP
|
|
592
|
+
2. **High-volume tasks** → Prefer native APIs when available
|
|
593
|
+
3. **Services without APIs** → This MCP is often the only option
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
290
597
|
## Troubleshooting
|
|
291
598
|
|
|
292
599
|
### Chrome not connecting
|
|
293
600
|
|
|
294
601
|
```bash
|
|
295
602
|
# Check status
|
|
296
|
-
|
|
603
|
+
ccp check
|
|
297
604
|
|
|
298
605
|
# Manually start Chrome with debugging
|
|
299
606
|
chrome --remote-debugging-port=9222
|
package/dist/cdp/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CDP Client - Wrapper around puppeteer-core for Chrome DevTools Protocol
|
|
3
3
|
*/
|
|
4
|
-
import { Browser, Page, Target, CDPSession } from 'puppeteer-core';
|
|
4
|
+
import { Browser, BrowserContext, Page, Target, CDPSession } from 'puppeteer-core';
|
|
5
5
|
export interface CDPClientOptions {
|
|
6
6
|
port?: number;
|
|
7
7
|
maxReconnectAttempts?: number;
|
|
@@ -27,6 +27,7 @@ export declare class CDPClient {
|
|
|
27
27
|
private heartbeatTimer;
|
|
28
28
|
private connectionState;
|
|
29
29
|
private eventListeners;
|
|
30
|
+
private targetDestroyedListeners;
|
|
30
31
|
private reconnectAttempts;
|
|
31
32
|
private autoLaunch;
|
|
32
33
|
constructor(options?: CDPClientOptions);
|
|
@@ -42,6 +43,14 @@ export declare class CDPClient {
|
|
|
42
43
|
* Remove connection event listener
|
|
43
44
|
*/
|
|
44
45
|
removeConnectionListener(listener: (event: ConnectionEvent) => void): void;
|
|
46
|
+
/**
|
|
47
|
+
* Add target destroyed listener
|
|
48
|
+
*/
|
|
49
|
+
addTargetDestroyedListener(listener: (targetId: string) => void): void;
|
|
50
|
+
/**
|
|
51
|
+
* Handle target destroyed event
|
|
52
|
+
*/
|
|
53
|
+
private onTargetDestroyed;
|
|
45
54
|
/**
|
|
46
55
|
* Emit connection event
|
|
47
56
|
*/
|
|
@@ -82,10 +91,25 @@ export declare class CDPClient {
|
|
|
82
91
|
* Get browser instance
|
|
83
92
|
*/
|
|
84
93
|
getBrowser(): Browser;
|
|
94
|
+
static readonly DEFAULT_VIEWPORT: {
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Create a new isolated browser context for session isolation
|
|
100
|
+
* Each context has its own cookies, localStorage, sessionStorage
|
|
101
|
+
*/
|
|
102
|
+
createBrowserContext(): Promise<BrowserContext>;
|
|
103
|
+
/**
|
|
104
|
+
* Close a browser context and all its pages
|
|
105
|
+
*/
|
|
106
|
+
closeBrowserContext(context: BrowserContext): Promise<void>;
|
|
85
107
|
/**
|
|
86
|
-
* Create a new page
|
|
108
|
+
* Create a new page with default viewport
|
|
109
|
+
* @param url Optional URL to navigate to
|
|
110
|
+
* @param context Optional browser context for session isolation
|
|
87
111
|
*/
|
|
88
|
-
createPage(url?: string): Promise<Page>;
|
|
112
|
+
createPage(url?: string, context?: BrowserContext): Promise<Page>;
|
|
89
113
|
/**
|
|
90
114
|
* Get all page targets
|
|
91
115
|
*/
|
package/dist/cdp/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/cdp/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/cdp/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAkB,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI9F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,g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;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhD;;OAEG;IACH,WAAW,IAAI,OAAO;CAGvB;AAKD,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAKlE"}
|
package/dist/cdp/client.js
CHANGED
|
@@ -26,6 +26,7 @@ class CDPClient {
|
|
|
26
26
|
heartbeatTimer = null;
|
|
27
27
|
connectionState = 'disconnected';
|
|
28
28
|
eventListeners = [];
|
|
29
|
+
targetDestroyedListeners = [];
|
|
29
30
|
reconnectAttempts = 0;
|
|
30
31
|
autoLaunch;
|
|
31
32
|
constructor(options = {}) {
|
|
@@ -58,6 +59,26 @@ class CDPClient {
|
|
|
58
59
|
this.eventListeners.splice(index, 1);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Add target destroyed listener
|
|
64
|
+
*/
|
|
65
|
+
addTargetDestroyedListener(listener) {
|
|
66
|
+
this.targetDestroyedListeners.push(listener);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Handle target destroyed event
|
|
70
|
+
*/
|
|
71
|
+
onTargetDestroyed(targetId) {
|
|
72
|
+
this.sessions.delete(targetId);
|
|
73
|
+
for (const listener of this.targetDestroyedListeners) {
|
|
74
|
+
try {
|
|
75
|
+
listener(targetId);
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
console.error('[CDPClient] Target destroyed listener error:', e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
61
82
|
/**
|
|
62
83
|
* Emit connection event
|
|
63
84
|
*/
|
|
@@ -173,6 +194,12 @@ class CDPClient {
|
|
|
173
194
|
console.error('[CDPClient] Browser disconnected');
|
|
174
195
|
this.handleDisconnect();
|
|
175
196
|
});
|
|
197
|
+
// Set up target destroyed handler
|
|
198
|
+
this.browser.on('targetdestroyed', (target) => {
|
|
199
|
+
const targetId = getTargetId(target);
|
|
200
|
+
console.error(`[CDPClient] Target destroyed: ${targetId}`);
|
|
201
|
+
this.onTargetDestroyed(targetId);
|
|
202
|
+
});
|
|
176
203
|
this.connectionState = 'connected';
|
|
177
204
|
this.emitConnectionEvent({
|
|
178
205
|
type: 'connected',
|
|
@@ -257,12 +284,49 @@ class CDPClient {
|
|
|
257
284
|
}
|
|
258
285
|
return this.browser;
|
|
259
286
|
}
|
|
287
|
+
// Default viewport for consistent debugging experience
|
|
288
|
+
static DEFAULT_VIEWPORT = { width: 1920, height: 1080 };
|
|
260
289
|
/**
|
|
261
|
-
* Create a new
|
|
290
|
+
* Create a new isolated browser context for session isolation
|
|
291
|
+
* Each context has its own cookies, localStorage, sessionStorage
|
|
262
292
|
*/
|
|
263
|
-
async
|
|
293
|
+
async createBrowserContext() {
|
|
264
294
|
const browser = this.getBrowser();
|
|
265
|
-
const
|
|
295
|
+
const context = await browser.createBrowserContext();
|
|
296
|
+
console.error(`[CDPClient] Created new browser context`);
|
|
297
|
+
return context;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Close a browser context and all its pages
|
|
301
|
+
*/
|
|
302
|
+
async closeBrowserContext(context) {
|
|
303
|
+
try {
|
|
304
|
+
await context.close();
|
|
305
|
+
console.error(`[CDPClient] Closed browser context`);
|
|
306
|
+
}
|
|
307
|
+
catch (e) {
|
|
308
|
+
// Context may already be closed
|
|
309
|
+
console.error(`[CDPClient] Error closing browser context:`, e);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Create a new page with default viewport
|
|
314
|
+
* @param url Optional URL to navigate to
|
|
315
|
+
* @param context Optional browser context for session isolation
|
|
316
|
+
*/
|
|
317
|
+
async createPage(url, context) {
|
|
318
|
+
let page;
|
|
319
|
+
if (context) {
|
|
320
|
+
// Create page in isolated context
|
|
321
|
+
page = await context.newPage();
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
// Create page in default context
|
|
325
|
+
const browser = this.getBrowser();
|
|
326
|
+
page = await browser.newPage();
|
|
327
|
+
}
|
|
328
|
+
// Set default viewport for consistent debugging experience
|
|
329
|
+
await page.setViewport(CDPClient.DEFAULT_VIEWPORT);
|
|
266
330
|
if (url) {
|
|
267
331
|
await page.goto(url, { waitUntil: 'domcontentloaded' });
|
|
268
332
|
}
|