Browsegrab

io.github.ArkNill由 GitHub 帳號 ArkNill 發布v0.1.1更新於 Oct 24, 2026

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

概覽

AI 產生的概覽

本機 MCP 伺服器,透過節省 token 的無障礙樹快照驅動 Playwright 瀏覽器,讓助理導覽、點擊、輸入並擷取內容。

可以做什麼
導覽至網址並返回瀏覽歷史,可設定無頭模式與逾時。取得無障礙樹快照,把可互動元素暴露為穩定參照。依參照點擊和輸入元素,捲動頁面並等待條件。把頁面內容擷取為壓縮的無障礙樹加乾淨 markdown。針對本機或 OpenAI 相容的 LLM 端點執行智慧瀏覽迴圈。
適用情境
適合助理需要逐步操作真實網頁、而不只是抓取網頁的情境,尤其是每步 token 成本敏感的小型本機模型。也適合可重複使用快取成功模式的重复瀏覽流程。
執行需求
以本機 stdio 程序執行:安裝帶 mcp 附加項的 browsegrab PyPI 套件,並為 Playwright 安裝 Chromium 瀏覽器。需要 Python 和網路存取。智慧瀏覽還需透過 BROWSEGRAB_LLM_PROVIDER、BROWSEGRAB_LLM_BASE_URL 和 BROWSEGRAB_LLM_MODEL 設定 LLM 端點;其他設定使用 BROWSEGRAB_ 前綴。
安裝前請注意
此伺服器控制真實瀏覽器:點擊、輸入和表單送出會作用於線上網站,可能修改或傳送資料。造訪的頁面和擷取的內容會傳給所設定的 LLM 端點,該端點可能是遠端的。成功模式依網域快取。請確認允許它操作哪些網站。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Browsegrab,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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.

來源:README.md,提交 30f2375

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分