Skip to main content

stealth-browser-mcp

PyPI License: MIT tests macOS Python 3.11+ uv

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:

  1. CDP First: Attempts to attach to an existing browser session over http://127.0.0.1:9222 (STEALTH_BROWSER_CDP_PORT).
  2. Standalone Stealth Fallback: Falls back to launching a dedicated Patchright stealth Chromium instance (~/.agent-chromium-profile) with native stealth masking and an isolated profile.
  3. 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 on SIGTERM, SIGHUP, or stdin EOF.

Quickstart

Prerequisites:

  • macOS — the server uses osascript for human handoff and macOS-specific browser paths.
  • uv — install with brew install uv or 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.
  • pipx: pipx install stealthmcp, then the same stealth-browser command.
  • Existing checkout: uv run --script /absolute/path/to/stealth-browser-mcp/bin/stealth-browser keeps working unchanged. Add that checkout's bin/ to your PATH and run stealth-browser --help for 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.

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 from body or 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; pin follow-up calls to the tab's stable tN id.

Headless by default; keep it that way and use wait_for_human() for interactive login/2FA/CAPTCHA.

Audit

  • stealth-browser-audit [--since 14d] [--session <sid-prefix>] [--diff <baseline.json>] — mine local AGY and OpenCode transcripts for stealth-browser usage, error rates, latency, and workarounds; produces a prioritized improvement plan or before/after scorecard. The audit CLI lives in the repo checkout (bin/stealth-browser-audit) and is not part of the installed stealthmcp tool.

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.

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.

Register the directory with your harness instead of copying files:

  • OpenCode: add "~/repos/stealth-browser-mcp/skills" to the skills array in your opencode.jsonc.
  • Google Antigravity (agy): add { "path": "~/repos/stealth-browser-mcp/skills" } to the entries of ~/.gemini/config/skills.json.

Metadata

Release files for stealthmcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stealthmcp 0.1.0
File Size Uploaded Provenance Actions
stealthmcp-0.1.0.tar.gz 168.1 kB Without provenance Details for stealthmcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stealthmcp 0.1.0
File Interpreter ABI Platform Actions
stealthmcp-0.1.0-py3-none-any.whl Python 3 none any Details for stealthmcp-0.1.0-py3-none-any.whl

Total release size: 216.2 kB

Release files / stealthmcp-0.1.0.tar.gz

Download URL stealthmcp-0.1.0.tar.gz
Size 168.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3ea8a15ca84d9b9f32e4fc240bffd506542d26157c2e57921b776a9051478394
BLAKE2b-256 checksum
How to use checksums
b71a398dacf868527fce15b862a7e2b1db9e8a0242ba754f1a8e1f426414c4a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","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.0-py3-none-any.whl

Download URL stealthmcp-0.1.0-py3-none-any.whl
Size 48.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d182adf6289cb55a8d33b39fdf48fc64bb4d84c105d6324345e252b2b30101cd
BLAKE2b-256 checksum
How to use checksums
73e4289229d71df2bfab467eb344d85f09ed50179352c8470f1b0c558f4e0d78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","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.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page