Skip to main content

BrowserMCP — Browser Automation MCP Server

CI PyPI Python License

Servidor MCP para automatización de navegador web. Navega, extrae contenido, hace clic, rellena formularios, toma capturas de pantalla y más. Arquitectura de triple motor: Selenium (Chromium), Playwright (Chromium) y motor estático (BeautifulSoup) como fallback.

Features / Funcionalidades

Tool / Herramienta Description / Descripción
navigate Navega a una URL y devuelve título, URL y texto
extract Extrae texto de elementos CSS selector
click Hace clic en un elemento por selector CSS
click_by_text Hace clic en un botón/enlace por su texto visible (soporta múltiples textos con |)
fill Rellena un campo de formulario con un valor
run_script Ejecuta JavaScript en el navegador y devuelve el resultado
screenshot Toma captura de pantalla (base64 PNG)
forms Lista formularios con campos, labels y tipos
links Lista todos los enlaces (internos/externos)
scroll Desplaza la página (down/up/bottom/top)
wait Espera una cantidad de milisegundos
engine_info Muestra el motor activo (selenium/playwright/static)

Tech Stack

  • Python — >=3.11
  • Framework: mcp (FastMCP) via stdio JSON-RPC
  • Selenium Engine: selenium + Chromium (headless)
  • Playwright Engine: playwright + Chromium (experimental)
  • Static Engine: requests + beautifulsoup4 + lxml (fallback)

Selenium Setup / Configuración

El servidor usa Chromium via Selenium en modo headless. Auto-detecta el binario de Chromium.

# Instalar dependencias
pip install mcp selenium beautifulsoup4 lxml requests httpx

# Ejecutar servidor
python server.py

# Forzar motor específico
export BROWSER_ENGINE=selenium    # Usar Selenium
export BROWSER_ENGINE=playwright  # Usar Playwright (experimental)
export BROWSER_ENGINE=static      # Usar motor estático (sin navegador)
export BROWSER_ENGINE=auto        # Intentar Selenium, fallback a static (por defecto)

Chromium en Ubuntu

El servidor busca chromium-browser, chromium y la ruta de snap. Si no encuentra Chromium, usar --headless=new.

Triple Engine Architecture

  • Selenium (preferred): navegador real — soporta click, fill, screenshot, scroll, JS execution
  • Playwright (experimental): navegador real alternativo — soporta mismas capacidades que Selenium
  • Static (fallback): solo extracción HTML — no soporta interacciones dinámicas
  • Auto (default): intenta Selenium, fallback automático a estático

🔧 Recent Improvements

  • click_by_text Tool — Click buttons, links, or interactive elements by visible text content. Supports multiple texts separated by | (e.g. Postularme|Apply|Aplicar). Uses JavaScript execution to find elements by text, not CSS selectors.
  • run_script Tool — Execute arbitrary JavaScript in the browser and return the result. Useful for debugging, inspecting page state, and complex interactions.
  • Improved Label Detection — get_forms() now also finds labels in <div for="..."> elements (not just <label for="...">), with JS-based fallback for React SPAs.
  • Multiple Submit Fix — click_by_text avoids clicking the wrong submit button by matching text content ("Responder", "Enviar", etc.) instead of CSS selector.
  • Headless Mode — Chrome now runs with --headless=new (no visible windows)
  • Random Debug Port — --remote-debugging-port=0 + --remote-debugging-address=127.0.0.1 (security: no more fixed port 9222 exposed)
  • Temp Dir Cleanup — Chrome temp directories are cleaned on server shutdown (no disk leaks)
  • XPath Injection Fix — Label lookup escapes special characters in form IDs
  • Configurable Settings — CHROME_WINDOW_SIZE, CHROME_LANG, BROWSER_TEXT_MAX, BROWSER_JS_FILL_THRESHOLD env vars
  • Playwright Scroll Fix — "bottom" now scrolls to scrollHeight instead of fixed 10000px
  • Playwright Async Fix — _sync_run uses new_event_loop() (no more nested event loop deadlocks)
  • Scroll Case-Insensitive — DOWN/down/Down all work
  • Double Truncation Removed — Server no longer applies a second text truncation after the engine
  • Client Uses sys.executable — No more hardcoded .venv/bin/python path
  • Selenium in CLI — --engine selenium now available in the test client
  • Dead Dependencies Removed — httpx and websocket-client cleaned from pyproject.toml

Project Structure

browser-mcp/
├── server.py                 # MCP server entry point (tools)
├── engines/
│   ├── __init__.py
│   ├── base.py               # BaseEngine, PageResult, LinkInfo, FormInfo
│   ├── selenium_engine.py    # Selenium/Chromium engine
│   ├── static.py             # Static HTML engine (requests + BS4)
│   └── playwright_engine.py  # Playwright engine (experimental)
├── client.py                 # Test client CLI
└── pyproject.toml

Metadata

Release files for browser-mcp-automation 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for browser-mcp-automation 1.0.0
File Size Uploaded Provenance Actions
browser_mcp_automation-1.0.0.tar.gz 78.4 kB Without provenance Details for browser_mcp_automation-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for browser-mcp-automation 1.0.0
File Interpreter ABI Platform Actions
browser_mcp_automation-1.0.0-py3-none-any.whl Python 3 none any Details for browser_mcp_automation-1.0.0-py3-none-any.whl

Total release size: 178.2 kB

Release files / browser_mcp_automation-1.0.0.tar.gz

Download URL browser_mcp_automation-1.0.0.tar.gz
Size 78.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a71d5c72e27bbe535f8ce3d8f024debbbbd74b870ebb3f988974c83f67825737
BLAKE2b-256 checksum
How to use checksums
11b362424a6b4eb34fffd9914a6d54aca56910f8edda584e3d2bc915eb93a6db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / browser_mcp_automation-1.0.0-py3-none-any.whl

Download URL browser_mcp_automation-1.0.0-py3-none-any.whl
Size 99.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4c2dce01daae0d9195c2717f979acbe021db0ee761d564a62d2ece691730408
BLAKE2b-256 checksum
How to use checksums
a84571b74d461d2b206df90b367de597c66fde2ba8b09a5f73eedde734b0e1ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for browser-mcp-automation 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page