Skip to main content
Glama
mcp-browser-agent

mcp-browser-agent

by NRXQuantum

mcp-browser-agent

A security-first MCP server that lets an AI agent drive a real (sandboxed) Chromium browser — search, navigate, click, type, fill forms, download, test — while you watch live from a separate authenticated URL, pause or STOP it, and take over the mouse and keyboard at any moment.

  • 111 tools: 22 core (always on) + 89 opt-in in 15 groups (cookies, storage, downloads, forms, network, emulation, dom, media, OCR, testing, productivity, …). Tool reference

  • SAFE mode (default): asks you before sensitive actions. FULL CONTROL mode: explicit opt-in, no per-action prompts, scoped, still audited and stoppable.

  • Python ≥ 3.10, MIT licensed. Built on the official MCP SDK + Playwright + Starlette (see Credits).

live view approval

Take over

Tools / Full Control

takeover

tools

One-command install

Copy one line into a terminal. It downloads the latest source, installs the runtime (Python, and Termux's Chromium or Playwright's Chromium), sets up the isolated browser, and starts everything — then prints the authenticated live-view URL.

Termux, Linux and macOS

curl -fsSL https://raw.githubusercontent.com/NRXQuantum/mcp-browser-agent/main/install.sh | bash

Windows 10/11 (PowerShell)

irm https://raw.githubusercontent.com/NRXQuantum/mcp-browser-agent/main/install.ps1 | iex

Install without starting the server:

curl -fsSL https://raw.githubusercontent.com/NRXQuantum/mcp-browser-agent/main/install.sh | bash -s -- --no-run
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/NRXQuantum/mcp-browser-agent/main/install.ps1))) -NoRun

The scripts are short and public — read them first if you prefer: install.sh · install.ps1. They are idempotent: re-running upgrades the environment and keeps an existing config.yaml. On Termux they use the system Chromium and prebuilt Android wheels; on desktops they install Playwright's Chromium.

Useful installer flags: --dir PATH (install location), --no-browser, --no-run; on Windows -Dir, -NoBrowser, -NoRun.

Related MCP server: Tether

Manual install

git clone https://github.com/NRXQuantum/mcp-browser-agent && cd mcp-browser-agent
python3 -m venv .venv && . .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -e .                                       # extras: .[media] .[ocr] .[dev]
python -m playwright install chromium                  # Linux fresh hosts: add --with-deps

Termux/Android: use the native installer instead of playwright install:

bash scripts/termux-install.sh
mcp-browser-agent-termux        # starts Chromium + agent; Ctrl+C stops both

See docs/TERMUX.md.

OS

Status

Linux

Tested (Python 3.12, headless Chromium) — all 82 tests pass

macOS / Windows

Same code, not run by the author; covered only by the CI matrix in .github/workflows/ci.yml. Windows: use PowerShell; chmod hardening of files is best-effort

Termux (Android)

Supported — bash scripts/termux-install.sh then mcp-browser-agent-termux starts Chromium and the agent together; see docs/TERMUX.md (native arm64/armv7, no Playwright browser download)

VPS / cloud

Works; keep the live view on loopback and use an SSH tunnel (below)

Run

mcp-browser-agent serve                       # stdio MCP + live view on http://127.0.0.1:8765

The terminal prints, e.g. Live view: http://localhost:8765/#token=…. Open it: the token (in the URL fragment, never sent to a server or logged) is exchanged for an HttpOnly session cookie and scrubbed from the address bar. Visible browser window: --headed.

Change the port (flag, env var, or config file)

mcp-browser-agent serve --port 9000
MBA_PORT=9000 mcp-browser-agent serve
echo "port: 9000" > config.yaml && mcp-browser-agent serve --config config.yaml   # see config.example.yaml

Precedence: defaults < config file < MBA_* env < CLI flags. MCP-over-HTTP port: --mcp-port.

Connect your agent

stdio (Claude Desktop, Cursor, Claude Code, …):

{ "mcpServers": { "browser": { "command": "/path/to/.venv/bin/mcp-browser-agent", "args": ["serve", "--port", "8765"] } } }

