Hi HN, I built turbo-browser-mcp (MIT, Node >= 20, playwright-core only) after running multi-step browser agents over MCP and hitting three practical issues: full DOM/accessibility snapshots filling the context window past 90k tokens, 10+ sequential turns per form (plus freezes when agents tried to pass uploaded files as Base64 tool arguments), and occasional accidental clicks on Publish or Submit buttons.
Instead of one MCP call per click or keystroke, it exposes 10 consolidated tools:
- `inspect_compact`: traverses main frame, iframes, and open Shadow DOM (`el.shadowRoot`), stamps `data-tbm-ref` IDs (`f<frameIdx>:e<N>`), caps at `maxChars` (default 4000), and supports `onlyChanged: true` deltas.
- `smart_fill_form`: fills React controlled inputs (native prototype setter + `_valueTracker.setValue`), `contenteditable`, single/multi selects, sliders, ARIA comboboxes, and disk files (`setInputFiles` / `filechooser`) in one turn, with `returnSnapshot: true` to fold the updated DOM into the same response.
- `allowSubmit=false` guard by default across clicks, viewport `{x, y}` clicks (checked via element-at-point), and Enter keys unless `allowSubmit: true` or `--allow-submit` is set.
- `tabs_batch` (`open_many`, `isolatedContext`, `emulate`), `network_session` (`turbo` resource blocking preset, cookies/storageState, route mocks), `page_diagnostics` (console, HTTP filters, downloads), `extract_clean_text`, `evaluate_js`, and `capture_page`.
On the included headless Chromium suite (`npm run benchmark`, exact `tiktoken o200k_base` counts):
- 140-button SaaS toolbar DOM: 18,654 tok HTML (3,568 tok Playwright ARIA) -> 1,135 tok compact (28 ms), or 56 tok on `onlyChanged: true` delta (98.4% smaller than ARIA).
- 10-field complex form + snapshot: 11 sequential turns (574 ms, 12,197 direct / 72,614 cumulative replay tok) -> 1 turn (82 ms, 811 tok, 7x faster, 98.9% cumulative tokens saved).
- 48 KiB PDF upload via disk path vs inline Base64 tool arg: 44,728 tok -> 85 tok (99.8% saved).
- Open 6 tabs (`60 ms` simulated TTFB): 998 ms sequential (6 turns) -> 420 ms parallel `open_many` (1 turn, 2.38x faster); `turbo` media blocker runs 1.53x faster (252 ms -> 165 ms) with 100% media bytes skipped; Markdown article extraction & error-filtered diagnostics save 95.7% and 82.6% tokens respectively.
Attaching via `--mode cdp` reuses an existing Chrome session; `--mode launch` starts a clean Playwright window. Looking for feedback on the 10-tool shape, missing Chrome DevTools diagnostics, and form controls that still trip up programmatic prefill.