
# WebRain
**A portable, LLM-driven browser-automation & web-scraping MCP server — one binary, three engines, any OS.**
WebRain exposes 19 intent-based tools over the **Model Context Protocol**. Install it on any system, point any LLM client (GitHub Copilot, Claude, Codex, Cursor, …) at it, and the model decides everything — search, crawl, scrape, navigate, interact — from a plain-language prompt. No hardcoded intent detection, no daemon, no Node.js.
[](https://github.com/prokopis3/webrain/releases)
[](LICENSE)
[](https://github.com/prokopis3/webrain/releases)
[](https://github.com/prokopis3/webrain/commits/main)
[](https://github.com/prokopis3/webrain/stargazers)
[](Cargo.toml)
**Benchmarks:** **50 pages in 10.5 s** on a local stealth engine · **11.7 s** on local Chrome · full structured payload (~10.5 KB/page) — [see the numbers](#benchmarks).
---
## Why webrain?
Web automation shouldn't mean wiring up a driver, a browser download, and your own tool wrappers before an LLM can touch a page. Webrain collapses that into **one binary + one install command** and speaks MCP, so any LLM client drives it directly.
| | **webrain** | Raw Playwright / Puppeteer |
|---|---|---|
| **Setup** | one binary + `webrain install` | runtime + driver + browser download + your own wrappers |
| **Browsers** | Chrome + lightpanda + obscura through one CDP backend | one engine, usually Chromium |
| **LLM-ready** | MCP server, 19 tools, built-in decision guide | you hand-roll tool functions |
| **Anti-bot** | challenge detection + persistent profile + native login | manual |
| **Extraction** | autoschema → JSON / regex / table / spider / batch | you write selectors |
| **Runs on** | any OS, any LLM client, or plain CLI | tied to your stack |
## What you can do with it
- **Scrape at scale** — `webrain_batch` runs one op across many URLs in parallel tabs; `webrain_crawl` handles spider / sitemap / infinite-scroll / URL-validation, both with auto-throttle and checkpoint-resume.
- **Structured data without hand-written selectors** — `webrain_extract` mode `autoschema` proposes the repeated container, then `schema` / `regex` / `table` / `jsonld` read it. All zero-LLM.
- **Stealth login** — real-Chrome profiles with an encrypted local credential vault (AES-256-GCM + optional TOTP), plus cookie transfer across engines.
- **Get past challenges** — every `webrain_navigate` reports a `challenge` field; protected sites are attempted with real Chrome + a persistent profile + native login, and whether a gate clears depends on the site. Native CAPTCHA/vision v2 (drag, `eval_in_frame`, vision ask) — no Python sidecar.
- **See the page** — `webrain_observe` (state / a11y / semantic tree) plus vision tiles (screenshot → vector store) for tables and charts.
- **Structured search** — `webrain_serp` returns typed JSON (`position`/`title`/`url`/`domain`/`snippet`), deduped and paginated, across provider tiers: free HTTP engines → Brave API key → browser render → serpapi.
- **Read anything** — `webrain_pdf` (extract + render), JSON-LD, media, plus `webrain_scrape` for static pages over plain HTTP with no browser process at all.
- **Talk to it, and watch it work** — `webrain chat` drives all of the above from your own model key; `chat --serve` puts that turn in a page with tool cards you can re-run, model-written follow-up chips, conversation totals, and replies that can be laid out as cards or tables instead of prose. See [Chat](#chat).
---
## Prerequisites
- **OS**: Windows, macOS, or Linux (x86_64 / arm64).
- **A browser engine** — run `webrain install` once (downloads Chrome for Testing). Obscura and Lightpanda are optional extra engines.
- **Linux**: system libraries for Chrome — see [installation](docs/installation.mdx#linux-dependencies).
- **Docker** — only to run the obscura / lightpanda engines in containers.
- **An MCP-capable client** (VS Code + Copilot, Claude, Codex, Cursor, …) — optional; the CLI works standalone.
- **For `webrain chat`** — the Copilot runtime first (`webrain install copilot`), then a
model key. See [Chat](#chat).
## Installation
> Install model mirrors [vercel-labs/agent-browser](https://github.com/vercel-labs/agent-browser): a native binary plus an `install` command that downloads engines into a cache dir.
### Global Installation (recommended)
One command installs `webrain` on your PATH:
**Linux / macOS:**
```bash
curl -fsSL https://raw.githubusercontent.com/prokopis3/webrain/main/scripts/install.sh | bash
```
**Windows (PowerShell):**
```powershell
irm https://raw.githubusercontent.com/prokopis3/webrain/main/scripts/install.ps1 | iex
```
Then download a browser engine once — `webrain install` — and follow [Run it](#run-it).
**Installing with an AI agent?** Point it at