The live-view URL is printed on the server's stderr (stdout is reserved for MCP) — run it once in a terminal, or use a fixed MBA_TOKEN/MBA_PASSWORD in the client's env and open http://127.0.0.1:8765. Streamable HTTP: MBA_TOKEN=… mcp-browser-agent serve --transport streamable-http --mcp-port 8766 → http://127.0.0.1:8766/mcp with header Authorization: Bearer <token>.

Watch, pause, stop, take over

In the live view you see the page, the agent's pointer, click ripples, typed keys (secrets masked), tabs, the action feed, and the mode badge. Buttons: Pause/Resume, ■ STOP (kill switch: cancels the running action, denies pending approvals, blocks all further calls until re-armed), Take over (your mouse, wheel, keyboard and paste go straight into the sandboxed browser while the agent waits; keystrokes are never logged) and Release. The side panel has approvals, tools (enable/disable), domains, plugins (hash approval) and the audit log.

Remote access (VPS)

Keep 127.0.0.1 and tunnel: ssh -L 8765:127.0.0.1:8765 user@server, then open http://localhost:8765/#token=…. Binding to another interface forces TLS with a generated self-signed certificate (or pass --tls-cert/--tls-key); you must also add --allowed-host name:port for the Host header. Plain HTTP on a non-loopback host needs --insecure-http-remote (don't).

Permission modes

SAFE (default)

FULL CONTROL (--trusted, or live view → "Full Control…")

Ordinary navigate/click/type/scroll in approved domains

allowed

allowed, no prompts

Unknown domain

asks (once / always / deny)

allowed inside the scope you chose (--trusted-scope "*.shop.com", default * = any public site)

high/critical tools (JS eval, uploads, cookie write/export, downloads, form submit…)

asks every time

runs

password / payment fields, login submits, sensitive-category sites

asks

runs

New optional tool

you must enable it

agent may request it and it is enabled; plugins still need your hash approval

Audit log, kill switch, authentication, SSRF/URL guards, executable-download blocking, sandbox profile

on

still on

Enabling FULL CONTROL at runtime requires typing ENABLE FULL CONTROL in the authenticated live view; a red banner is then shown permanently and a warning is printed/audited. Only you can switch modes — there is no agent tool for it, and page text cannot trigger it.

Tools & plugins

Core: navigate, reload (hard), back/forward, stop, search (8 engines), snapshot, screenshot, click/double/right, type_text, press_key, scroll, hover, wait_for, get_text, tab list/new/switch/close, list_tools, request_tool_enable, get_status. Opt-in groups: interaction forms dom search_engines tabs_extra cookies storage downloads network emulation session media ocr productivity testing.

mcp-browser-agent serve --enable-tools cookies,forms        # or config enabled_tools, or live view, or agent request (you approve)
mcp-browser-agent tools                                      # list with risk/scope

Every tool declares schema (from type hints), risk, permission scope and a security-review note, defaults to disabled (unless core), and writes an audit entry. Add your own by dropping a file into <home>/plugins/ — it is quarantined until you approve its exact SHA-256, hot-reloaded when approved, and re-quarantined if edited. See docs/PLUGINS.md and examples/plugins/hello_plugin.py.

Security

Read docs/SECURITY_MODEL.md (threat model, layers, limitations). Summary:

  • Risks: the agent drives a real browser. Malicious pages may try prompt injection, drive-by downloads, redirects to internal services, or exploit browser bugs. No software can guarantee protection against browser zero-days.

  • Recommended: keep SAFE mode; keep the live view on loopback (SSH tunnel for remote); run as a non-root user, ideally in a container/VM; keep Chromium updated; use ephemeral profiles; never log the browser into accounts you can't afford to lose; set MBA_PASSWORD on shared machines; review audit.jsonl (mcp-browser-agent audit verify).

  • Safe-usage rules: stay present with the live view open on unknown or sensitive sites; don't use FULL CONTROL on banking/e-mail/social accounts or hostile sites; treat everything the agent reads from pages as untrusted; only approve plugins you've read; never share the token URL.

  • Built-in: sandboxed isolated profile · deny-by-default domain/tool policy · URL/SSRF/redirect/WebSocket guard · human approval for sensitive actions · uploads only from a sandbox dir · executables/scripts blocked on download · untrusted-content fencing · hash-chained audit log with secret redaction · token/password auth, Host+Origin checks, CSP, rate limiting, lockout · loopback bind, forced TLS elsewhere · kill switch · no shell tool.

  • Not covered: DNS-rebinding races, streamed-media redirects, pattern-based JS guard, best-effort harm detection — see the limitations list.

