Skip to main content
Glama

browsegrab

한국어 문서 · llms.txt

ローカルLLM向けのトークン効率の高いブラウザエージェント — Playwright + アクセシビリティツリー + MarkGrab、MCPネイティブ。

browsegrabは、ローカルLLM(8B-35Bパラメータ)向けに設計された軽量なブラウザ自動化ライブラリです。PlaywrightのアクセシビリティツリーとMarkGrabのHTMLからマークダウンへの変換を組み合わせることで、browser-useのような代替手段と比較して、ステップあたりのトークン数を5〜8倍削減します。

特徴

  • トークン効率: ステップあたり約500〜1,500トークン(browser-useでは4,000〜10,000トークン)

  • ローカルLLMファースト: vLLM、Ollama、およびOpenAI互換エンドポイントに最適化

  • MCPネイティブ: 8つのブラウザ自動化ツールを備えた組み込みMCPサーバー

  • MarkGrab統合: コンテンツ抽出のためのHTML → クリーンなマークダウン変換

  • アクセシビリティツリー + 参照システム: ビジョンモデルなしで安定した要素参照(e1, e2, ...)を実現

  • 成功パターンキャッシュ: 繰り返されるワークフローでのLLM呼び出しゼロ

  • 5段階JSONパーサー: ローカルLLM出力のための堅牢なアクション解析

  • 最小限の依存関係: コアにはplaywright + httpxのみ

Related MCP server: Playwright MCP

インストール

pip install browsegrab
playwright install chromium

オプション機能付き:

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]      # Everything

クイックスタート

Python API

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"

MCPサーバー

browsegrab-mcp  # Start MCP server (stdio)

Claude Desktop / Cursor / VS Codeの設定:

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

8つのMCPツール: browser_navigate, browser_click, browser_type, browser_snapshot, browser_scroll, browser_extract_content, browser_go_back, browser_wait

仕組み

エージェントブラウズループ

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

トークン効率

browsegrabは構造(アクセシビリティツリー)とコンテンツ(MarkGrabマークダウン)を分離し、LLMが必要とするものだけを送信します:

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

トークン効率(測定値)

ページ

インタラクティブ要素

トークン数

browser-use相当

example.com

1

~60

~500+

Wikipedia記事

452

~1,254

~10,000+

アーキテクチャ

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)

設定

すべての設定は環境変数(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=true

QuartzUnitエコシステムの一部

ライブラリ

役割

markgrab

パッシブ抽出(URL → マークダウン)

snapgrab

パッシブキャプチャ(URL → スクリーンショット)

docpick

ドキュメントOCR → 構造化JSON

browsegrab

アクティブ自動化(ゴール → ブラウザアクション → 結果)

開発

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/ -v

ライセンス

MIT


QuartzUnitエコシステムの一部 — データ収集、抽出、検索、およびAIエージェントの安全性のための構成可能なPythonライブラリ。

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    F
    maintenance
    This 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.
    7,623
    4
    Apache 2.0
  • A
    license
    -
    quality
    D
    maintenance
    A Model Context Protocol server that provides browser automation capabilities by allowing LLMs to interact with web pages through structured accessibility snapshots. It enables fast, lightweight interaction with web content without the need for vision-tuned models or visual processing.
    Apache 2.0

View all related MCP servers

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.

  • Reliable web access for AI agents: smart HTTP, rotating proxies, and full-browser rendering.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/QuartzUnit/browsegrab'

If you have feedback or need assistance with the MCP directory API, please join our Discord server