turbo-browser-mcp 0.6.0 → 0.7.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 +273 -325
- package/package.json +3 -3
- package/server.json +3 -3
- package/skills/turbo-browser/SKILL.md +83 -0
- package/src/aftermath.mjs +145 -42
- package/src/allow-hosts.mjs +171 -0
- package/src/boundaries.mjs +34 -0
- package/src/browser-manager.mjs +398 -39
- package/src/cdp-bridge.mjs +487 -73
- package/src/cdp-raw.mjs +81 -0
- package/src/dom-engine.mjs +1505 -123
- package/src/guards.mjs +346 -294
- package/src/index.mjs +1330 -1207
- package/src/navinfo.mjs +139 -0
- package/src/playwright-loader.mjs +15 -0
- package/src/secrets.mjs +125 -0
- package/src/toast.mjs +45 -0
- package/benchmarks/E2E_COMPARISON.md +0 -57
- package/benchmarks/E2E_PLAN.md +0 -131
- package/benchmarks/benchmark.mjs +0 -773
- package/benchmarks/e2e-agent/.gitattributes +0 -2
- package/benchmarks/e2e-agent/README.md +0 -128
- package/benchmarks/e2e-agent/evaluate.mjs +0 -35
- package/benchmarks/e2e-agent/fixtures/attachment.pdf +0 -22
- package/benchmarks/e2e-agent/fixtures/attachment.pdf.sha256 +0 -1
- package/benchmarks/e2e-agent/install-stacks.ps1 +0 -30
- package/benchmarks/e2e-agent/report.mjs +0 -16
- package/benchmarks/e2e-agent/run.ps1 +0 -10
- package/benchmarks/e2e-agent/runner.mjs +0 -139
- package/benchmarks/e2e-agent/self-test.mjs +0 -73
- package/benchmarks/e2e-agent/server.mjs +0 -96
- package/benchmarks/e2e-agent/stacks/agent-browser.md +0 -3
- package/benchmarks/e2e-agent/stacks/browse.md +0 -3
- package/benchmarks/e2e-agent/stacks/browser-harness.md +0 -3
- package/benchmarks/e2e-agent/stacks/turbo.md +0 -2
- package/benchmarks/e2e-agent/uninstall-stacks.ps1 +0 -11
- package/benchmarks/e2e-tasks.mjs +0 -258
package/README.md
CHANGED
|
@@ -1,264 +1,90 @@
|
|
|
1
1
|
# turbo-browser-mcp
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Tthanh2k6/turbo-browser-mcp/actions/workflows/ci.yml)
|
|
4
|
-

