stealth-agent-browser-mcp
A Model Context Protocol (MCP) server that gives AI agents a stealth-grade Chromium browser with a hybrid Accessibility-Object-Model + Set-of-Mark vision interface. Built for Claude, works with any MCP-compatible host.
- Stealth first. Uses
rebrowser-playwrightto patch theRuntime.EnableCDP leak that bypassesplaywright-extra-class stealth plugins. Passes modern bot-detection suites (CreepJS, bot.sannysoft.com) where vanilla Playwright fails. - Token-lean by default.
browser_snapshotreturns Playwright aria snapshot YAML (~2ā5 KB) instead of raw HTML (100KB+). Every interactive element carries a[ref=eN]id that actions consume directly ā no selectors, no drift. - Hybrid vision when it matters. Ask for
mode: "hybrid"and the server overlays numbered red boxes on the screenshot so the model can ground visually (Set-of-Mark prompting, Yang et al.). The ref ids on the image match the ids in the YAML. No parallel numbering scheme to go out of sync. - Readability-based content extraction.
browser_scroll_readruns Mozilla Readability through JSDOM and returns clean Markdown ā optionally delta-only, so re-reads cost nothing when nothing changed. - Proxy-ready. Per-session proxy auth, useful with residential pools.
Authorized use only. Stealth tooling has legitimate applications (accessibility auditing, your-own-account automation, QA against sites you own or have permission to test). Do not use this server to violate a site's terms of service or applicable law. See SECURITY.md.
Install
npm install -g stealth-agent-browser-mcp
# Chromium binary is fetched automatically on first launch
npx playwright-core install chromium
Or run without install via npx stealth-agent-browser-mcp.
Quickstart (Claude Desktop / Claude Code / Cursor)
Add to your MCP config:
{
"mcpServers": {
"stealth-browser": {
"command": "npx",
"args": ["-y", "stealth-agent-browser-mcp"],
"env": {
"SAB_HEADLESS": "true",
"SAB_STEALTH_LEVEL": "patched"
}
}
}
}
Restart the host. The agent will see the tools listed below.
Tools
All action tools are addressed by the ref emitted in the last AOM snapshot. Refs are Playwright's own aria-ref=eN ids ā there is no parallel numbering scheme.
Configuration
All via environment variables:
Architecture
src/
āāā index.ts # Entry (stdio)
āāā server.ts # MCP server + tool registration
āāā tools.ts # Tool handlers
āāā browser.ts # Stealth Chromium launcher (rebrowser-playwright)
āāā session.ts # Per-connection browser/context/page state
āāā snapshot.ts # AOM + Set-of-Mark pipeline
āāā annotate.ts # SVG overlay compositing (sharp)
āāā reader.ts # Readability ā Markdown (pierces open shadow roots)
āāā fingerprint.ts # Rotatable UA/viewport/timezone profiles
āāā proxy.ts # Residential pool + rotation + sticky-session template
āāā human-mouse.ts # Bezier-curve cursor paths (ghost-cursor math)
āāā captcha.ts # CapSolver / 2Captcha REST adapters
āāā config.ts # Zod-validated env config
āāā logger.ts # pino ā stderr (never stdout)
All logs go to stderr ā stdout is reserved for JSON-RPC. Never add console.log.
TLS / JA3 fingerprint ā why there is no Node-layer spoofer here
A common ask for scrapers is: "spoof the TLS ClientHello (JA3) to look like Chrome, via curl-impersonate or node-tls-client."
That applies to Node-layer HTTP scrapers (fetch, got, axios) where the TCP connection originates from Node's OpenSSL, which emits a ClientHello signature distinct from Chrome's BoringSSL ā and Cloudflare / Akamai Bot Manager drop it at the network layer before a single byte of JavaScript runs.
This MCP does not have that architecture. Every request exits through Chromium. Chromium's TLS stack is Chrome's TLS stack (literally the same BoringSSL build), so the ClientHello JA3 is Chrome's JA3 by construction. No JS-level rewriting is possible or necessary.
The one place TLS can still betray you is if you route through a proxy that terminates and re-initiates TLS (MITM). Residential proxy providers (Bright Data, DataImpulse, Oxylabs residential, SOAX) route at TCP ā they do not MITM TLS ā and the Chromium handshake reaches the origin unmodified. The products that do MITM TLS are managed scraping browsers (Bright Data's Scraping Browser, Oxylabs Web Unblocker), which ship their own headless Chrome and replace this MCP rather than layering on top of it.
Bottom line: with rebrowser-playwright + residential pool (P1) + human mouse (P2), the TLS fingerprint, CDP runtime, DOM surface, and behavioral layer all match real Chrome. Captcha solving (P3) is a fallback for the 1ā5% of sessions that still get flagged.
Benchmarks
npm run bench:stealth launches the configured browser against public bot-detection test pages (bot.sannysoft.com, CreepJS, pixelscan, BrowserLeaks WebRTC) and reports pass/fail. These are the same harnesses used by the rebrowser-patches and Patchright projects ā see rebrowser-bot-detector for the reference suite.
Typical local-fixture test run (see test/):
Comparison
Development
npm install
npx playwright-core install chromium
npm run build
npm test
Contributing
See CONTRIBUTING.md. All contributions under Apache-2.0.