Skip to main content

Browser Tools

CI Python 3.13+ License: MIT Code style: ruff

Browser automation, debugging, and anti-detect browsing CLI. Provides:

  • Chrome DevTools MCP wrapper — Snapshot-based page automation via chrome-devtools-mcp
  • Persistent browser sessions — Long-lived Chrome instances with named profiles, daemon-based MCP reuse, and attach-to-running-browser support
  • Frame-aware tools — Iframe/CDP frame tree management, execution context resolution, and storage inspection
  • Interstitial detection — Multi-signal heuristic detection for Cloudflare, DataDome, Akamai, PerimeterX, Imperva, AWS WAF, and other challenge pages
  • Camoufox anti-detect browsing — Fingerprint-injected Firefox-based browsing for bot-protected sites
  • CPU profiling — Direct CDP-based JavaScript CPU profiling with threshold-triggered capture

Quick Start

Installation

# Using uv (recommended)
uv tool install browser-tools

# Or with pip
pip install browser-tools

Usage

# Run the CLI
browser-tools --help

# Navigate then snapshot. Pass --isolated (or --browser-url) so both commands
# reuse the SAME long-lived Chrome; a bare `browser-tools navigate` followed by
# a bare `browser-tools take-snapshot` would each spawn a throwaway browser and
# NOT share page or login state.
browser-tools --isolated navigate --url https://example.com
browser-tools --isolated take-snapshot

There is no --profile CLI flag. Named, login-bearing profiles are selected through a project config file (see Project Configuration) or the use_browser_session / attach_browser MCP tools. --isolated gives a dedicated persistent profile directory that is separate from named profiles.

Development setup

# Clone and install in editable mode
git clone https://github.com/dungle-scrubs/browser-tools.git
cd browser-tools
uv sync

Runtime requirements:

  • Chrome Canary by default (the default channel is canary). Use another installed channel with --channel stable|beta|dev, e.g. --channel stable for regular Google Chrome.
  • Node.js (>=20.19; Node 22+ recommended) for chrome-devtools-mcp
  • Camoufox (camoufox fetch) for anti-detect Firefox workflows

Architecture

browser_tools_session.py     CLI entry point (argparse, command dispatch)
        |
        +-- browser_session.py       Tool-proxy session adapter (tool dispatch,
        |                           camoufox routing, auth-wall promotion)
        +-- chrome_config.py          MCP subprocess command builder
        +-- chrome_utils.py           MCP invocation, formatting, errors
        +-- mcp_response.py           Single owner of MCP response envelopes
        +-- tool_registry.py          Single source of truth for tool routing flags
        +-- persistent_browser.py     Chrome lifecycle: controller, reaper,
        |                           teardown, shared on-disk session layout
        |       +-- browser_state.py     Persisted state dataclasses
        |       +-- page_selection.py    Active-page tracking (restore, refresh, normalize)
        |       +-- mcp_session.py       Short-lived MCP session wrapper
        |       +-- daemon_client.py      Unix socket client
        |       +-- process_utils.py      Chrome process/port utilities
        |       +-- profile_catalog.py    Named-profile catalog & live discovery
        |       +-- session_store.py      Per-project session config & controller factories
        |       +-- mcp_daemon.py         Long-lived MCP daemon (dispatch_tool routes by registry flags)
        |               +-- mcp_broker.py      JSON-RPC-over-stdio request multiplexer
        |               +-- cdp_handler.py     CDP tool implementations
        |               +-- cdp_constants.py   Tuning constants (timeouts, thresholds)
        |               +-- cdp_client.py      CDP WebSocket client
        |               +-- frame_manager.py   Frame tree management
        |               +-- interstitial.py    Challenge detection
        |               +-- screenshot_utils.py Blank-frame detection
        +-- camoufox_session.py     Camoufox anti-detect wrapper
        +-- profiler.py            Standalone CPU profiler

Development

uv sync
uv run ruff check src/ tests/
uv run pytest

Project Configuration

Place a .browser-tools.json in your project root (searched upward from the project working directory):

{
  "preferredSession": {
    "mode": "headed-auth",
    "profile": "dev"
  }
}

This auto-selects a persistent headed browser session using the named profile.

The config is read either as a flat object or wrapped in a preferredSession (or preferred_session) key. Recognized fields:

Field Meaning
mode headless, headed-auth (aliases: headed, auth, auth-headed), or headless-auth
profile Named profile that persists cookies/login across runs
endpoint Existing Chrome remote-debugging endpoint to attach to (loopback)
channel stable, canary (default), beta, or dev
viewport Initial window size, e.g. 1280x720
stealth Inject anti-fingerprinting patches

Keeping login state across calls

Auth/login state lives in a Chrome profile directory and survives only while the same directory is reused. To keep a session logged in:

  • Use a named profile (via the config above or use_browser_session(mode="headed-auth", profile="<name>")). Named profiles persist across restarts and are unaffected by headed↔headless switches, viewport, or which directory you invoke from.
  • The default/isolated sessions are keyed per project and Chrome channel; they are not a stable place to keep a long-lived login.
  • Camoufox persists login state only when you pass a profile to launch_camoufox; without it, every launch starts logged out.

License

MIT — see LICENSE.

Contributing

See CONTRIBUTING.md for development setup and guidelines. All contributors are expected to follow the Code of Conduct.

Security

Found a vulnerability? See SECURITY.md for responsible disclosure.

Metadata

Release files for browser-tools 0.3.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 browser-tools 0.3.0
File Size Uploaded
browser_tools-0.3.0.tar.gz 412.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for browser-tools 0.3.0
File Interpreter ABI Platform
browser_tools-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 758.8 kB

Release files / browser_tools-0.3.0.tar.gz

Download URL browser_tools-0.3.0.tar.gz
Size 412.0 kB
Tags Source
SHA-256 checksum
How to use checksums
24540d60180fd30e0523adab1b0c59e93d5d36fb1ba3cdec617a38683332aebe
BLAKE2b-256 checksum
How to use checksums
ff3e001d34984b3ead549766a08808b8e9d5a10d3121720d55ce0fa0f7167f3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / browser_tools-0.3.0-py3-none-any.whl

Download URL browser_tools-0.3.0-py3-none-any.whl
Size 346.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6abc8e7cb5d090b4e63aed4a66471753dcc69a73cfc578532fa5c1d2b3ebc6b0
BLAKE2b-256 checksum
How to use checksums
f2af8e5a2c0d1a40d0051fe3d6fe44bed88aa924b11d9275560143c48685149e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

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