Browsegrab

io.github.ArkNillPublished by GitHub account ArkNillv0.1.1Updated Oct 24, 2026

Token-efficient browser agent for local LLMs. Playwright + accessibility tree + MarkGrab.

Overview

AI-generated overview

A local MCP server that drives a Playwright browser through token-efficient accessibility-tree snapshots, letting an assistant navigate, click, type and extract

What you can do
Navigate to URLs and go back in browser history, with configurable headless mode and timeouts. Take accessibility-tree snapshots that expose interactive elements as stable references. Click and type into elements by reference, scroll pages and wait for conditions. Extract page content as compressed accessibility tree plus clean markdown. Run an agentic browse loop against a local or OpenAI-compatible LLM endpoint.
When to use it
Useful when an assistant needs to operate real web pages step by step rather than just fetch them, especially with small local models where per-step token cost matters. Fits repeated browsing workflows that can benefit from cached success patterns.
Requirements
Runs as a local stdio process: install the browsegrab PyPI package with the mcp extra and install the Chromium browser for Playwright. Python and network access are needed. Agentic browse additionally needs an LLM endpoint configured through BROWSEGRAB_LLM_PROVIDER, BROWSEGRAB_LLM_BASE_URL and BROWSEGRAB_LLM_MODEL; other settings use the BROWSEGRAB_ prefix.
Before you install
The server controls a real browser: clicks, typing and form submissions act on live sites and can change or send data. Pages visited and extracted content are passed to the configured LLM endpoint, which may be remote. Cached success patterns are stored per domain. Review which sites you let it operate on.

Installation

In SourceWeft

  1. Open Browsegrab in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

browsegrab

한국어 문서 · llms.txt

Token-efficient browser agent for local LLMs — Playwright + accessibility tree + MarkGrab, MCP native.

browsegrab is a lightweight browser automation library designed for local LLMs (8B-35B parameters). It combines Playwright's accessibility tree with MarkGrab's HTML-to-markdown conversion to achieve 5-8x fewer tokens per step compared to alternatives like browser-use.

Features

  • Token-efficient: ~500-1,500 tokens/step (vs 4,000-10,000 for browser-use)
  • Local LLM first: Optimized for vLLM, Ollama, and OpenAI-compatible endpoints
  • MCP native: Built-in MCP server with 8 browser automation tools
  • MarkGrab integration: HTML → clean markdown for content extraction
  • Accessibility tree + ref system: Stable element references (e1, e2, ...) without vision models
  • Success pattern caching: Zero LLM calls on repeated workflows
  • 5-stage JSON parser: Robust action parsing for local LLM outputs
  • Minimal dependencies: Only playwright + httpx in core

Installation

bash
pip install browsegrabplaywright install chromium

With optional features:

bash
pip install browsegrab[mcp]      # MCP server supportpip install browsegrab[content]  # MarkGrab content extractionpip install browsegrab[cli]      # CLI with rich outputpip install browsegrab[all]      # Everything

Quick Start

Python API

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

bash
# Accessibility tree snapshotbrowsegrab snapshot https://example.com
# JSON outputbrowsegrab 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"

MCP Server

bash
browsegrab-mcp  # Start MCP server (stdio)

Claude Desktop / Cursor / VS Code config:

json
{  "mcpServers": {    "browsegrab": {      "command": "browsegrab-mcp"    }  }}

8 MCP tools: browser_navigate, browser_click, browser_type, browser_snapshot, browser_scroll, browser_extract_content, browser_go_back, browser_wait

How It Works

Agent Browse Loop

mermaid
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"]

Token Efficiency

browsegrab separates structure (accessibility tree) from content (MarkGrab markdown), sending only what the LLM needs:

mermaid
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 --> F

Token efficiency (measured)

PageInteractive elementsTokensbrowser-use equivalent
example.com1~60~500+
Wikipedia article452~1,254~10,000+

Architecture

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)

Configuration

All settings via environment variables (BROWSEGRAB_* prefix):

bash
# BrowserBROWSEGRAB_BROWSER_HEADLESS=trueBROWSEGRAB_BROWSER_TIMEOUT_MS=30000
# LLM (for agentic browse)BROWSEGRAB_LLM_PROVIDER=vllm          # vllm | ollama | openaiBROWSEGRAB_LLM_BASE_URL=http://localhost:8000/v1BROWSEGRAB_LLM_MODEL=Qwen/Qwen3.5-32B-AWQ
# AgentBROWSEGRAB_AGENT_MAX_STEPS=10BROWSEGRAB_AGENT_ENABLE_CACHE=true

Part of the QuartzUnit Ecosystem

LibraryRole
markgrabPassive extraction (URL → markdown)
snapgrabPassive capture (URL → screenshot)
docpickDocument OCR → structured JSON
browsegrabActive automation (goal → browser actions → results)

Development

bash
git clone https://github.com/QuartzUnit/browsegrab.gitcd browsegrabpython -m venv .venv && source .venv/bin/activatepip install -e ".[dev]"playwright install chromium
# Unit tests (no browser needed)pytest tests/ -m "not e2e"
# Full suite including E2Epytest tests/ -v

License

MIT


Part of the QuartzUnit ecosystem — composable Python libraries for data collection, extraction, search, and AI agent safety.

Source: README.md at commit 30f2375

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts