MCP-Private-Browser
README.md
# MCP-Private-Browser
A private browser that you and your LLM share. The browser runs in a Docker container, not on your host machine, and the model drives it over MCP. You watch it live from Chrome on your desktop or phone, and take the mouse when it gets stuck on a login or a captcha.
Most MCP browsers are a headless browser on your own machine that only the model can see. This one is different:
- **Tor is built in.** Each session picks your own IP or a Tor exit, and can switch at any time.
- **Nothing touches your host.** Every session gets its own throwaway container, and the container removes itself when the session goes idle.
- **You are in the loop.** See and hear the page, click and type in it, sign in yourself and save the login for the model to reuse.
- **You can point at things.** Mark up the live page (pick elements, draw, edit text and styles) and send it all to the model in one go.
- **It handles the hard pages.** Tools for canvases, sliders, drag puzzles and captchas, where a normal click-and-type browser gives up.
- **It learns.** When the model gets past a challenge, it saves the steps that worked as a recipe. The next time the same challenge shows up, the server reminds it, and it replays the recipe in one call instead of working it out again.

## What you get
- **Private browsing over Tor.** A Tor ships with it. The model picks direct or Tor per session (`spool {tor: true}`), and `what_is_my_ip` confirms the exit.
- **A browser in a container.** Chromium runs in its own disposable container, one per session. Nothing touches your host, and every browser starts clean.
- **Shuts itself down.** A session with no activity loses its container after 30 minutes (configurable), so idle browsers hold no memory or CPU. The next call starts a fresh one.
- **Live viewer.** Open a link in Chrome, on a desktop or a phone, and see what the model sees. Click, type and drag to take over at any time. Tabs, back/forward, an address bar and full screen are there.
- **Audio.** Hear the page's sound in the viewer.
- **Light on resources.** The viewer only receives a frame when the page changes. A still page sends nothing, and the status line says so.
- **JavaScript injection.** The model runs scripts in the page (`evaluate_js`, `run_script`), keeps scripts across navigations (`add_init_script`) and gets called back on page events (`watch`, `add_binding`). That covers reading data, changing the page and reacting to it.
- **Scraping tools.** Page text, an accessibility snapshot with element refs, numbered marks on screenshots, frames, the network and console log, and ad blocking. Cross-origin iframes are read like the rest of the page.
- **Captcha tools.** Optimized tools for captchas. Detect a challenge, read its state, take close-up screenshots, OCR text, and track moving pieces across frames. The same tools work on any canvas, slider or drag-and-drop UI. The model, or you in the viewer, selects the answers. (We recommend you use: Qwen 3.8 Flash Next or Deepseek 4.1 Flash 1017)
- **Recipes: it learns from its mistakes.** The model saves the tool calls that solved a challenge, with notes on what went wrong first, and rates each run as a win or a loss. Recipes are kept on a volume, survive restarts and are shared by every session, so one model's lesson helps the next one.
- **Downloads and uploads.** Files the browser downloads are listed, readable by the model and saveable from the viewer. `upload_file` attaches a file to a page's file input.
- **Saved logins.** Sign in once in the viewer, save the session by name, and load it in a later session.
- **Phone and tablet emulation.** `set_viewport` switches to device presets with touch and the right user agent.
- **Annotations for web work.** Mark up the live page in the viewer (pick elements, draw, edit text and styles live) and send it all to the model in one go.
- **It says what each action did.** After a click or a keypress the reply tells the model what changed: new content, a dialog, a navigation, a new tab, or nothing at all. Cookie banners, modals that cover the target and bot walls are named, so the model does not have to guess from a screenshot.
- **Developer feedback.** `dev_log` gives console errors, uncaught exceptions and failed requests. `layout_check` finds overflow and small tap targets on a phone or desktop size.
- **Real mouse work.** Clicks by element or by coordinate, drags along a path of points, several strokes in one call, and a report of whether a dragged piece moved, snapped back or was never grabbed.
- **Shared tabs.** You and the model use the same tabs. Open, close or switch one in the viewer and the model is told before its next step.
- **Many sessions at once.** Up to 8 browsers run side by side (configurable), each in its own container with its own cookies and its own direct or Tor exit.
It has 66 tools. A browsable list is served at `/docs`.
## Quick start
You need Docker with Compose.
```bash
git clone https://github.com/hypersniper05/MCP-Private-Browser.git
cd MCP-Private-Browser
docker compose up -d --build
curl http://127.0.0.1:8940/health
```
The MCP endpoint (Streamable HTTP) is `http://127.0.0.1:8940/mcp`.
```json
{ "mcpServers": { "browser": { "type": "http", "url": "http://127.0.0.1:8940/mcp" } } }
```
For Claude Code:
```bash
claude mcp add --transport http browser http://127.0.0.1:8940/mcp
```
Then ask your model in plain language: "open the viewer", "search for X and open the second result", "switch to Tor and check your IP".
## Works with
Any harness or app that speaks MCP over Streamable HTTP, for example Claude Code, [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), pi and llama.cpp front ends. If your harness can open a browser through MCP, it can use this one.
### Several models at once
Each MCP session gets its own browser container, so sessions never share tabs, cookies or logins. To give several models or apps their own key and their own session behind one endpoint, put it behind [MCP-Manager](https://github.com/hypersniper05/MCP-Manager). The models then browse independently of each other.
## Screenshots
| | |
|---|---|
|  The live viewer: what the model sees, in your browser |  A Tor session, checked on check.torproject.org |
|  Annotating a page: pins, an arrow, a live style edit |  Every tool with its parameters, at `/docs` |
## The viewer
Ask the model to open the viewer (`open_viewer`). It returns a link such as `http://127.0.0.1:8940/viewer.html?t=…`.
- What you do in the viewer happens in the model's browser, and the model is told when you open, close or switch tabs.
- The pencil button opens the annotation tools: element picker, region, pen, arrow, note, text and style edits, hide, move, measure, colour picker. Send delivers them to the model with screenshots.
- To open it from a phone or another machine, set `BIND_ADDR=0.0.0.0` and `VIEWER_URL` (see below).
## Tor
- `spool {tor: true}` starts the session's browser on Tor. `spool {tor: false}` goes back to your own IP.
- Only the exit IP and the timezone change. The browser is still Chromium, not Tor Browser, so sites can fingerprint it as Chromium.
- Tor exits are public, so expect more blocks and captchas.
## Configuration
Copy `.env.example` to `.env` and set what you need. The common ones:
| Variable | Default | What it does |
|---|---|---|
| `BIND_ADDR` | `127.0.0.1` | where the port listens. `0.0.0.0` opens it to your LAN or tailnet |
| `PORT` | `8940` | host port |
| `MCP_AUTH_TOKEN` | empty | require `Authorization: Bearer <token>` on `/mcp` |
| `DEFAULT_EGRESS` | `direct` | `direct` or `tor`, for sessions that don't choose |
| `SEARCH_URL` | DuckDuckGo | the `search` tool's engine. Any URL that takes `?q=`. A self-hosted SearXNG is recommended (see below) |
| `VIEWER_URL` | empty | the address people open the viewer at, e.g. `http://my-host:8940` |
| `IDLE_TIMEOUT_MIN` | `30` | minutes of no activity before a session's browser is removed |
The full list is in the [reference](docs/REFERENCE.md#configuration).
### Recommended search engine
For private search, run your own SearXNG with [MCP-WebSearch-SearXNG](https://github.com/hypersniper05/MCP-WebSearch-SearXNG) and point the browser at it:
```ini
SEARCH_URL=http://<your-host>:8888/search
HOME_URL_DIRECT=http://<your-host>:8888/
HOME_URL_TOR=http://<your-host>:8888/
PROXY_BYPASS=localhost;127.0.0.1;<your-host>
PROXY_RESOLVER_EXCLUDES=tor;localhost;<your-host>
```
`<your-host>` is the machine SearXNG runs on, as the browser containers reach it: its LAN or tailnet address, or `host.docker.internal` with Docker Desktop. `localhost` would point at the browser container itself. The two `PROXY_` lines keep your own search engine direct in Tor sessions, so searches don't leave through a Tor exit.
## Security
- `/mcp` has no login unless you set `MCP_AUTH_TOKEN`. By default the port listens on `127.0.0.1` only. Set a token before you open it to a network.
- The supervisor mounts the Docker socket to start and remove the browser containers. The browser containers themselves get no socket, no volumes and no published ports.
- Saved logins are cookies. Anyone who can call `load_state` can use them, so treat the server like a password store when you use that feature.
- Viewer links carry a random token and stop working when the session ends.
## Documentation
- [User guide](docs/GUIDE.md): watching the browser, logging in, captchas, downloads.
- [Reference](docs/REFERENCE.md): every tool, the HTTP endpoints, the viewer protocol, all settings.
- `/docs` on a running server: the tool list with parameters, generated from the server itself.
## Development
```bash
npm install
npm run build
```
## License
[Apache 2.0](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues