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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browser_tools-0.2.0.tar.gz (384.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browser_tools-0.2.0-py3-none-any.whl (333.9 kB view details)

Uploaded Python 3

File details

Details for the file browser_tools-0.2.0.tar.gz.

File metadata

  • Download URL: browser_tools-0.2.0.tar.gz
  • Upload date:
  • Size: 384.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

File hashes

Hashes for browser_tools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 76b91035603ca63728696671dfc82de4b487d6349717c5eae26480178f350520
MD5 38e40bcfb3c0b34c008867218e0f6632
BLAKE2b-256 eb6a2cf3456bc9355ac389f84124f576a7f6e0ac83fca247ffc3f132f2d6576b

See more details on using hashes here.

File details

Details for the file browser_tools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: browser_tools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 333.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

File hashes

Hashes for browser_tools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4745743423617ea2e5435c59f6a4fc91bc56e60c9adff0db8c0b0072e79e5974
MD5 80cbd7ca0311bfcd3139ac90d74e6c80
BLAKE2b-256 32165696b95b46627b6887d497bb5c18088baccba59e49bd29715ef280adf790

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page