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 分