Testing & results

pip install -e ".[dev]" && playwright install chromium && pytest — 82 passed on Linux/Python 3.12 (≈50 s):

  • 47 unit/security: URL guard (26 blocked-URL cases incl. 2130706433, 0x7f.1, IPv4-mapped IPv6, metadata, credentials-in-URL, DNS-to-private), domain matching, sanitiser, audit redaction & tamper detection, download/magic-byte classification, config precedence, plugin hash quarantine/tamper/unload, no-shell check.

  • 21 browser end-to-end (real Chromium, local fixture site): SAFE approvals (domain, password, login submit, download), FULL CONTROL without prompts and scope enforcement, kill switch (incl. in-flight cancel), pause/takeover blocking, redirect → control-port blocked, executable & disguised-ELF downloads blocked, upload path escape blocked, cookie masking/export perms, JS guard, prompt-injection fencing, ~35 optional tools exercised.

  • 10 live-view: unauthenticated/CSRF/bad-Host/bad-Origin rejection, cookie flags, CSP/no-CORS, rate limit, lockout, mode-switch phrase, approvals & plugin approval via API, WebSocket auth + frames/cursor/click events, takeover input, and a real-browser UI test (fragment login, watch, take over typing, STOP, Full Control modal).

  • 4 MCP protocol: real stdio client and bearer-authenticated streamable-HTTP client. Not tested: macOS, Windows, headed mode, real-world sites (no internet use in tests). Termux is covered by the native installer/launcher (armv7 + aarch64 smoke-tested); the full pytest suite is not run on-device. python scripts/make_screenshots.py regenerates the screenshots.

Publish to GitHub

cd mcp-browser-agent
git init -b main && git add -A && git commit -m "Initial release v0.1.0"   # (already done in this checkout)
git remote add origin git@github.com:NRXQuantum/mcp-browser-agent.git
git push -u origin main
git tag -a v0.1.0 -m "v0.1.0" && git push origin v0.1.0
gh release create v0.1.0 --title "v0.1.0" --notes-file RELEASE_NOTES.md
# optional: python -m build && twine upload dist/*   (replace NRXQuantum in README/pyproject URLs first)

Credits / Acknowledgements

Project

License

Copyright / source

Use

MCP Python SDK (mcp)

MIT

© Anthropic, PBC — github.com/modelcontextprotocol/python-sdk

MCP server/protocol

Playwright for Python

Apache-2.0

© Microsoft Corporation — github.com/microsoft/playwright-python

browser automation, CDP screencast

Chromium

BSD-3-Clause (+ components)

© The Chromium Authors

browser (downloaded by Playwright)

Starlette / Uvicorn

BSD-3-Clause

© Encode OSS Ltd.

live-view web server

websockets

BSD-3-Clause

© Aymeric Augustin et al.

WebSocket support

PyYAML

MIT

© Kirill Simonov

config

cryptography

Apache-2.0 / BSD-3-Clause

© PyCA

self-signed TLS

Pillow, pytesseract (optional)

HPND, Apache-2.0

© contributors

media/OCR extras

Design ideas only (no code copied) from microsoft/playwright-mcp (Apache-2.0) and browser-use (MIT). Full list: NOTICE. This project: MIT, see LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to drive a real Chrome browser for autonomous web tasks, using fast typed decisions with calibrated confidence, human-in-the-loop questions, safety gates, and full debug traces.
      7
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to securely control a real, logged-in browser with per-site permissions, per-action approvals, secret redaction, and a tamper-evident audit log, all locally without a cloud relay.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to drive the Chrome, Brave, or Edge browser you are already logged into, working in a tab of its own with a visible cursor and real trusted input. You can pause, take over, or hand back control at any time, and consequential actions such as submitting, paying, sending, deleting, or uploading wait for your approval.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents drive the user's real Chromium browser, including opening and controlling tabs, taking screenshots, capturing network traffic, recording screen activity, and handing control back for logins or payments while using the user's existing sessions, logins, and extensions.
      1,280
      MIT