@agimon-ai/browse-tool 0.2.4 → 0.2.6
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 +54 -103
- package/dist/cli.cjs +24 -24
- package/dist/cli.mjs +23 -23
- package/dist/extension/background.js +825 -49
- package/dist/extension/background.js.map +1 -1
- package/dist/extension/content.js +100 -5
- package/dist/extension/content.js.map +1 -1
- package/dist/extension/manifest.json +12 -1
- package/dist/extension/offscreen.js +300 -32
- package/dist/extension/offscreen.js.map +1 -1
- package/dist/extension/popup.html +4 -0
- package/dist/extension/popup.js +26 -0
- package/dist/extension/popup.js.map +1 -1
- package/dist/extension/recorder.html +26 -0
- package/dist/extension/recorder.js +294 -0
- package/dist/extension/recorder.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{playwright-test-CWwqqICj.cjs → playwright-test-CGgt4gB5.cjs} +1 -1
- package/dist/streamable-http-BFbkLZAL.mjs +13 -0
- package/dist/streamable-http-CkhxOp5e.cjs +14 -0
- package/dist/stubs/playwright-test.cjs +1 -1
- package/package.json +1 -2
- package/dist/stdio-BwMaaSWk.cjs +0 -10
- package/dist/stdio-CT2oPr3E.mjs +0 -9
package/README.md
CHANGED
|
@@ -56,14 +56,29 @@ Add to your Claude Code configuration (`.mcp.json`):
|
|
|
56
56
|
browse-tool mcp-serve [options]
|
|
57
57
|
|
|
58
58
|
Options:
|
|
59
|
-
-t, --type <type> Transport type: stdio (default: "stdio")
|
|
59
|
+
-t, --type <type> Transport type: stdio, streamable-http (default: "stdio")
|
|
60
60
|
-b, --browser <type> Default browser: chromium, firefox, webkit (default: "chromium")
|
|
61
61
|
--headless Run browsers in headless mode
|
|
62
62
|
--no-headless Run browsers in headed mode (visible window)
|
|
63
|
+
--host <host> Default host for HTTP services (default: "localhost")
|
|
64
|
+
--port <port> Port for streamable HTTP transport (default: "3201")
|
|
63
65
|
-p, --profile <name> Default profile name for browser sessions
|
|
64
66
|
--custom-tools <path> Expose tools from a folder containing tools.yaml
|
|
67
|
+
--snippets-dir <path> Directory used by browser_run_code to save and load reusable snippets
|
|
65
68
|
```
|
|
66
69
|
|
|
70
|
+
### Streamable HTTP Transport
|
|
71
|
+
|
|
72
|
+
For clients that can connect over MCP streamable HTTP, start `mcp-serve` with:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
browse-tool mcp-serve --type streamable-http --host 127.0.0.1 --port 3201
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This exposes the MCP endpoint at `http://127.0.0.1:3201/mcp` and keeps the existing browse-tool HTTP service for browser execution on its own port.
|
|
79
|
+
|
|
80
|
+
Streamable HTTP clients can pin a profile for the whole MCP session by sending `x-profile: <profile-name>` on the initialize request. When a profile is pre-selected this way, `browser_launch` always uses it and `browser_list_profiles` only returns that profile when it exists.
|
|
81
|
+
|
|
67
82
|
## Custom Tools
|
|
68
83
|
|
|
69
84
|
Custom tools are loaded from a folder containing:
|
|
@@ -186,6 +201,13 @@ browse-tool exec-custom-tool \
|
|
|
186
201
|
| `browser_resize_page` | Resize the browser viewport |
|
|
187
202
|
| `browser_emulate` | Emulate device, geolocation, or network conditions |
|
|
188
203
|
|
|
204
|
+
### Code Tools (2)
|
|
205
|
+
|
|
206
|
+
| Tool | Description |
|
|
207
|
+
|------|-------------|
|
|
208
|
+
| `browser_run_code` | Execute inline code against `{ page, context, browser }`, optionally save it as a reusable snippet |
|
|
209
|
+
| `browser_list_snippets` | List saved snippets by name, description, and snippetPath |
|
|
210
|
+
|
|
189
211
|
### Testing/Tracing Tools (3)
|
|
190
212
|
|
|
191
213
|
| Tool | Description |
|
|
@@ -203,63 +225,47 @@ browse-tool exec-custom-tool \
|
|
|
203
225
|
| `browser_delete_profile` | Delete a profile |
|
|
204
226
|
| `browser_save_profile_state` | Save current browser state to profile |
|
|
205
227
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
| Tool | Description |
|
|
209
|
-
|------|-------------|
|
|
210
|
-
| `run_automation` | Run an automation script with optional pause |
|
|
211
|
-
| `resume_automation` | Resume a paused automation |
|
|
212
|
-
| `get_automation_status` | Get automation session status |
|
|
213
|
-
|
|
214
|
-
## Automation Script Format
|
|
215
|
-
|
|
216
|
-
Automation scripts are TypeScript/JavaScript modules that export a `run` function:
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
import type { AutomationFixtures } from 'browse-tool';
|
|
228
|
+
## Saved Snippets
|
|
220
229
|
|
|
221
|
-
|
|
222
|
-
// Navigate to a page
|
|
223
|
-
await page.goto('https://example.com');
|
|
230
|
+
If you start `mcp-serve` or `http-serve` with `--snippets-dir <path>`, `browser_run_code` can persist inline snippets and later execute them again by `snippetPath`.
|
|
224
231
|
|
|
225
|
-
|
|
226
|
-
await pauseCheck('after-navigation', 'Page loaded, ready for inspection');
|
|
232
|
+
Save an inline snippet:
|
|
227
233
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"tool": "browser_run_code",
|
|
237
|
+
"arguments": {
|
|
238
|
+
"pageId": "page-1",
|
|
239
|
+
"code": "return await page.title();",
|
|
240
|
+
"saveAs": {
|
|
241
|
+
"name": "Get Page Title",
|
|
242
|
+
"description": "Return the current page title"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
237
245
|
}
|
|
238
246
|
```
|
|
239
247
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
| Fixture | Type | Description |
|
|
243
|
-
|---------|------|-------------|
|
|
244
|
-
| `page` | `Page` | Playwright Page instance |
|
|
245
|
-
| `context` | `BrowserContext` | Playwright BrowserContext |
|
|
246
|
-
| `browser` | `Browser` | Playwright Browser instance |
|
|
247
|
-
| `pauseCheck` | `Function` | Create pause checkpoints for LLM control |
|
|
248
|
+
List saved snippets:
|
|
248
249
|
|
|
249
|
-
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"tool": "browser_list_snippets",
|
|
253
|
+
"arguments": {}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
250
256
|
|
|
251
|
-
|
|
257
|
+
Run a saved snippet:
|
|
252
258
|
|
|
253
|
-
```
|
|
254
|
-
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"tool": "browser_run_code",
|
|
262
|
+
"arguments": {
|
|
263
|
+
"pageId": "page-1",
|
|
264
|
+
"snippetPath": "get-page-title.ts"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
255
267
|
```
|
|
256
268
|
|
|
257
|
-
When paused:
|
|
258
|
-
1. The automation waits for `resume_automation` to be called
|
|
259
|
-
2. All browser tools remain available for LLM interaction
|
|
260
|
-
3. The LLM can inspect page state, take screenshots, etc.
|
|
261
|
-
4. Once resumed, automation continues from where it paused
|
|
262
|
-
|
|
263
269
|
## Profile Management
|
|
264
270
|
|
|
265
271
|
Profiles allow you to persist browser state (cookies, localStorage, etc.) across sessions.
|
|
@@ -277,20 +283,6 @@ Profiles allow you to persist browser state (cookies, localStorage, etc.) across
|
|
|
277
283
|
}
|
|
278
284
|
```
|
|
279
285
|
|
|
280
|
-
### Use a Profile with Automation
|
|
281
|
-
|
|
282
|
-
```json
|
|
283
|
-
{
|
|
284
|
-
"tool": "run_automation",
|
|
285
|
-
"arguments": {
|
|
286
|
-
"scriptPath": "/path/to/script.ts",
|
|
287
|
-
"browserOptions": {
|
|
288
|
-
"profile": "my-profile"
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
```
|
|
293
|
-
|
|
294
286
|
### Save Profile State
|
|
295
287
|
|
|
296
288
|
```json
|
|
@@ -303,47 +295,6 @@ Profiles allow you to persist browser state (cookies, localStorage, etc.) across
|
|
|
303
295
|
}
|
|
304
296
|
```
|
|
305
297
|
|
|
306
|
-
## LLM-Controlled Automation Flow
|
|
307
|
-
|
|
308
|
-
The unique feature of browse-tool is the ability to run automation scripts with LLM intervention points:
|
|
309
|
-
|
|
310
|
-
1. **Start Automation with Pause**
|
|
311
|
-
```json
|
|
312
|
-
{
|
|
313
|
-
"tool": "run_automation",
|
|
314
|
-
"arguments": {
|
|
315
|
-
"scriptPath": "/path/to/script.ts",
|
|
316
|
-
"pauseAtStart": true
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
2. **Automation Pauses** - Returns `automationId` and `pageIds`
|
|
322
|
-
|
|
323
|
-
3. **LLM Interacts** - Use browser tools (`browser_click`, `browser_fill`, etc.) on the paused pages
|
|
324
|
-
|
|
325
|
-
4. **Resume Automation**
|
|
326
|
-
```json
|
|
327
|
-
{
|
|
328
|
-
"tool": "resume_automation",
|
|
329
|
-
"arguments": {
|
|
330
|
-
"automationId": "automation-1"
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
5. **Script Continues** - Until next `pauseCheck` or completion
|
|
336
|
-
|
|
337
|
-
6. **Check Status**
|
|
338
|
-
```json
|
|
339
|
-
{
|
|
340
|
-
"tool": "get_automation_status",
|
|
341
|
-
"arguments": {
|
|
342
|
-
"automationId": "automation-1"
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
```
|
|
346
|
-
|
|
347
298
|
## Configuration
|
|
348
299
|
|
|
349
300
|
### Environment Variables
|
|
@@ -429,7 +380,7 @@ browse-tool/
|
|
|
429
380
|
│ │ ├── ProfileService.ts # Profile management
|
|
430
381
|
│ │ └── SessionService.ts # Session tracking
|
|
431
382
|
│ ├── tools/ # MCP tool implementations
|
|
432
|
-
│ ├── transports/ # Transport handlers (stdio)
|
|
383
|
+
│ ├── transports/ # Transport handlers (stdio, streamable HTTP)
|
|
433
384
|
│ └── types/ # TypeScript type definitions
|
|
434
385
|
├── tests/
|
|
435
386
|
│ ├── services/ # Service unit tests
|