jo-inc/camofox-browser

Stealth headless browser for AI agents — bypass Cloudflare, bot detection, and anti-scraping. Drop-in Puppeteer/Playwright replacement.

camofox-browser — Anti-Detection Browser Server for AI Agents

What it is: A server that gives AI agents a stealthy, automation-friendly web browser. It wraps Camoufox—a modified Firefox that disguises its true identity at the C++ level—behind a simple REST API.

Why it exists: Standard browser automation tools (like Playwright or headless Chrome) get blocked by anti-bot systems (Google, Cloudflare). Stealth plugins often make things worse. Camoufox patches Firefox's internals so that fingerprinting checks (like navigator.hardwareConcurrency, WebGL renderers, audio context, screen geometry, WebRTC) return spoofed values before JavaScript ever sees them—no shims, no wrappers, no tells.

What this project adds: Instead of raw browser control, it provides an agent-friendly interface: accessibility snapshots (much smaller than HTML), stable element references (e1, e2, …) for reliable clicking, and search macros for common sites. It also handles session management, cookie import, proxies, and more.


Key Features

  • C++ Anti-Detection – Bypasses Google, Cloudflare, and most bot detection.
  • Element Refs – Stable identifiers (e1, e2, …) for interacting with page elements.
  • Token-Efficient – Accessibility snapshots are ~90% smaller than raw HTML, saving tokens for AI agents.
  • Runs on Anything – Lazy browser launch and idle shutdown keep memory at ~40MB when idle. Works on a Raspberry Pi, a $5 VPS, or shared infrastructure.
  • Session Isolation – Each user gets separate cookies and storage.
  • Cookie Import – Inject Netscape-format cookie files (e.g., from your browser) to authenticate automatically.
  • File Upload – Attach files from a configured directory without a native OS dialog.
  • Proxy + GeoIP – Route traffic through residential proxies; automatically sets locale, timezone, and geolocation to match the proxy's IP.
  • Structured Logging – JSON log lines with request IDs for production observability.
  • YouTube Transcripts – Extract captions via yt-dlp (no API key needed).
  • Search Macros – Pre-built commands like @google_search, @youtube_search, @amazon_search, @reddit_subreddit, and 10 more.
  • Snapshot Screenshots – Include a base64 PNG screenshot alongside the accessibility snapshot.
  • Large Page Handling – Automatic snapshot truncation with offset-based pagination.
  • Download Capture – Capture browser downloads and fetch them via API (optional inline base64).
  • DOM Image Extraction – List <img> src/alt and optionally return inline data URLs.
  • Deploy Anywhere – Docker, Fly.io, Railway.
  • VNC Interactive Login – Log into sites visually via noVNC, then export storage state for agent reuse.
  • OpenAPI Docs – Auto-generated spec at /openapi.json and interactive docs at /docs.
  • Structured Extract – POST /tabs/:tabId/extract with a JSON Schema that maps properties to snapshot refs via x-ref.
  • Session Tracing – Opt-in Playwright trace capture (screenshots + DOM + network) with API endpoints to list, fetch, and delete trace zips.
  • Telemetry – Automatic anonymized crash/hang reporting via GitHub Issues. Identifies which sites cause failures. Private domains are HMAC-hashed, paths/params stripped, tokens/IPs redacted. Opt-out with CAMOFOX_CRASH_REPORT_ENABLED=false.

Quick Start

git clone https://github.com/jo-inc/camofox-browser
cd camofox-browser
npm install
npm start  # downloads Camoufox on first run (~300MB)
# -> http://localhost:9377

Default port is 9377. You can also run via npx @askjo/camofox-browser.

OpenClaw Plugin

Install the plugin:

openclaw plugins install @askjo/camofox-browser

This gives you 31 tools (e.g., camofox_create_tab, camofox_snapshot, camofox_click, camofox_import_cookies) that mirror the HTTP API exactly—a build-time parity test ensures they never drift.


Deployment Options

  • Docker – Use the included Makefile (auto-detects CPU architecture, pre-downloads binaries for fast rebuilds). On Windows, use build.ps1 instead. Do not run docker build directly—the Dockerfile expects pre-downloaded binaries in dist/.
  • Fly.io – Use a Dockerfile that downloads binaries at build time (see Dockerfile.ci).
  • Railway – A railway.toml is included; it maps Railway's PORT to CAMOFOX_PORT automatically.

Advanced Usage

Cookie Import

  1. Generate a secret key: openssl rand -hex 32
  2. Set CAMOFOX_API_KEY in your environment (both the plugin and server use it).
  3. Export cookies from your browser in Netscape format (e.g., using a

Related

  • Project
  • Project
  • Project
  • Dispatch
  • Project