Engine README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Engine listing page.

WhittleBrowser

npm CI License: MIT

An open-source engine that lets AI agents use a Chromium browser. Pages are shown to models as compact, ref-stable, diffed text, secrets and hidden prompt injections are kept away from the LLM, and sensitive sites and irreversible actions wait for a person. It runs as an MCP server and as a TypeScript library.

  • packages/engine: the protocol (in-page agent in a CDP isolated world, serializer, differ, privacy filter, detectors), a Playwright/CDP driver and an MCP server (whittlebrowser).
  • The WhittleBrowser desktop browser (per-site AI, X-ray, ghost cursor, built-in chat, Demo Studio) is developed in a separate repository and is not released yet. The engine here works on its own with any MCP client.
  • website: the animated landing page and docs site (pnpm --filter @whittlebrowser/website dev).

npm: @whittlebrowser/engine · Docs: docs/ · Issues: GitHub

See docs/COMPARISON.md for how it compares, docs/PROTOCOL.md for the format, and docs/BENCHMARK.md for the numbers.

Benchmark: WhittleBrowser vs Playwright MCP, browser-use and Stagehand

Same 11 pages (5 test pages + 6 live sites), same Chromium, each tool's own code, o200k tokens, no LLM calls. Full methodology and charts are in docs/BENCHMARK.md.

Bar chart of tokens to look at 11 pages: WhittleBrowser 23.7k, Playwright MCP 342k, browser-use 167k, Stagehand 180k
Playwright MCPbrowser-useStagehandWhittleBrowser
page text, 11 pages300,89829,836 (+ screenshots)172,17613,282
all-in incl. prompts/tool defs/screenshots342,115167,061179,55723,699
WhittleBrowser uses93% fewer86% fewer87% fewer
planted secrets reaching the model7 / 76 / 76 / 70 / 7
hidden prompt injections reaching the model5 / 53 / 54 / 50 / 5

With a real model driving each tool (Claude Haiku and Sonnet through Claude Code, 7 tasks, 3 repetitions each), the saving on whole tasks is smaller and depends on the task: large or re-rendering pages save the most, small pages save little. Every tool finished most tasks; the numbers after the dot are tasks passed.

Bar chart of mean tokens per finished task for Claude Haiku and Sonnet: WhittleBrowser 28.2k and 19.9k, Playwright MCP 53.4k and 28.9k, browser-use 87.4k and 36.0k, Stagehand 27.2k and 25.0k

Regenerate the charts after a new run with pnpm --filter @whittlebrowser/engine bench:charts.

Install

Needs Node 22 or newer, and either Google Chrome or a downloaded Chromium (npx playwright-core install chromium, once). The package is on npm: @whittlebrowser/engine.

Terminal
claude mcp add whittlebrowser -- npx -y @whittlebrowser/engine     # Claude Code
codex mcp add whittlebrowser -- npx -y @whittlebrowser/engine      # Codex

Server flags go after the package name, for example … @whittlebrowser/engine --headless. For Cursor, VS Code, Gemini CLI and other clients, put "command": "npx", "args": ["-y", "@whittlebrowser/engine"] in their MCP config. Claude Desktop needs full paths instead (it does not see a Node installed with nvm); see docs/use-with-ai-tools.md. Optional: npm i -g @whittlebrowser/engine installs the whittlebrowser command, and npx -y @whittlebrowser/engine install-skill installs the Claude skill that teaches a model to use the tools well.

Work on the engine (from source)

bash
git clone https://github.com/vasanth7781/whittlebrowser-engine.git && cd whittlebrowser-engine
pnpm install
pnpm --filter @whittlebrowser/engine build
npx playwright-core install chromium   # once

pnpm test        # engine unit + browser + MCP tests (headless)
pnpm bench       # benchmark (add -- --live --pw-mcp; run packages/engine/bench/compare/setup.sh once for browser-use + Stagehand)

Connect a source checkout to your tools

bash
pnpm connect          # adds the server to Claude Code, and prints the JSON for Cursor, VS Code and other clients
pnpm connect codex    # adds it to Codex instead
pnpm connect desktop  # adds it to Claude Desktop (then quit and reopen the app)
pnpm connect skill    # installs the skill that teaches Claude how to use the tools well; pnpm connect all does everything

That runs claude mcp add whittlebrowser -- node <this checkout>/packages/engine/dist/mcp/cli.js (or codex mcp add …). Any extra arguments go to the server, for example pnpm connect --headless. Setup for each client: docs/use-with-ai-tools.md.

Flags: --headless, --ephemeral, --profile DIR, --channel chrome, --budget N, --allow-site HOST (override auto-pause), --risk confirm|auto|deny, --robots off|warn|enforce, --default-off, --no-identify, --allow-file-urls, --humanize, --host (use a host app's policy, see docs/CONTROL.md), --bot-key FILE --bot-agent URL (Web Bot Auth).

Secrets for type secret:NAME: env WB_SECRET_NAME=… or ~/.whittlebrowser/secrets.json (chmod 600).

Tools

Nine MCP tools with short schemas (the whole list is about 1,000 tokens):

ToolWhat it does
observeCompact view of the page (or one subtree) within a token budget
actOne or more steps (click, type, select, check, hover, press, scroll, upload); returns outcome + diff
navigateURL, search words, back, forward, reload
findSearch the whole page, including off-screen, ranked. role:button pay filters by role; css:SELECTOR counts visible matches and lists their class and attributes
extracttable, list (repeated cards as rows), text (main content as markdown), paged
researchOpen several pages in parallel and return a compact digest of each
tabslist, open, switch, close
screenshotJPEG with sensitive fields blurred (last resort)
waitFor text, for a delay, or hand control to you (CAPTCHA, 2FA)

Full argument reference: docs/PROTOCOL.md.

How it stays cheap

  1. The in-page agent prunes the DOM in one pass: roles, accessible names, states, visibility, refs.
  2. The serializer flattens wrappers, merges inline runs, deduplicates labels, folds repeated siblings, and fits a token budget.
  3. Actions return outcome + diff, not the page. Steps can be batched.
  4. find and extract answer targeted questions without reading the whole page.

How it stays safe

  • Isolated-world agent; hidden and deceptive text dropped; ⚠ on instruction-like text.
  • Sensitive values masked in the page; one scrubbing choke point; reversible tokens; local vault.
  • Per-site AI modes (--default-off, or Off per site when a host app owns the policy), auto-pause on banking, consoles, and card/ID/key pages.
  • Approval for irreversible actions, data-carrying cross-site jumps, and uploads outside a sandbox dir.
  • Honest identity: UA token, Web Bot Auth signatures, robots.txt, CAPTCHA handoff to the human. No fingerprint spoofing and no CAPTCHA solving.

Layout

Code
packages/engine/src/page/agent.ts     in-page agent (isolated world)
packages/engine/src/core/             serializer, diff, privacy, detector, injection, risk, robots, web bot auth
packages/engine/src/driver/           session (observe/act/find/extract/...), policy, launch
packages/engine/src/mcp/              MCP server + CLI
packages/engine/test, bench           tests, fixtures, benchmark
website/                              landing page and docs site (renders docs/*.md)

License

MIT, see LICENSE. Contributions are welcome: see CONTRIBUTING.md. Report security issues privately, see SECURITY.md. The host control protocol that lets an app embed the engine is in docs/CONTROL.md.