browsegrab
browsegrab
Agente de navegador eficiente en tokens para LLM locales — Playwright + árbol de accesibilidad + MarkGrab, nativo de MCP.
browsegrab es una biblioteca de automatización de navegador ligera diseñada para LLM locales (8B-35B parámetros). Combina el árbol de accesibilidad de Playwright con la conversión de HTML a markdown de MarkGrab para lograr 5-8 veces menos tokens por paso en comparación con alternativas como browser-use.
Características
Eficiente en tokens: ~500-1.500 tokens/paso (frente a 4.000-10.000 para browser-use)
Prioridad a LLM locales: Optimizado para vLLM, Ollama y endpoints compatibles con OpenAI
Nativo de MCP: Servidor MCP integrado con 8 herramientas de automatización de navegador
Integración con MarkGrab: HTML → markdown limpio para la extracción de contenido
Árbol de accesibilidad + sistema de referencia: Referencias de elementos estables (
e1,e2, ...) sin modelos de visiónCaché de patrones de éxito: Cero llamadas a LLM en flujos de trabajo repetidos
Analizador JSON de 5 etapas: Análisis de acciones robusto para salidas de LLM locales
Dependencias mínimas: Solo
playwright+httpxen el núcleo
Related MCP server: Playwright MCP Server
Instalación
pip install browsegrab
playwright install chromiumCon características opcionales:
pip install browsegrab[mcp] # MCP server support
pip install browsegrab[content] # MarkGrab content extraction
pip install browsegrab[cli] # CLI with rich output
pip install browsegrab[all] # EverythingInicio rápido
API de Python
from browsegrab import BrowseSession
async with BrowseSession() as session:
# Navigate and get accessibility tree snapshot
await session.navigate("https://example.com")
snap = await session.snapshot()
print(snap.tree_text)
# - heading "Example Domain" [level=1]
# - link "Learn more": [ref=e1]
# Click using ref ID
result = await session.click("e1")
print(result.url) # https://www.iana.org/help/example-domains
# Type into search box
await session.navigate("https://en.wikipedia.org")
snap = await session.snapshot()
await session.type("e4", "Python programming", submit=True)
# Extract compressed content (AX tree + markdown)
content = await session.extract_content()CLI
# Accessibility tree snapshot
browsegrab snapshot https://example.com
# JSON output
browsegrab snapshot https://example.com -f json
# Extract content (AX tree + markdown)
browsegrab extract https://en.wikipedia.org/wiki/Python
# Agentic browse (requires LLM endpoint)
browsegrab browse https://example.com "Find the about page"Servidor MCP
browsegrab-mcp # Start MCP server (stdio)Configuración para Claude Desktop / Cursor / VS Code:
{
"mcpServers": {
"browsegrab": {
"command": "browsegrab-mcp"
}
}
}8 herramientas MCP: browser_navigate, browser_click, browser_type, browser_snapshot, browser_scroll, browser_extract_content, browser_go_back, browser_wait
Cómo funciona
Bucle de navegación del agente
flowchart LR
A["🌐 URL + Goal"] --> B["Navigate"]
B --> C["AX Tree Snapshot\n~200–500 tokens"]
C --> D{"LLM\nDecision"}
D -->|"click / type / scroll"| E["Execute Action"]
E --> C
D -->|"goal reached"| F["Extract Content\n(MarkGrab)"]
F --> G["✅ Result"]Eficiencia de tokens
browsegrab separa la estructura (árbol de accesibilidad) del contenido (markdown de MarkGrab), enviando solo lo que el LLM necesita:
flowchart TD
A["Raw HTML"] --> B["Accessibility Tree"]
A --> C["MarkGrab Markdown"]
B --> D["Structure: ~200–500 tokens\nInteractive elements with ref IDs"]
C --> E["Content: ~300–800 tokens\nClean markdown · on-demand"]
D --> F["Combined: ~500–1,300 tokens/step\n⚡ 5–8× fewer than browser-use"]
E --> FEficiencia de tokens (medida)
Página | Elementos interactivos | Tokens | Equivalente en browser-use |
example.com | 1 | ~60 | ~500+ |
Artículo de Wikipedia | 452 | ~1.254 | ~10.000+ |
Arquitectura
browsegrab/
├── config.py # Dataclass configs (env var loading)
├── result.py # Result types (ActionResult, BrowseResult, ...)
├── session.py # BrowseSession orchestrator
├── browser/
│ ├── manager.py # Playwright lifecycle (async context manager)
│ ├── snapshot.py # Accessibility tree + ref system
│ ├── selectors.py # 4-strategy selector resolver
│ └── actions.py # navigate, click, type, scroll, go_back, wait
├── dom/
│ ├── ref_map.py # ref ID ↔ element bidirectional mapping
│ └── compress.py # AX tree + MarkGrab → compressed context
├── llm/
│ ├── base.py # LLMProvider ABC
│ ├── provider.py # vLLM, Ollama, OpenAI-compatible
│ ├── prompt.py # System prompts (~400 tokens)
│ └── parse.py # 5-stage JSON fallback parser
├── agent/
│ ├── history.py # Sliding window history compression
│ ├── cache.py # Domain-based success pattern cache
│ └── loop_guard.py # Duplicate action detection
├── __main__.py # CLI (click)
└── mcp_server.py # FastMCP server (8 tools)Configuración
Todos los ajustes a través de variables de entorno (prefijo BROWSEGRAB_*):
# Browser
BROWSEGRAB_BROWSER_HEADLESS=true
BROWSEGRAB_BROWSER_TIMEOUT_MS=30000
# LLM (for agentic browse)
BROWSEGRAB_LLM_PROVIDER=vllm # vllm | ollama | openai
BROWSEGRAB_LLM_BASE_URL=http://localhost:8000/v1
BROWSEGRAB_LLM_MODEL=Qwen/Qwen3.5-32B-AWQ
# Agent
BROWSEGRAB_AGENT_MAX_STEPS=10
BROWSEGRAB_AGENT_ENABLE_CACHE=trueParte del ecosistema QuartzUnit
Biblioteca | Rol |
Extracción pasiva (URL → markdown) | |
Captura pasiva (URL → captura de pantalla) | |
OCR de documentos → JSON estructurado | |
browsegrab | Automatización activa (objetivo → acciones del navegador → resultados) |
Desarrollo
git clone https://github.com/QuartzUnit/browsegrab.git
cd browsegrab
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
playwright install chromium
# Unit tests (no browser needed)
pytest tests/ -m "not e2e"
# Full suite including E2E
pytest tests/ -vLicencia
Parte del ecosistema QuartzUnit — bibliotecas de Python componibles para la recopilación de datos, extracción, búsqueda y seguridad de agentes de IA.
This server cannot be deployed
Maintenance
Related MCP Connectors
AI-powered browser automation — navigate, click, fill forms, and extract data from any website.
E2LLM gives your AI eyes and hands in a real browser: structured perception (SiFR) plus action.
AI-powered web automation. Navigate websites using AI agents for one page or a thousand
AI-powered web automation. Navigate websites using AI agents for one page or a thousand
Related MCP Servers
- AlicenseAqualityDmaintenanceA server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots without requiring screenshots or vision models.228,987,267 npm1Apache 2.0
- AlicenseNot gradedqualityFmaintenanceThis server provides browser automation capabilities using Playwright, allowing LLMs to interact with web pages through structured accessibility snapshots. It enables tasks like web navigation, form filling, and data extraction without the need for screenshots or vision-tuned models.9,525 npm4Apache 2.0

BAP MCPofficial
AlicenseNot gradedqualityCmaintenanceLightweight browser automation server for AI agents, enabling fast (10-25ms per action), structured observations and semantic selectors with zero token overhead.6Apache 2.0- AlicenseBqualityBmaintenanceA browser automation MCP server that enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or vision models.248,987,267 npmApache 2.0