|
|
4
|
+
[](https://www.npmjs.com/package/turbo-browser-mcp)
|
|
5
|
+

|
|
7
6
|

|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
An MCP server for browser automation, built on Playwright. It has 11 tools, and each one does more per call than the usual one-action-per-call design:
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
- `smart_fill_form` fills a whole form in one call, including React inputs, selects, comboboxes, rich-text editors and file uploads read from disk.
|
|
11
|
+
- `inspect_compact` can return only the elements that changed since the last snapshot.
|
|
12
|
+
- `batch_actions` runs a list of clicks, key presses, form steps and page reads as one call.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Fewer calls means fewer model turns and less page text replayed in the conversation. The numbers, and their limits, are under [Benchmarks](#benchmarks).
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Buttons that look like a final commit (Submit, Send, Publish, Pay, Confirm, and their Korean, Japanese, Chinese and Vietnamese equivalents) are blocked by default, so an agent can prefill a form and leave the last click to a person. Pass `allowSubmit: true` per call or start with `--allow-submit` to turn this off.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
| :--- | :--- | :--- | :--- | :--- |
|
|
19
|
-
| **Dense UI Snapshot** (140-btn SaaS console) | `18,654` tok HTML / `3,568` tok full ARIA | **`1,135` tok** compact (`28 ms`) | `1` call | **`93.9%` vs HTML** (`68.2%` vs ARIA) |
|
|
20
|
-
| **Post-Click Delta Snapshot** (`onlyChanged: true`) | `3,582` tok full ARIA rescan | **`56` tok** changed lines (`18 ms`) | `1` call | **`98.4%` vs ARIA** (`99.7%` vs HTML) |
|
|
21
|
-
| **10-Field Complex Form + Snapshot** (`smart_fill_form`) | `11` turns (`574 ms`, `12,197` dir / `72,614` cum tok) | **`1` turn** (`82 ms`, **`811` tok**) | **`7x` faster**, `11 -> 1` turns | **`93.4%` direct / `98.9%` cumulative** |
|
|
22
|
-
| **48 KiB PDF Upload** (`49,152` bytes) | `44,728` tok inline Base64 tool arg | **`85` tok** disk path (`68 ms`) | Zero Base64 generation | **`99.8%` saved** |
|
|
23
|
-
| **6-Step Interactive UI Flow** (`batch_actions`) | `6` turns (`411 ms`, `955` dir / `3,162` cum tok) | **`1` turn** (`357 ms`, **`406` tok**) | **`1.15x` faster**, `6 -> 1` turns | **`57.5%` direct / `87.2%` cumulative** |
|
|
24
|
-
| **Open 6 Tabs Concurrently** (`open_many`) | `6` turns sequential (`998 ms`) | **`1` turn** batched (`420 ms`) | **`2.38x` faster**, `6x` fewer turns | `5` fewer prompt replays |
|
|
25
|
-
| **Heavy Media Load** (`preset: "turbo"`, `304 KiB` assets) | `252 ms`, `9` media requests (`304 KiB`) | **`165 ms`**, `0` media requests (`0 KiB`) | **`1.53x` faster** | **`100%` media bandwidth cut** |
|
|
26
|
-
| **Article Markdown Scraping** (`extract_clean_text`) | `3,595` tok raw HTML (`10,844` chars) | **`156` tok** clean Markdown (`641` chars) | Clean reader output | **`95.7%` saved** |
|
|
27
|
-
| **Diagnostics Triage** (`page_diagnostics` errors-only) | `3,460` tok unfiltered (`32` req / `26` console) | **`601` tok** default errors (`2` req / `6` console) | Zero noise scrolling | **`82.6%` saved** |
|
|
28
|
-
| **Static MCP Tool Schema** (every turn overhead) | `3,917` tok Playwright / `6,737` tok DevTools | **`3,170` tok** stripped (`3,541` full w/ annotations) | `11` tools vs `25` / `33` | **`19.1%` vs Playwright / `52.9%` vs DevTools** |
|
|
18
|
+
The server does not hide that the browser is automated: no stealth patches, no fingerprint changes, no CAPTCHA solving. For sites with a bot check it can hand the tab to a person and continue afterwards ([`wait_for_human`](#handing-a-step-to-a-person-wait_for_human---open-profile)).
|
|
29
19
|
|
|
30
|
-
|
|
20
|
+
## Install
|
|
31
21
|
|
|
32
|
-
|
|
22
|
+
Needs Node 20 or newer and a Chromium-based browser (Chrome, Edge, Brave, or Playwright's Chromium).
|
|
33
23
|
|
|
34
|
-
|
|
24
|
+
Claude Code:
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```mermaid
|
|
39
|
-
sequenceDiagram
|
|
40
|
-
autonumber
|
|
41
|
-
participant Agent as LLM Agent
|
|
42
|
-
participant Std as Standard MCP (Playwright / DevTools)
|
|
43
|
-
participant Turbo as turbo-browser-mcp
|
|
44
|
-
|
|
45
|
-
Note over Agent,Std: Standard MCP (12+ LLM turns, full ARIA tree + history replay each step)
|
|
46
|
-
Agent->>Std: 1. snapshot() -> full ARIA (~3,568 tok)
|
|
47
|
-
loop Repeats 10+ times across fields, selects, checkboxes, upload
|
|
48
|
-
Agent->>Std: fill / select_option / click
|
|
49
|
-
Std-->>Agent: full ARIA or confirmation re-added to history
|
|
50
|
-
end
|
|
51
|
-
Agent->>Std: 12. upload inline or click chooser
|
|
52
|
-
|
|
53
|
-
Note over Agent,Turbo: turbo-browser-mcp (2 LLM turns total, delta & inline snapshot)
|
|
54
|
-
Agent->>Turbo: 1. inspect_compact(mode: "forms") -> compact refs (1,135 tok)
|
|
55
|
-
Agent->>Turbo: 2. smart_fill_form(fields: [...10 fields + disk PDF...], returnSnapshot: true)
|
|
56
|
-
Turbo-->>Agent: Filled 10 fields + guarded before Submit + inline snapshot (811 tok)
|
|
26
|
+
```bash
|
|
27
|
+
claude mcp add turbo-browser -- npx -y turbo-browser-mcp
|
|
57
28
|
```
|
|
58
29
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## What `turbo-browser-mcp` Supports
|
|
62
|
-
|
|
63
|
-
### 1. Connection & Session Isolation
|
|
64
|
-
- **4 connection modes (`--mode auto|cdp|persistent|launch`):**
|
|
65
|
-
- `auto` (default): probes `--cdp http://127.0.0.1:9222` first so agents can reuse an existing signed-in browser session, then falls back to launching Chromium.
|
|
66
|
-
- `cdp`: attach directly to a running Chromium/Chrome/Edge remote debugging port.
|
|
67
|
-
- `persistent`: launch with a reusable `--user-data-dir` profile across runs.
|
|
68
|
-
- `launch`: start a clean browser session (`--headless` by default, or `--headed`).
|
|
69
|
-
- **Auto binary discovery (`src/playwright-loader.mjs`):** checks `playwright-core` cache revisions across Windows, macOS, and Linux, system installs of Google Chrome, Microsoft Edge, Brave, and Chromium, or an explicit `--executable <path>`.
|
|
70
|
-
- **Per-tab isolation (`tabs_batch`):** open tabs inside named `isolatedContext` sandboxes with separate cookies and storage, batch-open up to 10 concurrent URLs (`open_many`), activate, reload, go `back`/`forward`, `resize` viewport, and emulate `colorScheme`, `media`, `reducedMotion`, `contrast`, `forcedColors`, or custom `userAgent`.
|
|
71
|
-
|
|
72
|
-
### 2. DOM, Iframe & Shadow DOM Inspection (`inspect_compact`)
|
|
73
|
-
- **Snapshot modes:** `interactive`, `forms`, `article`, and `all`.
|
|
74
|
-
- **Cross-boundary traversal:** flattens main frame DOM, child iframes (`includeFrames`, `frameIdx`), and open Shadow DOM. Injects an init script hooking `Element.prototype.attachShadow` (`WeakMap` + `WeakRef`/`FinalizationRegistry` + `window.__tbmGetShadowRoot`) to keep post-init closed Shadow roots inspectable and guarded, traverses `<slot>` `assignedNodes({ flatten: true })`, and supports Form-Associated Custom Elements.
|
|
75
|
-
- **Token controls:** `onlyChanged: true` emits only elements added or changed since the prior snapshot; `query` filters by regex or substring; `boxes: true` adds `[box=x,y,w,h]` only when needed; `maxChars` caps payload size; `savePath` writes full output to disk.
|
|
76
|
-
|
|
77
|
-
### 3. Single-Turn Smart Form Engine (`smart_fill_form`)
|
|
78
|
-
Prefills an entire form in one MCP call while flushing microtasks and macrotasks between controlled inputs:
|
|
79
|
-
- **Standard & framework inputs:** text, email, password, number, date, textarea, `<input type="range">`, checkboxes, radio groups (`check`, `not`, `overwrite`). Triggers React-controlled state updates via native property setters and synthetic events.
|
|
80
|
-
- **Selects & custom widgets:** `<select>` and `<select multiple>` (`option` / `values`), ARIA comboboxes, ARIA switches, `contenteditable` rich editors, and Gmail compose dialogs (`gmail: { to, subject, body }`).
|
|
81
|
-
- **Frame & wildcard targeting:** target specific iframes via `frameIdx`, or set `all: true` to populate matching controls across frames.
|
|
82
|
-
- **Direct disk uploads:** pass `file` or `files` paths directly to Playwright `setInputFiles` without loading binary files or Base64 strings into LLM context.
|
|
83
|
-
- **Atomic verification:** pass `returnSnapshot: true` to inspect the updated form state in the same tool response.
|
|
84
|
-
|
|
85
|
-
### 4. 16 Interactive Actions & Multi-Step Chaining (`act_fast`, `batch_actions`)
|
|
86
|
-
- **`act_fast` actions:** `click`, `dblclick`, `hover`, `focus`, `clear`, `fill`, `type` (`slowly`, `delayMs`, `submit`), `select`, `check`, `uncheck`, `drag`, `drop` (`file`, `files`, or custom MIME `dropData`), `press` (`key` + `modifiers`: `Alt`, `Control`, `ControlOrMeta`, `Meta`, `Shift`), `scroll` (`dx`, `dy`), `wait` (`ms`, `state`, `loadState`, `text`, `textGone`, `url`), and `upload`.
|
|
87
|
-
- **Targeting options:** compact `[eN]` `ref`, CSS `selector`, visible `text`, `label`, or viewport `(x, y)` coordinates, with `button` (`left`, `right`, `middle`) and `frameIdx`.
|
|
88
|
-
- **`batch_actions`:** runs an ordered list of DOM actions and nested `smart_fill_form` steps in one MCP call, stopping safely if blocked by the Submit guard or optionally continuing on step errors (`continueOnError`).
|
|
89
|
-
|
|
90
|
-
### 5. Clean Extraction, Evaluation & Media Capture (`extract_clean_text`, `evaluate_js`, `capture_page`)
|
|
91
|
-
- **`extract_clean_text`:** extracts readable plain text or compact Markdown (`format: "text" | "markdown"`) from main/article containers and iframes, stripped of script and style noise.
|
|
92
|
-
- **`evaluate_js`:** runs JS expressions or `(el, arg)` element functions in any frame (`frameIdx`) with JSON-serialized results and optional `savePath` export.
|
|
93
|
-
- **`capture_page`:** full-page or element-scoped screenshots (`png` or `jpeg` with `quality`, `css` or `device` scale, optional `returnImage`) and PDF generation saved to a confined `savePath`.
|
|
94
|
-
|
|
95
|
-
### 6. Network Blocking, Storage State & Diagnostics (`network_session`, `page_diagnostics`)
|
|
96
|
-
- **`network_session` presets:** `turbo`, `no-images`, `no-media`, and `clean` (unblock all), alongside custom `blockResources` and `blockUrls` patterns.
|
|
97
|
-
- **Session & storage management:** read/write/clear browser `cookies`, `localStorage`/`sessionStorage`, and export or reload full Playwright `storageState` JSON files (`saveStorageStatePath`, `loadStorageStatePath`).
|
|
98
|
-
- **`page_diagnostics`:** defaults to errors-only (`level: "errors"`, `statusFilter: "errors"`) to surface failures cleanly without flooding context, while supporting `all`, `includeStatic`, `urlFilter`, deep request/response inspection (`reqId` + `part`), completed downloads, and dialog auto-handling (`dialogPolicy`: `accept`/`dismiss`).
|
|
30
|
+
Clients that read an `mcpServers` JSON config (Cursor, Claude Desktop, Antigravity and others):
|
|
99
31
|
|
|
100
|
-
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"turbo-browser": {
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["-y", "turbo-browser-mcp"],
|
|
38
|
+
"env": { "TURBO_BROWSER_SAVE_ROOT": "/absolute/path/to/workspace" }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
101
43
|
|
|
102
|
-
|
|
44
|
+
`TURBO_BROWSER_SAVE_ROOT` is the only folder the server may write screenshots, PDFs and storage files to, or read storage files from. Leave it out and the current working directory is used.
|
|
103
45
|
|
|
104
|
-
|
|
46
|
+
Check the setup, and install Chromium if no browser is found:
|
|
105
47
|
|
|
106
48
|
```bash
|
|
107
|
-
|
|
49
|
+
npx -y turbo-browser-mcp --doctor
|
|
50
|
+
npx playwright-core install chromium
|
|
108
51
|
```
|
|
109
52
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### 1. Snapshot & Reader Extraction (Chars & Exact `o200k_base` Tokens)
|
|
53
|
+
By default the server first tries a Chrome that is already listening on `http://127.0.0.1:9222`, so the agent can use a browser you are signed in to, and otherwise launches its own headless Chromium. `--mode`, `--headed` and the other options are listed under [CLI options](#cli-options-and-environment-variables).
|
|
113
54
|
|
|
114
|
-
|
|
115
|
-
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
116
|
-
| **140-Button SaaS Console** (`inspect_compact`) | `61,010` chars (`18,654` tok) | `12,771` chars (`3,568` tok) | **`3,968` chars (`1,135` tok)** | **`68.2%`** | **`93.9%`** |
|
|
117
|
-
| **Post-Click Delta** (`onlyChanged: true`) | `61,010` chars (`18,654` tok) | `12,825` chars (`3,582` tok) | **`168` chars (`56` tok)** | **`98.4%`** | **`99.7%`** |
|
|
118
|
-
| **Article Markdown Extraction** (`extract_clean_text`) | `10,844` chars (`3,595` tok) | n/a | **`641` chars (`156` tok)** | n/a | **`95.7%`** |
|
|
119
|
-
| **Diagnostics Filter** (`32` reqs, `26` console logs) | `9,651` chars (`3,460` tok, `all`) | n/a | **`1,761` chars (`601` tok, `errors`)** | n/a | **`82.6%`** |
|
|
55
|
+
From source:
|
|
120
56
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
| **48 KiB PDF Upload** (`49,152` bytes via `file`) | `65,679` chars (`44,728` tok) Base64 payload | **`263` chars (`85` tok)** disk path (`68 ms`) | Zero LLM Base64 encode | **`99.8%`** |
|
|
127
|
-
| **6-Step UI Flow** (`batch_actions`) | `6` turns, `411 ms`, `955` dir / `3,162` cum tok | **`1` turn**, **`357 ms`**, **`406` tok** | **`1.15x` faster** | **`57.5%` dir / `87.2%` cum** |
|
|
128
|
-
| **Open 6 Tabs** (`tabs_batch` `open_many`, `60 ms` TTFB) | `6` turns sequential (`998 ms`) | **`1` turn** batched (`420 ms`) | **`2.38x` faster** (`6 -> 1` turns) | Eliminates `5` turns |
|
|
129
|
-
| **Heavy Media Load** (`8x32 KiB` imgs + `48 KiB` font) | `252 ms`, `9` media hits (`304 KiB`) | **`165 ms`**, `0` media hits (`0 KiB`) | **`1.53x` faster** | **`100%` media saved** |
|
|
130
|
-
|
|
131
|
-
### 3. Static MCP Tool Definition Footprint
|
|
132
|
-
|
|
133
|
-
Measured against installed MCP JSON schemas on disk (compact parameter schemas without `annotations`):
|
|
134
|
-
|
|
135
|
-
| MCP Server | Tool Count | Compact Schema Chars | Exact `o200k_base` Tokens | Savings with `turbo-browser-mcp` |
|
|
136
|
-
| :--- | :--- | :--- | :--- | :--- |
|
|
137
|
-
| `turbo-browser-mcp` | **`11`** (`15,144` full / `13,631` compact) | **`13,631`** | **`3,170`** (`3,541` full w/ annotations) | Baseline (`11` tools) |
|
|
138
|
-
| `@playwright/mcp` | `25` | `18,457` | `3,917` | **`19.1%` fewer static tokens** |
|
|
139
|
-
| `chrome-devtools-mcp` | `33` | `30,252` | `6,737` | **`52.9%` fewer static tokens** |
|
|
140
|
-
|
|
141
|
-
v0.5.0 added `wait_for_human` and the commit-safety parameters for about 160 tokens per turn (v0.4.0: `3,010` compact). To keep that small, `expect` / `submissionKey` / `allowDuplicate` are declared only on `batch_actions` (a one-step batch works for a single click), and the network guard is switched on by environment variable, so it costs no schema tokens. The label lists for other languages run inside the page and are never sent to the model.
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Comparison vs `@playwright/mcp` and `chrome-devtools-mcp`
|
|
146
|
-
|
|
147
|
-
| Feature | `turbo-browser-mcp` | `@playwright/mcp` | `chrome-devtools-mcp` |
|
|
148
|
-
| :--- | :--- | :--- | :--- |
|
|
149
|
-
| **Tool Surface Size** | **10 batched tools** | 25 granular tools | 33 granular tools |
|
|
150
|
-
| **Delta Snapshots (`onlyChanged`)** | Built-in | Full tree every snapshot | Full tree every snapshot |
|
|
151
|
-
| **Closed Shadow DOM Hook** | Post-init `attachShadow` hook + `<slot>` flattening | Open Shadow DOM | CDP / standard DOM access |
|
|
152
|
-
| **Single-Call Smart Form + Contenteditable** | Yes (React, Shadow DOM, iframe, Gmail, ranges) | Multi-turn fill + separate select calls | Basic `fill_form` |
|
|
153
|
-
| **Disk File Upload (Zero Base64)** | Native `file`/`files` path in `smart_fill_form` & `act_fast` | Dedicated `browser_file_upload` turn | Dedicated `upload_file` turn |
|
|
154
|
-
| **Default Human-in-the-Loop Submit Guard** | Yes (`allowSubmit=false`, form/iframe/Enter hooks) | No | No |
|
|
155
|
-
| **Parallel `open_many` + `isolatedContext`** | Single batched call | Separate sequential tab calls | Separate page calls |
|
|
156
|
-
| **One-Call `turbo` Media Blocker** | Built-in (`turbo`, `no-images`, `no-media`) | Manual JS / routing | Network emulation |
|
|
157
|
-
| **Performance / Heap Profiling** | Not included | Not included | **Trace, Lighthouse, Heap Snapshot** |
|
|
158
|
-
|
|
159
|
-
> **When to keep Chrome DevTools MCP alongside `turbo-browser-mcp`:** `chrome-devtools-mcp` provides Lighthouse audits, performance trace analysis, CSS computed style panels, and V8 heap snapshots. `turbo-browser-mcp` focuses on fast multi-step UI automation, forms, and scraping with minimal token overhead.
|
|
160
|
-
|
|
161
|
-
### Tool Parity Map
|
|
162
|
-
|
|
163
|
-
| Capability | `turbo-browser-mcp` | `@playwright/mcp` | `chrome-devtools-mcp` |
|
|
164
|
-
| :--- | :--- | :--- | :--- |
|
|
165
|
-
| Multi-tab open, list, switch, resize, emulate | `tabs_batch` | `browser_tabs`, `browser_navigate`, `browser_resize`, ... | `new_page`, `list_pages`, `select_page`, `resize_page`, ... |
|
|
166
|
-
| DOM / accessibility inspection | `inspect_compact` | `browser_snapshot` | `take_snapshot` |
|
|
167
|
-
| Multi-field form & upload | `smart_fill_form` | `browser_fill_form` + `browser_select_option` + `browser_file_upload` | `fill_form` + `upload_file` |
|
|
168
|
-
| Click, type, drag, press, scroll, wait | `act_fast` | `browser_click`, `browser_type`, `browser_drag`, ... | `click`, `type_text`, `drag`, `press_key`, `wait_for` |
|
|
169
|
-
| Multi-step sequential macro | `batch_actions` | `browser_run_code_unsafe` or N tool calls | N separate tool calls |
|
|
170
|
-
| Clean article extraction | `extract_clean_text` | `browser_evaluate` custom JS | `evaluate_script` custom JS |
|
|
171
|
-
| Frame/element JS evaluation | `evaluate_js` | `browser_evaluate` | `evaluate_script` |
|
|
172
|
-
| Errors, network & console triage | `page_diagnostics` | `browser_console_messages`, `browser_network_requests` | `list_console_messages`, `list_network_requests`, ... |
|
|
173
|
-
| Screenshots & PDF export | `capture_page` | `browser_take_screenshot` | `take_screenshot` |
|
|
174
|
-
| Blocking presets, cookies & storage | `network_session` | `browser_evaluate` + context config | Partial via `evaluate_script` / `emulate` |
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Safety: Human-in-the-Loop Submit Guard & Path Confinement
|
|
179
|
-
|
|
180
|
-
1. **Human-in-the-loop Submit Guard (`allowSubmit=false` by default):**
|
|
181
|
-
- `smart_fill_form` (`stopBeforeSubmit: true`), `act_fast`, and `batch_actions` inspect matching elements, W3C AccName labels (`isSafeSubmitter`), implicit HTML form Enter submissions, key chords (`Shift+Enter`, `Enter+Shift`), `HTMLFormElement.prototype.submit`/`requestSubmit`, and same-origin iframe `contentWindow`/`contentDocument` proxies.
|
|
182
|
-
- Final actions resembling `Submit`, `Publish`, `Send`, `Post`, `Apply`, `Confirm`, or payment triggers are blocked unless `allowSubmit: true` is explicitly passed or `--allow-submit` is enabled at startup.
|
|
183
|
-
- Trade-off: pre-existing closed Shadow roots on already-open CDP tabs (attached before the init script ran) or strict cross-origin sandboxed frames fall back to Playwright frame handles, coordinate actions, and keyboard input.
|
|
184
|
-
2. **Workspace Path Confinement (`TURBO_BROWSER_SAVE_ROOT`):**
|
|
185
|
-
- File outputs (`savePath`, `saveStorageStatePath`) and state inputs (`loadStorageStatePath`) are strictly confined to the current working directory or `TURBO_BROWSER_SAVE_ROOT`.
|
|
186
|
-
- Lexical checks, `lstatSync`/`readlinkSync` symlink verification, and `realpathSync` validation block `..` traversal, UNC network paths, dangling symlinks, cyclic symlinks, and Windows junctions before reading or writing.
|
|
187
|
-
|
|
188
|
-
### Commit safety added in v0.5.0 (from Show HN and dev.to feedback)
|
|
189
|
-
|
|
190
|
-
Readers who run agents on real portals pointed out three gaps in a label-based guard. v0.5.0 adds an opt-in answer to each. `expect`, `submissionKey` and `allowDuplicate` appear in the `batch_actions` schema; `act_fast` accepts the same arguments without advertising them. The network guard is turned on with `TURBO_BROWSER_NETWORK_GUARD=true` and covers `act_fast`, `batch_actions` and `smart_fill_form`.
|
|
191
|
-
|
|
192
|
-
1. **A landed click is not a confirmed submission → `expect`.** After an allowed submit, pass `expect: { urlMatches?, textMatches?, selector?, timeoutMs? }`. The result carries `submitVerified` and `evidence` (the new URL, a text snippet such as a receipt number, or the matched selector). If nothing shows up in time you get `submitVerified: false` and a reason, so the agent does not report "done" on an empty submission list.
|
|
193
|
-
2. **A re-run is a second entry, not a retry → `submissionKey`.** With `submissionKey: "portal:2026-11-15:entry-42"`, every allowed submit is appended to a JSONL ledger (`~/.turbo-browser-mcp/submissions.jsonl`, or `TURBO_BROWSER_LEDGER`, or `ledgerPath` inside the save root). A later call with the same key is refused with `blockedBy: "ledger"` unless `allowDuplicate: true`.
|
|
194
|
-
3. **Labels lie → modal rule + `networkGuard`.** On many Korean portals the last step reads 다음 and the real commit is a 확인 inside a modal that opens afterwards.
|
|
195
|
-
- Affirmative buttons (`확인`, `OK`, `Yes`, `Confirm`, `確認`, `确定`, `Đồng ý`, …) inside `dialog` / `[role=dialog]` / `[role=alertdialog]` / `[aria-modal=true]` now count as commits (`blockedBy: "modal"`). Cookie banners (dialog text mentions cookies) and date/time pickers (dialog contains a calendar grid or date input) are excluded; a confirmation that only mentions "privacy" or "consent" is still blocked.
|
|
196
|
-
- When an action makes the page call `form.submit()` / `requestSubmit()` or fire a `submit` event and the guard stops it, the result now says so (`submitSuppressed`, `note`) instead of a bare `ok: true`. The action itself (a select, a check) still counts as done, so batches continue.
|
|
197
|
-
- Common Korean, Japanese, Chinese and Vietnamese submit labels were added (`제출`, `신청`, `등록`, `결제`, `送信`, `確定`, `提交`, `Hoàn tất`, …), and `다음`, `次へ`, `下一步` are treated like `Next`.
|
|
198
|
-
- `TURBO_BROWSER_NETWORK_GUARD=true` is the safety net that does not depend on labels: while submitting is not allowed, non-GET navigations and same-site `fetch`/XHR `POST`/`PUT`/`PATCH`/`DELETE` are stopped and reported (`blockedBy: "network"`, `networkBlocked[]`). Blocked navigations get a `204` so the page and the half-filled form stay put. Let harmless endpoints through with `TURBO_BROWSER_NETWORK_GUARD_ALLOW="/autosave$,/analytics"`. Per call, the undeclared arguments `networkGuard`, `networkGuardAllow` and `networkGuardSettleMs` override the env values. It is off by default because multi-step wizards often `POST` on every "Next".
|
|
199
|
-
- Every blocked result now says which mechanism stopped it: `blockedBy` is `label`, `modal`, `network` or `ledger`.
|
|
200
|
-
|
|
201
|
-
Limits:
|
|
202
|
-
- The network guard watches the action plus `networkGuardSettleMs` (250 ms) afterwards, so a commit fired later by a timer is not caught. WebSocket messages, requests made by a service worker, and cross-site `fetch` POSTs are not inspected (cross-site *navigations* are). Patterns in `TURBO_BROWSER_NETWORK_GUARD_ALLOW` are split on commas, so a pattern cannot contain one.
|
|
203
|
-
- The ledger is written only when the call returns. If the call throws after the page already sent the submission (for example a navigation timeout), nothing is recorded; check the site before re-running.
|
|
204
|
-
- `expect.selector` that is not a valid selector never matches, so the call reports `submitVerified: false` after the timeout.
|
|
205
|
-
|
|
206
|
-
### Human-first sessions (`wait_for_human`, `--open-profile`)
|
|
207
|
-
|
|
208
|
-
Some sites fail their bot check whenever the browser is remote-controlled, so a person has to open the same profile in a normal browser first. turbo-browser-mcp does **not** try to hide automation: no stealth plugins, no fingerprint or `navigator.webdriver` patching, no CAPTCHA solving. It supports two hand-off flows instead.
|
|
209
|
-
|
|
210
|
-
1. **Before the session:** `turbo-browser-mcp --open-profile --url https://site.example/login` opens plain Chrome (no debugging port, no automation flags) on the dedicated profile `~/.turbo-browser-mcp/chrome-profile` (or `--user-data-dir`). The human logs in or passes the check and closes the window. Then start the server with `--user-data-dir <same path>` or `--launch-chrome`, and the agent reuses those cookies. This works for sites that check at login; a site that re-checks on every request will still see an automated browser.
|
|
211
|
-
2. **During the session:** the agent calls `wait_for_human` with a message and a condition (`urlMatches`, `selector`, `textMatches` or `textGone`). The tool brings the tab to the front and polls until the condition holds, then the agent continues in the same tab with the same cookies. Keep `timeoutMs` below your MCP client's request timeout and call it again to keep waiting.
|
|
212
|
-
|
|
213
|
-
```json
|
|
214
|
-
{
|
|
215
|
-
"name": "wait_for_human",
|
|
216
|
-
"arguments": {
|
|
217
|
-
"message": "Please sign in and finish the security check, then leave the tab open.",
|
|
218
|
-
"selector": "#account-menu",
|
|
219
|
-
"timeoutMs": 120000
|
|
220
|
-
}
|
|
221
|
-
}
|
|
57
|
+
```bash
|
|
58
|
+
git clone https://github.com/Tthanh2k6/turbo-browser-mcp.git
|
|
59
|
+
cd turbo-browser-mcp
|
|
60
|
+
npm install
|
|
61
|
+
node src/index.mjs --doctor
|
|
222
62
|
```
|
|
223
63
|
|
|
224
|
-
|
|
64
|
+
## Tools
|
|
225
65
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
| Tool | Purpose | Key Parameters |
|
|
66
|
+
| Tool | Purpose | Key parameters |
|
|
229
67
|
| :--- | :--- | :--- |
|
|
230
|
-
| `tabs_batch` |
|
|
231
|
-
| `inspect_compact` |
|
|
232
|
-
| `smart_fill_form` |
|
|
233
|
-
| `act_fast` |
|
|
234
|
-
| `batch_actions` | Ordered
|
|
235
|
-
| `extract_clean_text` |
|
|
236
|
-
| `evaluate_js` |
|
|
237
|
-
| `page_diagnostics` | Console, network, downloads
|
|
238
|
-
| `capture_page` | PNG/JPEG
|
|
239
|
-
| `network_session` | Resource
|
|
68
|
+
| `tabs_batch` | Tab and browser lifecycle | `operations[]` (`list`, `open`, `open_many`, `navigate`, `activate`, `resize`, `emulate`, `reload`, `back`, `forward`, `close`, `close_browser`), `isolatedContext`, `concurrency` (1-10) |
|
|
69
|
+
| `inspect_compact` | Size-capped snapshot of elements, forms or article text | `mode` (`interactive`, `forms`, `article`, `all`), `onlyChanged`, `query`, `boxes`, `maxChars`, `includeFrames`, `savePath` |
|
|
70
|
+
| `smart_fill_form` | Fill a form, editors and file inputs in one call | `fields[]` (`ref`, `selector`, `value`, `option`, `values`, `check`, `not`, `keys`, `file`, `files`, `frameIdx`, `all`), `gmail`, `overwrite`, `stopBeforeSubmit`, `returnSnapshot` |
|
|
71
|
+
| `act_fast` | One action on the page | `action` (16 actions), `ref`/`selector`/`text`/`label`/`(x, y)`, `modifiers`, `dropData`, `allowSubmit`, `observeAftermath`, `returnSnapshot` |
|
|
72
|
+
| `batch_actions` | Ordered actions, form steps, and multi-page navigate/extract | `steps[]` (including `navigate` with `url`, `extract` with `format`, `selector`, `maxChars`), `continueOnError`, `allowSubmit`, `expect` (`urlMatches`, `textMatches`, `textNew`, `selector`), `submissionKey`, `allowDuplicate`, `observeAftermath`, `returnSnapshot`, `snapshotMaxChars`, `snapshotQuery` |
|
|
73
|
+
| `extract_clean_text` | Page text or compact Markdown | `format` (`text`, `markdown`), `selector`, `includeFrames`, `maxChars`, `savePath` |
|
|
74
|
+
| `evaluate_js` | JS expression, or a function called with `(el, arg)` | `expression`, `arg`, `frameIdx`, `ref`/`selector`/`text`, `savePath` |
|
|
75
|
+
| `page_diagnostics` | Console, network, downloads and dialogs | `level` (`errors`, `all`), `statusFilter` (`errors`, `all`), `includeStatic`, `urlFilter`, `reqId`, `part`, `dialogPolicy`, `clear`, `savePath` |
|
|
76
|
+
| `capture_page` | PNG/JPEG screenshot or PDF | `mode` (`screenshot`, `pdf`), `type`, `quality`, `fullPage`, `scale` (`css`, `device`), `ref`/`selector`/`text`, `returnImage`, `savePath` |
|
|
77
|
+
| `network_session` | Resource blocking, cookies and storage | `preset` (`turbo`, `no-images`, `no-media`, `clean`), `blockResources`, `blockUrls`, `cookieAction`, `storageAction`, `loadStorageStatePath`, `saveStorageStatePath` |
|
|
240
78
|
| `wait_for_human` | Hand a step to a person, resume in the same session | `message`, `urlMatches`, `selector`, `textMatches`, `textGone`, `timeoutMs`, `pollMs` |
|
|
241
79
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"name": "batch_actions",
|
|
246
|
-
"arguments": {
|
|
247
|
-
"steps": [
|
|
248
|
-
{ "action": "smart_fill_form", "fields": [{ "selector": "#name", "value": "홍길동" }] },
|
|
249
|
-
{ "action": "click", "text": "다음" },
|
|
250
|
-
{ "action": "click", "text": "확인" }
|
|
251
|
-
],
|
|
252
|
-
"allowSubmit": true,
|
|
253
|
-
"expect": { "textMatches": "접수번호\\s*R-\\d+", "timeoutMs": 8000 },
|
|
254
|
-
"submissionKey": "photo-contest:2026-11-15:entry-1"
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
```
|
|
80
|
+
The server also sends short `instructions` in the MCP initialize result: batch fields with `smart_fill_form`, chain steps with `batch_actions`, use `onlyChanged` after the first snapshot, and use refs from the latest snapshot.
|
|
81
|
+
|
|
82
|
+
With `--tools core` (or `TURBO_BROWSER_TOOLS=core`) only `tabs_batch`, `inspect_compact`, `smart_fill_form`, `act_fast`, `batch_actions` and `extract_clean_text` are listed, and calls to the other tools are refused. The default lists all 11.
|
|
258
83
|
|
|
259
|
-
###
|
|
84
|
+
### Examples
|
|
85
|
+
|
|
86
|
+
#### Fill a form, attach a PDF from disk, return the result in the same call
|
|
260
87
|
|
|
261
|
-
#### 1. Fill a 10-field form with a disk PDF & inspect result in 1 turn
|
|
262
88
|
```json
|
|
263
89
|
{
|
|
264
90
|
"name": "smart_fill_form",
|
|
@@ -277,7 +103,8 @@ Some sites fail their bot check whenever the browser is remote-controlled, so a
|
|
|
277
103
|
}
|
|
278
104
|
```
|
|
279
105
|
|
|
280
|
-
####
|
|
106
|
+
#### Read only what changed after opening a modal
|
|
107
|
+
|
|
281
108
|
```json
|
|
282
109
|
{
|
|
283
110
|
"name": "inspect_compact",
|
|
@@ -289,7 +116,8 @@ Some sites fail their bot check whenever the browser is remote-controlled, so a
|
|
|
289
116
|
}
|
|
290
117
|
```
|
|
291
118
|
|
|
292
|
-
####
|
|
119
|
+
#### Open tabs in parallel in separate cookie contexts
|
|
120
|
+
|
|
293
121
|
```json
|
|
294
122
|
{
|
|
295
123
|
"name": "tabs_batch",
|
|
@@ -302,135 +130,255 @@ Some sites fail their bot check whenever the browser is remote-controlled, so a
|
|
|
302
130
|
}
|
|
303
131
|
```
|
|
304
132
|
|
|
305
|
-
|
|
133
|
+
#### Allow the final click, check for a receipt, refuse a repeat
|
|
306
134
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"name": "batch_actions",
|
|
138
|
+
"arguments": {
|
|
139
|
+
"steps": [
|
|
140
|
+
{ "action": "smart_fill_form", "fields": [{ "selector": "#name", "value": "홍길동" }] },
|
|
141
|
+
{ "action": "click", "text": "다음" },
|
|
142
|
+
{ "action": "click", "text": "확인" }
|
|
143
|
+
],
|
|
144
|
+
"allowSubmit": true,
|
|
145
|
+
"expect": { "textMatches": "접수번호\\s*R-\\d+", "timeoutMs": 8000 },
|
|
146
|
+
"submissionKey": "photo-contest:2026-11-15:entry-1"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
320
149
|
```
|
|
321
150
|
|
|
322
|
-
|
|
151
|
+
#### Extract several pages in one call
|
|
323
152
|
|
|
324
|
-
Using local clone:
|
|
325
153
|
```json
|
|
326
154
|
{
|
|
327
|
-
"
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
"
|
|
331
|
-
"
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
|
|
155
|
+
"name": "batch_actions",
|
|
156
|
+
"arguments": {
|
|
157
|
+
"steps": [
|
|
158
|
+
{ "action": "navigate", "url": "https://example.com/catalog?page=2" },
|
|
159
|
+
{ "action": "extract", "format": "text", "selector": "main", "maxChars": 3000 },
|
|
160
|
+
{ "action": "navigate", "url": "https://example.com/catalog?page=3" },
|
|
161
|
+
{ "action": "extract", "format": "markdown", "selector": "main", "maxChars": 3000 }
|
|
162
|
+
]
|
|
335
163
|
}
|
|
336
164
|
}
|
|
337
165
|
```
|
|
338
166
|
|
|
339
|
-
|
|
167
|
+
Navigation uses GET in the same tab and waits for `domcontentloaded`. Each extract step returns the same output as `extract_clean_text` in its step result.
|
|
168
|
+
|
|
169
|
+
## Behavior notes
|
|
170
|
+
|
|
171
|
+
- **Connection.** `--mode auto` (default) probes `--cdp http://127.0.0.1:9222` and falls back to launching Chromium. `cdp` attaches to a running browser, `persistent` reuses a `--user-data-dir` profile, `launch` starts a clean session (headless unless `--headed`). The browser is found in the Playwright cache, in system installs of Chrome, Edge, Brave and Chromium, or at `--executable <path>`.
|
|
172
|
+
- **Tabs.** `isolatedContext` gives a tab its own cookies and storage. `open_many` opens up to 10 URLs at once. `emulate` sets `colorScheme`, `media`, `reducedMotion`, `contrast`, `forcedColors` or a `userAgent`. In CDP mode an isolated context closes with the process that opened it (and, via the bridge, with its client); tabs another process holds in its own isolated context are listed as `isolatedContext:"other"`.
|
|
173
|
+
- **Snapshots.** `inspect_compact` reads the main frame, child iframes (`includeFrames`, `frameIdx`) and open Shadow DOM. With `onlyChanged: true` a `*` before a line marks a ref that is new since the last snapshot, and a `Removed:` line lists refs that went away. An unchanged Submit-like button is still listed so the model knows it exists, and the submit guard still blocks it. `query` filters by regex or substring, `boxes: true` adds `[box=x,y,w,h]`, `maxChars` caps the output, and `savePath` writes the full output to disk.
|
|
174
|
+
- **Forms.** `smart_fill_form` handles text-like inputs, `<input type="range">`, checkboxes, radio groups, `<select>` and `<select multiple>`, ARIA comboboxes and switches, `contenteditable` editors, and Gmail compose (`gmail: { to, subject, body }`). Set `all: true` to fill matching controls across frames. `file` and `files` paths go straight to Playwright's `setInputFiles`, so file contents never enter the model's context.
|
|
175
|
+
- **Actions.** `act_fast` takes `click`, `dblclick`, `hover`, `focus`, `clear`, `fill`, `type`, `select`, `check`, `uncheck`, `drag`, `drop`, `press`, `scroll`, `wait` and `upload`. A target is a `ref` from the latest snapshot, a CSS `selector`, visible `text`, a `label`, or `(x, y)` coordinates.
|
|
176
|
+
- **Settle step.** After a click, double click or key press with `returnSnapshot` or `observeAftermath`, the server waits up to 150 ms for a navigation to start, then for `domcontentloaded` if one did, then until the DOM has been quiet for 80 ms and no request younger than 1.5 s is pending, at most 800 ms. There is no fixed sleep. The result has `outcome`: `navigated` (the URL changed), `changed` (the DOM changed) or `none`.
|
|
177
|
+
- **Errors.** A missing ref lists the 3 nearest current refs with labels. An intercepted click names the covering element. A missing `select` option lists up to 5 close options. `fill` reads the value back and adds `mismatch` when the field holds something else (a mask or `maxlength`; a password value is not echoed).
|
|
178
|
+
- **`batch_actions`** stops when the submit guard blocks a step, unless `continueOnError` is set.
|
|
179
|
+
- **`page_diagnostics`** returns errors only by default. Use `level: "all"`, `statusFilter: "all"` or `includeStatic` for more, and `reqId` with `part` to read one request.
|
|
180
|
+
- **`network_session`** presets are `turbo`, `no-images`, `no-media` and `clean` (unblock everything), plus custom `blockResources` and `blockUrls`. It reads, writes and clears cookies and web storage, and saves or loads a Playwright `storageState` file.
|
|
181
|
+
|
|
182
|
+
## Benchmarks
|
|
183
|
+
|
|
184
|
+
### Per-tool measurements (`npm run benchmark`)
|
|
185
|
+
|
|
186
|
+
These come from [`benchmarks/benchmark.mjs`](benchmarks/benchmark.mjs) on local fixture pages in headless Chromium. Tokens are counted with `tiktoken` (`o200k_base`); if Python and `tiktoken` are missing, the script falls back to an approximate count and prints that. The figures measure the size of tool output and the time spent in the browser. Model time is not included, so read them as an upper bound on what an agent gains, not as an agent result.
|
|
187
|
+
|
|
188
|
+
"Cumulative" tokens model a chat agent that re-reads every earlier tool result on each turn: over N turns, the output of turn i is read N − i + 1 times. Each call saved is also one model round trip.
|
|
189
|
+
|
|
190
|
+
Timings change from run to run. Character counts, turn counts and token counts do not.
|
|
191
|
+
|
|
192
|
+
| Scenario | Step-by-step baseline | `turbo-browser-mcp` | Saved |
|
|
193
|
+
| :--- | :--- | :--- | :--- |
|
|
194
|
+
| 140-button console snapshot (`inspect_compact`) | 61,010 chars HTML (18,654 tok); 12,771 chars full ARIA (3,568 tok) | 3,968 chars (1,135 tok) | 68.2% vs ARIA, 93.9% vs HTML |
|
|
195
|
+
| Snapshot after a click (`onlyChanged`) | 12,825 chars full ARIA (3,582 tok) | 168 chars (56 tok) | 98.4% vs ARIA |
|
|
196
|
+
| Article to Markdown (`extract_clean_text`) | 10,844 chars HTML (3,595 tok) | 641 chars (156 tok) | 95.7% |
|
|
197
|
+
| Diagnostics, 32 requests and 26 console lines | 9,651 chars (3,460 tok, `all`) | 1,761 chars (601 tok, `errors`) | 82.6% |
|
|
198
|
+
| 10-field form and check (`smart_fill_form`) | 11 turns, 12,197 tok direct, 72,614 cumulative | 1 turn, 811 tok | 93.4% direct, 98.9% cumulative; 574 ms vs 82 ms |
|
|
199
|
+
| 48 KiB PDF upload via `file` | 65,679 chars (44,728 tok) as Base64 | 263 chars (85 tok) disk path | 99.8% |
|
|
200
|
+
| 6-step UI flow (`batch_actions`) | 6 turns, 955 tok direct, 3,162 cumulative | 1 turn, 406 tok | 57.5% direct, 87.2% cumulative |
|
|
201
|
+
| Open 6 tabs (`open_many`, 60 ms simulated TTFB) | 6 turns, 998 ms | 1 turn, 420 ms | 5 turns fewer |
|
|
202
|
+
| Page with 8 images and a font | 9 media requests (304 KiB), 252 ms | 0 media requests with the `turbo` preset, 165 ms | all media bytes |
|
|
203
|
+
|
|
204
|
+
The table is one run. On the 6-step flow, batching was about as fast as separate calls in that run (357 ms vs 411 ms) and slower in two later runs (0.43x and 0.49x speed). Its gain is in turns and tokens, not wall time.
|
|
205
|
+
|
|
206
|
+
### Tool schema size
|
|
207
|
+
|
|
208
|
+
The tool definitions are sent to the model on every turn. `npm run benchmark` prints the size of the current schema (all 11 tools, full and compact) and of the `--tools core` set, plus the server instructions. The figures move with each change to a tool description, so they are not copied here. Run it before and after a schema change; [CONTRIBUTING.md](CONTRIBUTING.md) asks for that in pull requests. `expect`, `submissionKey` and `allowDuplicate` are declared only on `batch_actions`, and the network guard is turned on by environment variable, to keep the schema small.
|
|
209
|
+
|
|
210
|
+
### Scripted end-to-end task (`npm run benchmark:e2e`)
|
|
211
|
+
|
|
212
|
+
[`benchmarks/E2E_COMPARISON.md`](benchmarks/E2E_COMPARISON.md) runs a fixed script against a Korean-language contest wizard (6 fields, a `다음` step, a `확인` inside a modal, a receipt page). One action per call with a full ARIA snapshot after each takes 9 calls and 32,942 cumulative context tokens. `inspect_compact` plus one `batch_actions` call with `expect` takes 2 calls and 1,430 tokens, and confirms the receipt number itself. The same file covers the commit-safety cases.
|
|
213
|
+
|
|
214
|
+
### Agent benchmark against other browser stacks (stage 1)
|
|
215
|
+
|
|
216
|
+
[`benchmarks/e2e-agent/`](benchmarks/e2e-agent/) gives a coding agent three tasks on local fixture sites (a job application with a file upload, a catalog search over several pages, a booking with a draft step and a confirmation) and runs it with each stack. The fixture server decides success: one committed record with the right fields and file bytes, and a receipt in the answer that matches it. Host agent: Claude Code with Claude Sonnet 5.5, one trial per cell, 16 Nov 2026.
|
|
217
|
+
|
|
218
|
+
| Stack | Tasks passed | Turns | Cost (USD) | Seconds |
|
|
219
|
+
| --- | :---: | ---: | ---: | ---: |
|
|
220
|
+
| turbo-browser-mcp 0.6.1 (headless) | 3/3 | 42 | 0.395 | 85.8 |
|
|
221
|
+
| agent-browser 0.43.0 (headless) | 3/3 | 33 | 0.440 | 196.8 |
|
|
222
|
+
| browse 0.0.17 (headed Chrome, extension) | 3/3 | 20 | 0.237 | 118.6 |
|
|
223
|
+
| browser-use 1.0.5 (headed Chrome) | 3/3 | 33 | 0.344 | 120.6 |
|
|
224
|
+
|
|
225
|
+
Every stack passed every task. turbo-browser-mcp had the lowest total time and browse the lowest cost. One trial per cell cannot rank them, and headless and headed browsers are not equally fast. The application task took turbo-browser-mcp 23 turns, the most of any trial. The transcript showed why: the agent filled each field with a separate `act_fast` call, and `smart_fill_form` could not pick an option that sat behind the list's own search box.
|
|
226
|
+
|
|
227
|
+
The unreleased `main` branch steers the agent to `smart_fill_form` and was run once more with the same harness: 23 turns, 0.256 USD and 61.6 s in total, down from 42 turns, 0.395 USD and 85.8 s. Still one trial per cell, and the other stacks were not run again. The search-box fix for `smart_fill_form` landed after that run and has not been measured yet. Per-task numbers, how tokens are counted, and the harness fixes made during the run are in [`benchmarks/E2E_RESULTS.md`](benchmarks/E2E_RESULTS.md).
|
|
228
|
+
|
|
229
|
+
When to keep `chrome-devtools-mcp` as well: it offers Lighthouse audits, performance traces and heap snapshots, which turbo-browser-mcp does not.
|
|
230
|
+
|
|
231
|
+
## Safety
|
|
232
|
+
|
|
233
|
+
### Submit guard and file path limits
|
|
234
|
+
|
|
235
|
+
1. Submit guard (`allowSubmit=false` by default). `smart_fill_form` (with `stopBeforeSubmit: true`), `act_fast` and `batch_actions` check the target element's role and label, Enter in a form, key chords such as `Shift+Enter`, calls to `form.submit()` and `requestSubmit()`, and the same calls made through a same-origin iframe. Final actions that look like `Submit`, `Publish`, `Send`, `Post`, `Apply`, `Confirm` or a payment trigger are blocked unless `allowSubmit: true` is passed or `--allow-submit` is set at startup. Closed Shadow roots that were attached before the server's init script ran (for example on a tab that was already open over CDP) and strict cross-origin sandboxed frames cannot be inspected this way. Actions there fall back to frame handles, coordinates and keyboard input.
|
|
236
|
+
2. Path confinement (`TURBO_BROWSER_SAVE_ROOT`). `savePath`, `saveStorageStatePath` and `loadStorageStatePath` work only inside the working directory or `TURBO_BROWSER_SAVE_ROOT`. The check rejects `..` traversal, UNC paths, and symlink and junction tricks before reading or writing.
|
|
237
|
+
|
|
238
|
+
### Commit checks: `expect`, `submissionKey`, modal and network guards
|
|
239
|
+
|
|
240
|
+
A label-based guard has three gaps, and each has an opt-in answer. `expect`, `submissionKey` and `allowDuplicate` appear in the `batch_actions` schema; `act_fast` accepts them without advertising them. The network guard is turned on with `TURBO_BROWSER_NETWORK_GUARD=true` and covers `act_fast`, `batch_actions` and `smart_fill_form`.
|
|
241
|
+
|
|
242
|
+
1. A click that landed is not a confirmed submission: use `expect`. After an allowed submit, pass `expect: { urlMatches?, textMatches?, textNew?, selector?, timeoutMs? }`. `textMatches` also matches text that was already on the page before the click, so prefer `textNew` for verifying a submit: it counts only elements whose text matches and did not match when the batch started. The result carries `submitVerified` and `evidence` (the new URL, a text snippet such as a receipt number, or the matched selector). If nothing shows up in time you get `submitVerified: false` and a reason, so the agent does not report "done" on an empty submission list.
|
|
243
|
+
2. A re-run is a second entry, not a retry: use `submissionKey`. With `submissionKey: "portal:2026-11-15:entry-42"`, every allowed submit is appended to a JSONL ledger (`~/.turbo-browser-mcp/submissions.jsonl`, or `TURBO_BROWSER_LEDGER`, or `ledgerPath` inside the save root). A later call with the same key is refused with `blockedBy: "ledger"` unless `allowDuplicate: true`.
|
|
244
|
+
3. Labels can be wrong. On many Korean portals the last step reads 다음 and the real commit is a 확인 inside a modal that opens afterwards.
|
|
245
|
+
- Affirmative buttons (`확인`, `OK`, `Yes`, `Confirm`, `確認`, `确定`, `Đồng ý` and others) inside `dialog`, `[role=dialog]`, `[role=alertdialog]` or `[aria-modal=true]` count as commits (`blockedBy: "modal"`). Cookie banners (dialog text mentions cookies) and date or time pickers (the dialog contains a calendar grid or date input) are excluded. A confirmation that only mentions "privacy" or "consent" is still blocked.
|
|
246
|
+
- When an action makes the page call `form.submit()` or `requestSubmit()`, or fire a `submit` event, and the guard stops it, the result says so (`submitSuppressed`, `note`) instead of a bare `ok: true`. The action itself (a select, a check) still counts as done, so batches continue.
|
|
247
|
+
- Common Korean, Japanese, Chinese and Vietnamese submit labels are covered (`제출`, `신청`, `등록`, `결제`, `送信`, `確定`, `提交`, `Hoàn tất` and others), and `다음`, `次へ` and `下一步` are treated like `Next`.
|
|
248
|
+
- `TURBO_BROWSER_NETWORK_GUARD=true` does not depend on labels. While submitting is not allowed, non-GET navigations and same-site `fetch`/XHR `POST`, `PUT`, `PATCH` and `DELETE` are stopped and reported (`blockedBy: "network"`, `networkBlocked[]`). A blocked navigation gets a `204`, so the page and the half-filled form stay put. Let harmless endpoints through with `TURBO_BROWSER_NETWORK_GUARD_ALLOW="/autosave$,/analytics"`. Per call, the undeclared arguments `networkGuard`, `networkGuardAllow` and `networkGuardSettleMs` override the environment values. It is off by default because multi-step wizards often `POST` on every "Next".
|
|
249
|
+
|
|
250
|
+
Every blocked result says which mechanism stopped it: `blockedBy` is `label`, `modal`, `network` or `ledger`.
|
|
251
|
+
|
|
252
|
+
Limits:
|
|
253
|
+
|
|
254
|
+
- The network guard watches the action plus `networkGuardSettleMs` (250 ms) afterwards, so a commit fired later by a timer is not caught. WebSocket messages, service-worker requests and cross-site `fetch` POSTs are not inspected (cross-site navigations are). Patterns in `TURBO_BROWSER_NETWORK_GUARD_ALLOW` are split on commas, so a pattern cannot contain one.
|
|
255
|
+
- The ledger is written only when the call returns. If the call throws after the page already sent the submission (for example a navigation timeout), nothing is recorded. Check the site before re-running.
|
|
256
|
+
- An `expect.selector` that is not a valid selector never matches, so the call reports `submitVerified: false` after the timeout.
|
|
257
|
+
|
|
258
|
+
### Restricting navigation
|
|
259
|
+
|
|
260
|
+
By default the server can open any URL. To limit where the browser may go, set `TURBO_BROWSER_ALLOW_HOSTS` (or `--allow-hosts a.com,b.com`; the flag wins over the variable). Each entry matches that host and its subdomains, case-insensitively, and `*.example.com` means the same as `example.com`. Spaces and empty entries are ignored. `TURBO_BROWSER_ALLOW_ORIGINS` (or `--allow-origins`) takes exact origins such as `http://localhost:3000`. When both are set, a URL must pass both. With neither set (or only empty entries) nothing changes: no listeners, no request interception and no extra fields in any result.
|
|
261
|
+
|
|
262
|
+
What is enforced:
|
|
263
|
+
|
|
264
|
+
- Every URL you pass in (`tabs_batch` `open`, `open_many` and `navigate`, and `navigate` steps in `batch_actions`) is checked before it loads. A denied URL is not requested and that operation fails with `host not allowed: evil.com (TURBO_BROWSER_ALLOW_HOSTS)`. In `open_many` only the denied URL fails.
|
|
265
|
+
- Main-frame navigations that no URL input started (link clicks, form submits, script redirects, server redirects, including every hop of a redirect chain) are stopped when they target a disallowed host. The server uses CDP `Fetch` limited to document requests, so the cost is one round trip per document request. The page stays where it was, and the next result for that tab carries `"blocked":"host-not-allowed"` once, with the denied address in `url` (`tabs_batch` results) or `blockedUrl` (other tools). If that result already has a boolean `blocked` from the submit guard, it gets `navBlocked` instead.
|
|
266
|
+
- `about:blank`, `data:`, `blob:` and `chrome-error:` are always allowed. `file:` is blocked while a policy is set, as is any scheme other than http and https.
|
|
267
|
+
|
|
268
|
+
What is not enforced by default: images, scripts, stylesheets, fetch, XHR, WebSocket and other sub-resources load from any host, and iframes are not restricted. This is a navigation allowlist, not a data-exfiltration barrier. Set `TURBO_BROWSER_ALLOW_STRICT=1` (or `--allow-strict`) to also abort sub-resource and iframe requests to disallowed hosts and to wrap `WebSocket`, `EventSource` and `navigator.sendBeacon` in the page. Strict mode is still best effort: page script can restore the original constructors, a document that was already loaded when the guard attached is not wrapped until its next navigation, WebRTC and requests made by service workers or other workers are not covered, and the first request of a popup can start before the guard attaches.
|
|
269
|
+
|
|
270
|
+
Scope: the guard is installed only on tabs the server opens or acts on. In CDP mode attached to your own Chrome, other tabs are never touched, but a tab you point a tool at (by `tabId`, or the active tab) is guarded from that point on. Treat the setting as a guard rail for an agent, not as a security boundary.
|
|
271
|
+
|
|
272
|
+
### Handing a step to a person (`wait_for_human`, `--open-profile`)
|
|
273
|
+
|
|
274
|
+
Some sites fail their bot check whenever the browser is remote-controlled, so a person has to open the same profile in a normal browser first. turbo-browser-mcp does not try to hide automation: no stealth plugins, no fingerprint or `navigator.webdriver` patching, no CAPTCHA solving. It supports two hand-off flows.
|
|
275
|
+
|
|
276
|
+
1. Before the session: `turbo-browser-mcp --open-profile --url https://site.example/login` opens plain Chrome (no debugging port, no automation flags) on the dedicated profile `~/.turbo-browser-mcp/chrome-profile` (or `--user-data-dir`). The person logs in or passes the check and closes the window. Then start the server with `--user-data-dir <same path>` or `--launch-chrome`, and the agent reuses those cookies. This works for sites that check at login. A site that re-checks on every request will still see an automated browser.
|
|
277
|
+
2. During the session: the agent calls `wait_for_human` with a message and a condition (`urlMatches`, `selector`, `textMatches` or `textGone`). The tool brings the tab to the front and polls until the condition holds, then the agent continues in the same tab with the same cookies. Keep `timeoutMs` below your MCP client's request timeout and call it again to keep waiting.
|
|
278
|
+
|
|
340
279
|
```json
|
|
341
280
|
{
|
|
342
|
-
"
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
281
|
+
"name": "wait_for_human",
|
|
282
|
+
"arguments": {
|
|
283
|
+
"message": "Please sign in and finish the security check, then leave the tab open.",
|
|
284
|
+
"selector": "#account-menu",
|
|
285
|
+
"timeoutMs": 120000
|
|
347
286
|
}
|
|
348
287
|
}
|
|
349
288
|
```
|
|
350
289
|
|
|
351
|
-
|
|
290
|
+
## Click aftermath reporting
|
|
291
|
+
|
|
292
|
+
Set `observeAftermath: true` on `act_fast` or `batch_actions` (or `TURBO_BROWSER_OBSERVE_AFTERMATH=true`) to watch for navigation and mutating fetch/XHR requests after each click: at least 400 ms, longer while the page is still active, at most 800 ms. It is off by default.
|
|
293
|
+
|
|
294
|
+
The result includes `aftermath: { beforeUrl, afterUrl, navigated, mutatingRequests, unexpectedSubmit }`. Each request lists its method, URL and a `finalSubmit` classification. A main-frame origin or path change, or a commit-like request, produces a warning when `allowSubmit` is false.
|
|
352
295
|
|
|
353
|
-
|
|
296
|
+
This reports an action that has already happened. It cannot prevent a commit or prove that a submission succeeded. Wizard navigation can trigger a warning, and opaque endpoints or requests outside the window can be missed. Use the network guard to prevent and `expect` to verify. Fixture and classification details are in [test/COMMUNITY_FIXTURES.md](test/COMMUNITY_FIXTURES.md).
|
|
354
297
|
|
|
355
|
-
|
|
298
|
+
## CLI options and environment variables
|
|
299
|
+
|
|
300
|
+
| CLI flag | Environment variable | Default | Description |
|
|
356
301
|
| :--- | :--- | :--- | :--- |
|
|
357
|
-
| `--mode <auto\|cdp\|persistent\|launch>` | `TURBO_BROWSER_MODE` | `auto` | Connection strategy (`cdp` first then launch in `auto`) |
|
|
302
|
+
| `--mode <auto\|cdp\|persistent\|launch>` | `TURBO_BROWSER_MODE` | `auto` | Connection strategy (`cdp` first, then launch, in `auto`) |
|
|
358
303
|
| `--cdp <url>` | `TURBO_BROWSER_CDP_URL` | `http://127.0.0.1:9222` | Chrome DevTools Protocol HTTP endpoint |
|
|
359
|
-
| `--user-data-dir <path>` | `TURBO_BROWSER_USER_DATA_DIR` | `""` | Persistent profile directory
|
|
360
|
-
| `--executable <path>` | - | auto-detected | Custom Chromium, Chrome, Edge
|
|
361
|
-
| `--timeout <ms>` | `TURBO_BROWSER_TIMEOUT_MS` | `15000` | Default Playwright action
|
|
362
|
-
| `--
|
|
363
|
-
| `--
|
|
364
|
-
| `--
|
|
365
|
-
| `--
|
|
366
|
-
| `--
|
|
367
|
-
| `--
|
|
304
|
+
| `--user-data-dir <path>` | `TURBO_BROWSER_USER_DATA_DIR` | `""` | Persistent profile directory |
|
|
305
|
+
| `--executable <path>` | - | auto-detected | Custom Chromium, Chrome, Edge or Brave executable |
|
|
306
|
+
| `--timeout <ms>` | `TURBO_BROWSER_TIMEOUT_MS` | `15000` | Default Playwright action and navigation timeout |
|
|
307
|
+
| `--tools <all\|core>` | `TURBO_BROWSER_TOOLS` | `all` | `core` lists only `tabs_batch`, `inspect_compact`, `smart_fill_form`, `act_fast`, `batch_actions`, `extract_clean_text` |
|
|
308
|
+
| `--headless` / `--headed` | `TURBO_BROWSER_HEADLESS` | `true` (headless) | Headless or visible browser window (`"false"` for headed) |
|
|
309
|
+
| `--allow-submit` | - | `false` | Turn off the default Submit/Publish guard |
|
|
310
|
+
| `--allow-hosts <a,b>` | `TURBO_BROWSER_ALLOW_HOSTS` | unset | Only navigate to these hosts and their subdomains (see [Restricting navigation](#restricting-navigation)) |
|
|
311
|
+
| `--allow-origins <o,o>` | `TURBO_BROWSER_ALLOW_ORIGINS` | unset | Only navigate to these exact origins; combined with the hosts list when both are set |
|
|
312
|
+
| `--allow-strict` | `TURBO_BROWSER_ALLOW_STRICT` | `false` | With an allowlist, also block sub-resource requests to other hosts |
|
|
313
|
+
| `--secrets <file>` | `TURBO_BROWSER_SECRETS_FILE` | unset | dotenv file of secrets for `$secret:NAME` placeholders (see [Secrets](#secrets)) |
|
|
314
|
+
| `--content-boundaries` | `TURBO_BROWSER_CONTENT_BOUNDARIES` | `false` | Wrap page-sourced text in `<<page:nonce>>` markers (see [Content boundaries](#content-boundaries)) |
|
|
315
|
+
| `--print-skill` | - | - | Print the bundled `SKILL.md` for this version |
|
|
316
|
+
| `--doctor` | - | - | Print Node, Playwright, Chromium and CDP diagnostics as JSON |
|
|
317
|
+
| `--bridge` | `TURBO_BROWSER_BRIDGE_PORT` | `9224` | Start or verify the CDP keep-alive bridge for Chrome 144+ `DevToolsActivePort` (see below) |
|
|
318
|
+
| `--launch-chrome` | - | `~/.turbo-browser-mcp/chrome-profile` | Launch Chrome with a dedicated profile and `--remote-debugging-port=9222` |
|
|
319
|
+
| `--open-profile [--url <u>]` | `TURBO_BROWSER_OPEN_URL` | `~/.turbo-browser-mcp/chrome-profile` | Open the profile in a normal, non-automated Chrome so a person can log in or pass a check first |
|
|
368
320
|
| - | `TURBO_BROWSER_NETWORK_GUARD` | `false` | Turn on the network commit guard by default |
|
|
369
321
|
| - | `TURBO_BROWSER_NETWORK_GUARD_ALLOW` | `""` | Comma-separated URL regexes the network guard lets through |
|
|
322
|
+
| - | `TURBO_BROWSER_OBSERVE_AFTERMATH` | `false` | Report navigation and mutating requests after each click (see [Click aftermath](#click-aftermath-reporting)) |
|
|
370
323
|
| - | `TURBO_BROWSER_LEDGER` | `~/.turbo-browser-mcp/submissions.jsonl` | Submission ledger used by `submissionKey` |
|
|
371
|
-
| `--version` / `-v` | - | - | Print server version
|
|
372
|
-
| `--help` / `-h` | - | - | Print CLI usage
|
|
373
|
-
| - | `TURBO_BROWSER_SAVE_ROOT` | `process.cwd()` | Root directory
|
|
324
|
+
| `--version` / `-v` | - | - | Print the server version |
|
|
325
|
+
| `--help` / `-h` | - | - | Print CLI usage |
|
|
326
|
+
| - | `TURBO_BROWSER_SAVE_ROOT` | `process.cwd()` | Root directory for `savePath` and `storageState` files |
|
|
374
327
|
| - | `PLAYWRIGHT_CORE_PATH` | auto-resolved | Explicit path to `playwright-core/index.mjs` |
|
|
375
328
|
|
|
376
|
-
### Unattended
|
|
329
|
+
### Unattended runs and the Chrome 144+ remote-debugging prompt
|
|
330
|
+
|
|
331
|
+
In Chrome 136+/144+, enabling `chrome://inspect/#remote-debugging` on the default `User Data` directory makes Chrome show an "Allow remote debugging?" prompt each time a new WebSocket client connects. That stops overnight or multi-agent runs. Two ways around it:
|
|
332
|
+
|
|
333
|
+
1. `--bridge` (or `npm run bridge`, started automatically when Chrome exposes `DevToolsActivePort`) starts a background process (`src/cdp-bridge.mjs`, `http://127.0.0.1:9224`) that keeps one WebSocket to Chrome open and ignores `Browser.close`. You click Allow once. After that, any number of MCP servers, scripts or subagents can connect and disconnect without another prompt. The bridge keeps a single upstream connection (so the prompt appears once) and gives every connected client its own CDP sessions, so two MCP servers can drive the same Chrome at the same time. Each client sees the same tabs, but its events and one-time page setup are independent.
|
|
334
|
+
2. `--launch-chrome` (or `npm run launch-chrome`) starts Chrome with `--remote-debugging-port=9222` and its own `--user-data-dir` (`~/.turbo-browser-mcp/chrome-profile`). That port needs no confirmation dialog, even on the first connection.
|
|
335
|
+
|
|
336
|
+
## Secrets
|
|
337
|
+
|
|
338
|
+
Set `--secrets <file>` (or `TURBO_BROWSER_SECRETS_FILE`) to a dotenv-format file: `KEY=value` lines, `#` comments, optional single or double quotes. The server reads the file itself and never logs or returns its values.
|
|
377
339
|
|
|
378
|
-
In
|
|
340
|
+
In `smart_fill_form` field values, in `act_fast` `fill` and `type` values, and in `batch_actions` steps, a value that is exactly `$secret:NAME` is replaced by the value of `NAME` at the moment of typing. Anything else is typed as written. An unknown name fails with `Unknown secret: NAME` before anything is typed. Without a secrets file, `$secret:NAME` is typed literally and nothing changes.
|
|
379
341
|
|
|
380
|
-
|
|
381
|
-
- Spawns a detached background multiplexer (`src/cdp-bridge.mjs` on `http://127.0.0.1:9224`) that holds **one persistent upstream WebSocket** to Chrome open indefinitely and intercepts `Browser.close` so downstream scripts never terminate your browser.
|
|
382
|
-
- You click **Allow** once when starting your session; afterwards, any number of MCP servers, CLI scripts, or subagents can connect and disconnect all night with **0 additional prompts**.
|
|
383
|
-
2. **Zero-Prompt Dedicated Profile Launcher (`npm run launch-chrome` / `--launch-chrome`)**:
|
|
384
|
-
- Launches Chrome with `--remote-debugging-port=9222` and a dedicated `--user-data-dir` (`~/.turbo-browser-mcp/chrome-profile`), where Chrome exposes standard HTTP/WS CDP with **0 confirmation dialogs even on the very first connection**.
|
|
342
|
+
Every tool result, every error and every file written through `savePath` has the real value replaced by its placeholder, in raw, JSON-escaped and URL-encoded form. That includes `inspect_compact` input values, `extract_clean_text`, `evaluate_js` results and `page_diagnostics`. Values shorter than 4 characters are not redacted, because that would damage ordinary output. Limits: a page that rewrites or encodes the value (a mask, base64, a hash) produces text the server cannot match, and screenshots are not redacted. The Submit guard is unchanged.
|
|
385
343
|
|
|
386
|
-
|
|
344
|
+
## Content boundaries
|
|
387
345
|
|
|
388
|
-
|
|
346
|
+
Pages can contain text written to look like instructions. With `--content-boundaries` (or `TURBO_BROWSER_CONTENT_BOUNDARIES=1`), page-sourced text is wrapped as `<<page:3f9a1c>> ... <</page:3f9a1c>>`, with a random nonce chosen per server process. This applies to `extract_clean_text`, `inspect_compact` (all modes, one pair per result), `evaluate_js` results, `extract` and `collect` steps in `batch_actions`, and `returnSnapshot` text. Marker-shaped text inside a page is altered so it cannot close the block early. The server instructions gain one sentence naming the markers. The option is off by default and changes nothing when off. On a typical result the markers add about 21 tokens (measured with tiktoken `o200k_base`), plus 39 tokens once in the server instructions. `collect` adds that cost per item.
|
|
347
|
+
|
|
348
|
+
## Skill for Claude Code
|
|
349
|
+
|
|
350
|
+
The package ships a short Agent Skill, `skills/turbo-browser/SKILL.md`, that teaches the low-token loop (one `inspect_compact`, then `onlyChanged`; whole forms with one `smart_fill_form`; chained steps; `textNew` to verify a submit). To install it for Claude Code, copy the file into `~/.claude/skills/turbo-browser/`, or run:
|
|
389
351
|
|
|
390
352
|
```bash
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
npm run bridge # Start/verify persistent CDP Keep-Alive Bridge daemon
|
|
394
|
-
npm run benchmark # Local Chromium speed & exact o200k_base token benchmark
|
|
395
|
-
npm run benchmark:e2e # End-to-end wizard task + commit-safety cases (see benchmarks/E2E_COMPARISON.md)
|
|
353
|
+
mkdir -p ~/.claude/skills/turbo-browser
|
|
354
|
+
npx -y turbo-browser-mcp --print-skill > ~/.claude/skills/turbo-browser/SKILL.md
|
|
396
355
|
```
|
|
397
356
|
|
|
398
|
-
|
|
357
|
+
`--print-skill` prints the file that matches the installed version.
|
|
399
358
|
|
|
400
|
-
##
|
|
359
|
+
## Development
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
npm test # tests in test/*.test.mjs
|
|
363
|
+
npm run doctor # Node, Playwright, Chromium and CDP check
|
|
364
|
+
npm run benchmark # per-tool token and timing benchmark
|
|
365
|
+
npm run benchmark:e2e # scripted wizard task and commit-safety cases
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
CI runs the tests on Ubuntu with Node 20 and 22.
|
|
369
|
+
|
|
370
|
+
## Known limits
|
|
371
|
+
|
|
372
|
+
- Portaled comboboxes (react-select, Radix, Headless UI style) have a click path and a keyboard fallback that searches up to 100 options and checks the committed value. Virtualized lists beyond the included fixtures still need testing against real apps.
|
|
373
|
+
- Sites with bot detection may need `wait_for_human` and a person to pass the check in the same browser. The server does not bypass those checks.
|
|
374
|
+
- The agent benchmark has one trial per stack and task so far. The ten-trial protocol in `benchmarks/E2E_PLAN.md` has not been run.
|
|
375
|
+
- The settle step ends as soon as the page is quiet. A request a script fires later than that (for example a timer of several hundred milliseconds) falls outside the click aftermath window of 400 to 800 ms. A page that keeps mutating the DOM (a spinner or ticker) makes the step run to its 800 ms cap.
|
|
376
|
+
- The network guard and click aftermath only watch a short window after each action, and do not inspect WebSocket messages or service-worker requests. Details are under [commit checks](#commit-checks-expect-submissionkey-modal-and-network-guards).
|
|
377
|
+
- Closed Shadow roots that existed before the server attached to a tab cannot be reached. Actions there fall back to frame handles, coordinates and keyboard input.
|
|
378
|
+
|
|
379
|
+
## Credits
|
|
401
380
|
|
|
402
|
-
|
|
403
|
-
`TURBO_BROWSER_OBSERVE_AFTERMATH=true`) to observe navigation and mutating
|
|
404
|
-
fetch/XHR requests for one second after each click. It is off by default.
|
|
405
|
-
The result includes `aftermath: { beforeUrl, afterUrl, navigated,
|
|
406
|
-
mutatingRequests, unexpectedSubmit }`. Requests include their method, URL,
|
|
407
|
-
and a `finalSubmit` classification. Main-frame origin/path changes or
|
|
408
|
-
commit-like requests produce a warning when `allowSubmit` is false.
|
|
409
|
-
|
|
410
|
-
This reports an action that has already occurred. It cannot prevent a commit
|
|
411
|
-
or prove that a submission succeeded. Wizard navigation can trigger a warning,
|
|
412
|
-
and opaque endpoints or requests outside the observation window can be missed.
|
|
413
|
-
Use the network guard for prevention and `expect` for receipt verification.
|
|
414
|
-
See [fixture and classification details](test/COMMUNITY_FIXTURES.md).
|
|
415
|
-
|
|
416
|
-
## Known limits / roadmap
|
|
417
|
-
|
|
418
|
-
- Portaled comboboxes have click and keyboard paths. The keyboard fallback
|
|
419
|
-
searches up to 100 active options and checks the committed value. Virtualized
|
|
420
|
-
selects beyond the included behavioral fixtures still need broader testing
|
|
421
|
-
against real react-select, Radix, and Headless UI applications.
|
|
422
|
-
- Sites with bot detection may require `wait_for_human` and a human to complete
|
|
423
|
-
the check in the same browser session. Automation does not bypass those checks.
|
|
424
|
-
- End-to-end comparisons with other browser stacks are pending. The
|
|
425
|
-
[comparison plan](benchmarks/E2E_PLAN.md) defines three tasks, success checks,
|
|
426
|
-
and model-token, turn, and wall-time measurements. Existing local benchmarks
|
|
427
|
-
do not establish comparative agent performance.
|
|
428
|
-
|
|
429
|
-
Community suggestions: johnnylemonny and alexcodebytes on portaled and
|
|
430
|
-
virtualized selects; eye_java_420f1faa10ae8b86 on keyboard selection and submit
|
|
431
|
-
aftermath; amintacccp on safe submit labels; snake_doc and lukevp on end-to-end
|
|
432
|
-
comparison and abstraction levels; vidarh on human handoff; harrysong138759
|
|
433
|
-
on receipt verification and duplicate submissions.
|
|
381
|
+
Several features came from readers of the Show HN post and the dev.to article: johnnylemonny and alexcodebytes (portaled and virtualized selects), eye_java_420f1faa10ae8b86 (keyboard selection and click aftermath), amintacccp (safe submit labels), snake_doc and lukevp (end-to-end comparison, level of abstraction), vidarh (human hand-off), harrysong138759 (receipt verification and duplicate submissions).
|
|
434
382
|
|
|
435
383
|
## License
|
|
436
384
|
|