stealth-browser-mcp
Stealth browser automation for AI coding agents on macOS — an MCP server (stealth-browser) and a transcript-driven audit CLI (stealth-browser-audit).
Why stealth-browser?
Launching a second browser binary alongside an active one on macOS can corrupt shared IPC rendezvous ports, freezing tab creation and IPC in your main browser. stealth-browser avoids this completely:
- CDP First: Attempts to attach to an existing browser session over
http://127.0.0.1:9222(STEALTH_BROWSER_CDP_PORT). - Standalone Stealth Fallback: Falls back to launching a dedicated Patchright stealth Chromium instance (
~/.agent-chromium-profile) with native stealth masking and an isolated profile. - Clean Lifecycle & Idle Watchdog: Automatically shuts down the background Patchright Node driver after 5 minutes of inactivity (
STEALTH_BROWSER_IDLE_TIMEOUT=300) and guarantees immediate subprocess teardown onSIGTERM,SIGHUP, orstdinEOF.
Quickstart
Review the Trust model for security and filesystem boundaries before exposing the server to untrusted prompts.
Prerequisites:
- macOS — the server uses
osascriptfor human handoff and macOS-specific browser paths. - uv — install with
brew install uvor the official installer. uv manages Python and dependencies; no system Python setup is needed. - A first-launch browser download (~195 MB network, ~370 MB on disk) via
stealth-browser --install-browser.
Install the tool and register it with your agent — no clone and no absolute path required:
uv tool install stealthmcp
stealth-browser --install-browser
stealth-browser --doctor
Upgrade or remove later with uv tool upgrade stealthmcp / uv tool uninstall stealthmcp.
If stealth-browser is not found after install, run uv tool update-shell to add uv's tool directory (~/.local/bin) to your PATH. GUI-launched clients that ignore your shell PATH can use the full shim path printed by uv tool dir (for example ~/.local/bin/stealth-browser).
MCP Configuration
The install above provides a stealth-browser command on your PATH. The cleanest setup uses your client's CLI, which writes the config for you:
claude mcp add -s user stealth-browser -- stealth-browser
opencode mcp add --global stealth-browser -- stealth-browser
Or add the following to your agent's config (~/.gemini/config/mcp_config.json, ~/.config/opencode/opencode.jsonc, ~/.claude.json, or .cursor/mcp.json). No username-specific path needed:
{
"mcpServers": {
"stealth-browser": {
"command": "stealth-browser",
"args": []
}
}
}
Other install methods
- No install (try it):
uvx --from stealthmcp stealth-browser --doctor, or run straight from the source without a checkout:uv run https://raw.githubusercontent.com/levontumanyan/stealth-browser-mcp/main/bin/stealth_browser.py --doctor. - pip (in a venv):
python3 -m venv .venv && . .venv/bin/activate && pip install stealthmcp, then the samestealth-browsercommand. Prefer a venv over a globalpip install. - pipx:
pipx install stealthmcp, then the samestealth-browsercommand. - Existing checkout:
uv run --script /absolute/path/to/stealth-browser-mcp/bin/stealth-browserkeeps working unchanged. Add that checkout'sbin/to yourPATHand runstealth-browser --helpfor a local dev setup.
Verification
stealth-browser --doctor checks Python, dependency versions, cheat-sheet creation, and browser/CDP availability, then exits non-zero on failure. Add --smoke to actually launch Chromium and open a tab. stealth-browser --version prints the installed version.
Shared Daemon & CLI
By default, stealth-browser runs a lightweight stdlib stdio proxy that auto-starts and shares a single local daemon over a 0600 Unix Domain Socket (scoped per CDP port and profile). Multiple MCP clients and subagents share one browser instance with per-client tab isolation.
stealth-browser --daemon-status— print running daemon PID, socket/HTTP endpoints, active clients, and uptime.stealth-browser --daemon-stop— stop the running shared daemon cleanly.stealth-browser --serve [--http [HOST:PORT]] [--daemon-idle-exit SECONDS]— run the shared daemon directly;--httpalso enables loopback Streamable HTTP (default127.0.0.1:9223) with mandatory Bearer token auth;--daemon-idle-exitexits after idle seconds with 0 clients (1800default,0disables).stealth-browser --standalone— run an isolated in-process stdio MCP server instead of proxying to the shared daemon.
Available MCP Tools
status: Check connection status and list all open tabs with indices and stable ids.navigate: Navigate the active tab or open a new tab (new_tab=True).get_content/extract: Extract visible text or structured fields frombodyor any CSS/XPath selector.click/type/press_key/scroll: Interact with page elements.screenshot: Capture a viewport screenshot for multimodal agent inspection.evaluate_js: Execute JavaScript in the active page context.switch_tab/new_tab/close_tab: Full multi-tab management (closing the last tab automatically closes the browser).close_browser: Completely close the browser window, terminate the browser process, and release all resources.wait_for_human: Pause for interactive login/2FA/CAPTCHA with a macOS notification naming the tab (the browser never takes focus); pin follow-up calls to the tab's browser-derived id.
Headed in the background by default — the window exists but never steals focus (launched via open -g); use wait_for_human() for interactive login/2FA/CAPTCHA.
Tool Gating (--minimal / --disable-<section>)
Default exposes all 28 tools. To reduce schema context cost or restrict powerful tools per session (including over the shared daemon):
stealth-browser --list-sections— print all sections (core,debug,network,lifecycle), tool counts, and membership.stealth-browser --minimal(orSTEALTH_BROWSER_MINIMAL=1) — expose only the 16coretools (statusandwait_for_humanare always protected in every mode).stealth-browser --disable-debug/--disable-network/--disable-lifecycle(orSTEALTH_BROWSER_DISABLE_SECTIONS=debug,lifecycle) — disable specific sections per session.
Trust model
- Transport & auth: Default mode proxies stdio to a same-user
0600Unix Domain Socket inside a0700runtime directory (STEALTH_BROWSER_RUNTIME_DIR, default~/.cache/stealth-browser). Optional--serve --http [HOST:PORT]binds loopback only, enforces aHostallowlist for DNS rebinding protection, and requires a0600Bearer token (STEALTH_BROWSER_TOKEN_FILE, default~/.config/stealth-browser/daemon.token).--standaloneruns isolated in-process stdio with no socket or HTTP listener. - Security principal: Every connected agent is the security principal and can perform any action the user can perform in the attached browser (including all open tabs when attaching over CDP
127.0.0.1:9222). The shared daemon shares browser state across connected sessions and guards destructive lifecycle calls (close_browser,restart_browser,set_headless) against sibling sessions unlessforce=Trueis passed. - Filesystem boundaries:
fetch(save_path=...)andscreenshot(save_path=...)write to any path writable by the OS user — treat paths originating from web content or untrusted prompts as untrusted. Browser downloads land inSTEALTH_BROWSER_DOWNLOADS_DIR(~/Downloads), the profile lives inSTEALTH_BROWSER_PROFILE_DIR(~/.agent-chromium-profile), and the optional Apple Passwords CRX extension is fetched from Google's CRX endpoint and verified before loading into the profile. - Network & credentials: In-browser
fetchsendscredentials: 'include'with the current origin's cookies andevaluate_jsreads arbitrary page state. Stealth masking reduces automation fingerprinting; it is not anonymity and does not isolate credentials. - Operator config & recovery:
STEALTH_BROWSER_*environment variables and MCP client configs are trusted host input; store secrets in macOS Keychain rather than configs or prompts. Recover from wedged or unwanted state viaclose_browser(force=True),restart_browser(force=True),stealth-browser --daemon-stop, or terminating the detached Chromium process; closing the last open tab withclose_tabalso closes the browser. - Explicit non-claims: No guarantee against bot detection; no proxy or anonymity features; detection depends on site policy, IP reputation, and browser build.
Audit
stealth-browser-audit [--since 14d] [--session <sid-prefix>] [--diff <baseline.json>] [--no-cache]— mine local AGY and OpenCode transcripts for stealth-browser usage, error rates, latency, and workarounds; produces a prioritized improvement plan or before/after scorecard. Installed alongsidestealth-browserbystealthmcpand also runnable directly from a checkout viabin/stealth-browser-audit.
Development
git clone https://github.com/levontumanyan/stealth-browser-mcp.git
cd stealth-browser-mcp
uv sync
uv run pytest tests/ -x
bin/stealth_browser.py is the canonical source; bin/stealth-browser is a symlink that preserves the historical path and PEP 723 uv run --script workflow. Dependencies are declared in both the script's PEP 723 block and pyproject.toml, and a test keeps them in sync.
To publish a new version, see RELEASING.md. Only a v* tag publishes; merging PRs does not.
Agent Skills (skills/)
Reusable agent workflows live in skills/, one directory per skill with a SKILL.md:
stealth-browser-audit— mine local agent transcripts for stealth-browser usage, errors, latency, and workarounds.stealth-browser-subagent— delegate heavy browser flows to an isolated subagent so DOM output stays out of the parent context.stealth-browser-usage— workflow decisions beyond the served cheat-sheet: shared-daemon etiquette, owned tabs, delegation, and when to reach pastsnapshot/extract.
Register the directory with your harness instead of copying files (replace <checkout> with this repo's path):
- OpenCode: add
"<checkout>/skills"to theskillsarray in youropencode.jsonc. - Google Antigravity (
agy): add{ "path": "<checkout>/skills" }to theentriesof~/.gemini/config/skills.json.
Tool signatures and universal rules need no harness registration: the MCP server serves them as instructions and exposes them as the instructions://cheatsheet resource for any client that reads them.
Similar Projects
Other notable browser tools for AI agents, and how stealth-browser-mcp differs (Patchright stealth Chromium, macOS background-headed launch via open -g so it never steals focus, shared UDS daemon with per-client tab ownership, wait_for_human handoff, and transcript-driven auditing):
| Project | Interface | Core Focus |
|---|---|---|
| microsoft/playwright-mcp | MCP | Official Playwright MCP server with structured accessibility snapshots and cross-browser support. |
| microsoft/playwright-cli | CLI + Skill | Token-efficient CLI companion to Playwright MCP that writes YAML snapshots/logs to disk to avoid MCP schema and output bloat. |
| ChromeDevTools/chrome-devtools-mcp | MCP | Official Chrome DevTools MCP server focused on CDP debugging, console/network inspection, and performance profiling. |
| vercel-labs/agent-browser | Rust CLI daemon | Fast CLI-first Chromium automation with compact interactive snapshots (-i/-c), short @eN refs, and zero MCP schema overhead. |
| pinchtab/pinchtab | Go HTTP/CLI daemon | Multi-instance Chrome orchestrator over CDP with stealth injection, persistent profiles, readability /text, and --snap-diff delta snapshots. |
| lightpanda-io/browser | Zig browser / CDP / MCP | Lightweight headless browser built from scratch in Zig (no rendering engine) for fast scraping and Markdown/JSON-LD extraction. |
| browser-use/browser-use | Python/TS agent framework | Autonomous browser-agent loop that delegates whole multi-step web tasks out of the primary coding agent's context. |
| browserbase/stagehand | TypeScript SDK | Semantic Playwright wrapper (act(), extract(), observe()) with self-healing locators for app-level browser automation. |
mcp-name: io.github.levontumanyan/stealth-browser-mcp
Metadata
Release files for stealthmcp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stealthmcp-0.1.2.tar.gz | 226.5 kB | Without provenance | Details for stealthmcp-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stealthmcp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for stealthmcp-0.1.2-py3-none-any.whl |
Total release size: 324.8 kB
Release files / stealthmcp-0.1.2.tar.gz
| Download URL | stealthmcp-0.1.2.tar.gz |
|---|---|
| Size | 226.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2119aec8f0932855ccbbda82509ba4675d77cb5600e524d0337a8d20a61b20d5
|
|
BLAKE2b-256 checksum How to use checksums |
04f7f8633f5f35aad1e361423e4803175944a727ca3dd09a72d250846561c277
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / stealthmcp-0.1.2-py3-none-any.whl
| Download URL | stealthmcp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 98.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
612574ca051f3f286dc164588daa0fd946af838a42c0bbfe393860bf463c5429
|
|
BLAKE2b-256 checksum How to use checksums |
4702995c0849e453eb67bb3960afdc8c6f6fa29cb6eec415fc22b2eccdd16b9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for stealthmcp 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.