Skip to main content
Glama
README.md
# web-crawl — stealth browser MCP

A stealth browser automation **MCP server**. It exposes the standard Playwright‑MCP‑style
`browser_*` tools, but is backed by [patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright)
and a **real installed Chrome/Chromium**, so anti‑bot systems see an ordinary browser.

Built for testing anti‑bot protection on sites you own or are authorized to test.

## Why

Most automation stacks are easy to fingerprint: `navigator.webdriver`, `HeadlessChrome` in the
User‑Agent, empty `navigator.plugins`, `SwiftShader` WebGL, missing Client Hints… `web-crawl` fixes
those and drives a real browser through the Chrome DevTools Protocol.

Verified against public fingerprint tests (`webdriver=false`, clean UA, real GPU, 5 plugins,
`userAgentData`, `Europe/Prague` timezone, …).

## Tools

`browser_navigate`, `browser_navigate_back`, `browser_snapshot` (accessibility tree with `[ref=eN]`),
`browser_click`, `browser_double_click`, `browser_type`, `browser_fill`, `browser_select_option`,
`browser_hover`, `browser_press_key`, `browser_take_screenshot`, `browser_wait_for`,
`browser_evaluate`, `browser_tabs`, `browser_console_messages`, `browser_network_requests`,
`browser_handle_dialog`, `browser_resize`, `browser_file_upload`, `browser_close`,
plus `browser_probe` (fingerprint dump) and `browser_crawl` (BFS crawler).

## Requirements

- Python **3.10+**
- Chrome/Chromium, or let `setup.sh` download the bundled Chromium
- An MCP-capable client (Claude Code, Claude Desktop, Cursor, …)

## Quick start (macOS / Linux with Chrome)

```bash
git clone https://github.com/<you>/web-crawl-mcp.git
cd web-crawl-mcp
./setup.sh
```

Smoke test (it speaks MCP over stdio, so it will just wait for input):

```bash
./.venv/bin/python test_mcp_client.py    # prints server name, 22 tools, example.com
```

## Register with your agent

Use **absolute paths**.

### Claude Code

```bash
claude mcp add web-crawl -s user -- \
  /ABS/PATH/web-crawl-mcp/.venv/bin/python \
  /ABS/PATH/web-crawl-mcp/mcp_server.py --headless
```

### Claude Desktop

`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or
`%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
  "mcpServers": {
    "web-crawl": {
      "command": "/ABS/PATH/web-crawl-mcp/.venv/bin/python",
      "args": ["/ABS/PATH/web-crawl-mcp/mcp_server.py", "--headless"]
    }
  }
}
```

### Cursor

`~/.cursor/mcp.json` — same `mcpServers` entry as above.

### Generic

Transport `stdio`, command `/ABS/PATH/web-crawl-mcp/.venv/bin/python`,
args `["/ABS/PATH/web-crawl-mcp/mcp_server.py", "--headless"]`.

In a session the tools show up as `mcp__web-crawl__browser_*`.

## NixOS

NixOS needs a few workarounds: no `python3` in `PATH`, compiled pip wheels need `libstdc++`, and
patchright's bundled `driver/node` is a generic binary NixOS cannot run (we point it at Nix Node via
`PLAYWRIGHT_NODEJS_PATH`). Two setup scripts cover both flavours:

| NixOS flavour | Setup | Then |
|---|---|---|
| channels (`<nixpkgs>` works) | `./setup-nixos.sh` | `./run-nixos.sh` |
| flakes (no channels) | `./setup-vm.sh` | `./run-nixos.sh` |

Both write `./env.sh` (`WEB_CRAWL_PYTHON`, `_CHROME`, `_NODE`, `_LIBDIR`) and install deps into
`./pylibs`. Register the launcher:

```bash
claude mcp add web-crawl -s user -- /ABS/PATH/web-crawl-mcp/run-nixos.sh
```

Health check:

```bash
./healthcheck.sh
```

> `nix-collect-garbage` can delete the store paths in `env.sh`; re-run the setup script if the
> server stops starting.

## CLI (no MCP)

`stealth_bot.py` is a standalone stealth crawler:

```bash
./.venv/bin/python stealth_bot.py probe                       # fingerprint check
./.venv/bin/python stealth_bot.py visit https://example.com   # one page + artifacts
./.venv/bin/python stealth_bot.py crawl https://example.com --max-pages 50
./.venv/bin/python stealth_bot.py drive https://example.com    # interactive REPL
```

## What it hides (and what it does not)

✅ `navigator.webdriver` → `false` · clean UA in headless · real WebGL renderer · `navigator.plugins`
· `navigator.languages` · `userAgentData` / Client Hints · `window.chrome` · permissions · timezone
· screen/window sizes · authentic TLS/HTTP2 fingerprint (it is a real browser).

⚠️ **Limits:** your IP is still your IP (a datacenter IP is a strong signal); sophisticated systems
(Cloudflare, DataDome, Kasada) also look at mouse/timing behavior; the spoofed plugin list is not
byte‑identical to every Chrome version.

## Troubleshooting

- **`HeadlessChrome` in UA** — the server always sets a clean UA derived from the real browser version.
- **`window.chrome.runtime` missing** — expected on Chrome 156+; real Chrome no longer exposes it.
- **NixOS `libstdc++.so.6` error** — `LD_LIBRARY_PATH` from `env.sh` fixes it.
- **NixOS `Could not start dynamically linked executable`** — `PLAYWRIGHT_NODEJS_PATH` (Nix Node)
  must be set; `run-nixos.sh` does that.
- **`channel="chrome"` not found** — use `--browser chromium`, `--executable <path>`, or run `setup.sh`
  to download the bundled Chromium.

## Security & ethics

Use it only on sites you own or are explicitly allowed to test. Bypassing bot protection of
third‑party services may violate their terms of service and, depending on jurisdiction, the law.
The authors take no responsibility for misuse.

## License

MIT — see [LICENSE](LICENSE).