@anygrab/mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
AnyGrab
Token-Budget-Aware DOM & UI Context Distillation Engine for Coding Agents, Browser-Use & RAG
Turn 27,000+ tokens of bloated CSS-in-JS, inline SVGs, and <div> soup into <600 tokens of clean Tailwind v4 HTML, React JSX, GFM Tables, or structured AI Prompts — deterministically in 4.2ms with 0 LLM calls.
English · 简体中文 · AnyGrab-Bench · MCP Setup · Contributing · 12 Good First Issues
Why AnyGrab?
Modern AI Coding Agents (Antigravity, Claude Code, Cursor, Codex) and Browser-Use pipelines choke on real-world web DOMs:
Dumping
outerHTML+getComputedStyle()on a single SaaS pricing section explodes into 27,397 tokens of browser default CSS resets, obfuscatedcss-19x82ahashes, 4KB inline<svg>paths, and 20-deep wrapper<div>s — rotting your context window.Article extractors (
Readability,defuddle,Turndown) strip 100% of visual layout, Flexbox/Grid structure, design tokens, and interactive ARIA controls, and frequently mangle complexrowspan/colspandata tables.Dev-server tools (
react-grab) require local React Fiber instrumentation and cannot inspect arbitrary external production webpages or static HTML snapshots.
AnyGrab bridges that gap as a zero-dependency, deterministic TypeScript compiler (@anygrab/core) paired with a 1-line CLI, Stdio MCP Server, Chrome MV3 Shadow-DOM Picker, and Interactive Benchmark Playground:
Raw SaaS Pricing HTML + Computed CSS : 27,397 tokens (noisy resets, 13 giant SVGs, css-19x82a)
AnyGrab Default (Lossless UI + CSS) : 1,785 tokens (100/100 fidelity, clean Tailwind v4 / JSX)
AnyGrab (--budget 600) : 235 tokens (AST salience folded, 100% valid tag closure)Related MCP server: Semantic Hints MCP
3-Line Quick Start
# 1. Distill any public URL into a 1,200-token AI prompt (auto-inlines external <link> CSS!)
npx anygrab https://example.com --selector "main" --budget 1200
# 2. Convert a local HTML component into clean React JSX + :hover Tailwind utilities
npx anygrab ./pricing.html --format jsx --hover -o PricingSection.tsx
# 3. Extract structured Design Tokens (colors, fonts, radii, shadows, spacings) as JSON
npx anygrab https://example.com --tokens-onlyTelemetry prints cleanly to
stderr(✔ AnyGrab: 7,828 → 235 tokens (-97.00%) · 3.7ms) sostdoutstays 100% pipe-safe (| pbcopy,> context.md).
Ecosystem Comparison Matrix
Capability | AnyGrab ( |
|
|
|
|
Works on any external live webpage | ✅ Yes | ❌ Local React dev only | ✅ Yes | ✅ Yes | ✅ Yes |
Zero-dependency JS/Edge/Browser core | ✅ | ⚠️ Browser runtime | ✅ Lightweight | ✅ Lightweight | ❌ Proprietary |
CSS → Tailwind v4 reverse compiler | ✅ Built-in + | ❌ Source file lookup | ❌ Strips all CSS | ❌ | ✅ Yes |
Token-budget AST folding ( | ✅ Lossless closure | ❌ No | ❌ No | ❌ No | ❌ No |
2D | ✅ | ❌ N/A | ⚠️ Partial HTML | ❌ Breaks merged cells | ⚠️ HTML only |
CLI + Node SDK + MCP Server included | ✅ All 3 built-in | ⚠️ Dev bridge | ⚠️ Library / CLI | ⚠️ Library only | ❌ Extension/Web |
Runtime LLM cost & latency |
|
|
|
| Paid subscription |
AnyGrab-Bench v0.1.0 Results
Evaluated deterministically (0 LLM calls) across 10 synthetic MIT DOM Torture Fixtures covering CSS-in-JS hash soup, 13× multi-stop gradient SVGs, rowspan/colspan financial statements, 20-layer <div> wrappers, ARIA modals, Kanban sibling lists, and LaTeX academic tables.
Reproduce locally anytime with pnpm bench (source data: benchmarks/results/latest.json):
Aggregate Baseline Summary (10 Fixtures)
Baseline Method | Total Tokens | Avg Tokens | Token Savings | Avg Latency | Fidelity (0–100) | Style Recall | Table / Struct |
Raw HTML + CSS | 31,298 | 3,130 | -0.0% | 0.01 ms | 86.2 / 100 | 62.4% | 93.2% |
Naive Style Picker | 119,176 | 11,918 | +280.8% | 0.78 ms | 84.0 / 100 | 53.3% | 94.8% |
Turndown (GFM) | 2,360 | 236 | -92.5% | 1.89 ms | 51.6 / 100 | 0.0% | 91.6% |
AnyGrab (Default) | 12,697 | 1,270 | -59.4% | 4.23 ms | 99.6 / 100 | 98.6% | 100.0% |
AnyGrab ( | 4,694 | 469 | -85.0% | 3.74 ms | 83.4 / 100 | 94.6% | 92.6% |
Key Takeaways:
AnyGrab (Default)achieves99.6 / 100overall fidelity (100/100 on 9 of 10 torture fixtures, with100.0%text recall,98.6%layout/style recall,100.0%merged-table integrity, and100.0%interactive control preservation) while cutting59.4%of raw HTML tokens and89.3%vs. naive computed-style pickers (119,176 → 12,697tokens) in4.23 ms.
AnyGrab (--budget 600)enforces a strict 600-token ceiling via AST salience sibling folding, cutting85.0%vs. raw HTML (96.1%vs. naive style pickers, averaging469tokens) while maintaining94.6%style recall and92.6%structural tag closure (83.4 / 100fidelity vs. Turndown's51.6 / 100and0.0%style recall).
# | Torture Fixture | Raw HTML | Naive Picker | Turndown GFM | AnyGrab Default | AnyGrab ( |
1 | SaaS 3-Tier Gradient Pricing | 7828t (72.8) | 27397t (75.6) | 237t (53.8) | 1785t (100) | 235t (59.8) |
2 | Merged-Header Financial Statement | 2645t (81.3) | 9786t (87.7) | 185t (49) | 1543t (100) | 483t (71.8) |
3 | Bento KPI Dashboard (20x Div Soup) | 2351t (81.4) | 8397t (80.2) | 94t (52.5) | 794t (100) | 598t (92.5) |
4 | OAuth & Credentials Auth Modal | 1690t (91.3) | 5945t (84.7) | 76t (53) | 735t (100) | 256t (71.4) |
5 | API Reference Docs + TS Code | 1441t (91.6) | 9606t (85) | 511t (48.2) | 830t (95.7) | 590t (92.7) |
6 | Kanban Column (10 Isomorphic Cards) | 5778t (82.9) | 24817t (81.4) | 290t (55) | 2130t (100) | 593t (96.6) |
7 | Dark AI Hero + Decorative Blobs | 1239t (91.5) | 2889t (86.1) | 90t (62.5) | 367t (100) | 367t (100) |
8 | 20-Row Capability Matrix Table | 6173t (82.6) | 19474t (86.2) | 416t (54.6) | 2361t (100) | 503t (88.9) |
9 | Multi-Section Settings Form | 1173t (92.2) | 4341t (85.6) | 179t (39.7) | 942t (100) | 474t (75.1) |
10 | Academic Paper + Theorem & Ablations | 980t (94) | 6524t (87.4) | 282t (47.8) | 1210t (100) | 595t (85.4) |
Architecture
flowchart LR
subgraph Inputs["Input Surfaces"]
DOM["Live Browser DOM<br/>(Element + getComputedStyle)"]
URL["URL / Local File / Stdin<br/>(LinkeDOM + CSS Inliner)"]
RAW["Raw HTML + <style> String<br/>(Zero-Dep Fallback Parser)"]
end
subgraph Core["@anygrab/core (Zero Runtime Dependencies)"]
ADAPT["Declarative Adapters<br/>(docs-mdx / github-ui / arxiv / pricing)"]
STYLE["Style Differ & Cascade<br/>(300+ Default Subtractions + var() Expand)"]
CLEAN["DOM Cleaner & 2D Table Grid<br/>(SVG Compact + Wrapper Unwrap)"]
TW["Tailwind v4 Reverse Compiler<br/>(Hash Class Strip + :hover)"]
BUDGET["AST Salience Budget Pruner<br/>(Sibling Folding & Tag Closure)"]
end
subgraph Outputs["Outputs & Integrations"]
FMT["4 Formats + DesignTokens<br/>(prompt / tailwind-html / jsx / markdown)"]
CLI["anygrab CLI & Node SDK"]
MCP["@anygrab/mcp Stdio Server"]
EXT["Chrome MV3 Shadow-DOM Picker"]
end
DOM --> ADAPT
URL --> ADAPT
RAW --> ADAPT
ADAPT --> STYLE --> CLEAN --> TW --> BUDGET --> FMT
FMT --> CLI
FMT --> MCP
FMT --> EXTProgrammatic SDK (@anygrab/core & anygrab)
Universal Zero-Dependency Core (Browser / Edge / Cloudflare Workers / Node)
import { grab, extractDesignTokens } from '@anygrab/core';
const result = grab(document.querySelector('#pricing-tier')!, {
format: 'prompt', // 'prompt' | 'tailwind-html' | 'jsx' | 'markdown'
locale: 'en', // 'en' | 'zh-CN' (ready-to-paste bilingual AI replication prompts)
maxTokens: 800, // AST salience budget folding (never breaks closing tags!)
compactSvg: true, // Collapses multi-KB <svg> paths into semantic placeholders
preserveTables: true, // 2D virtual grid expansion for rowspan/colspan tables
includeHoverStyles: true, // Emits hover:* Tailwind utilities
styleResolver: (el, pseudo) => window.getComputedStyle(el, pseudo),
});
console.log(result.output); // Clean React JSX snippet
console.log(result.designTokens); // { colors, fonts, radii, shadows, spacings }
console.log(result.metrics); // { rawTokens, outputTokens, compressionRatio, durationMs, ... }Node.js URL & File Loader (anygrab)
import { grabFromUrl, grabFromFile } from 'anygrab';
// Automatically fetches & inlines external <link rel="stylesheet"> CSS (4s timeout guard)
const res = await grabFromUrl('https://example.com', {
selector: 'main',
format: 'prompt',
maxTokens: 1200,
});MCP Server Setup (Antigravity / Claude Code / Cursor / Codex)
@anygrab/mcp exposes 3 local Stdio tools (grab_url, grab_html, extract_design_tokens) with zero cloud keys required:
Antigravity / Cursor / Claude Desktop (mcp_config.json / .cursor/mcp.json)
{
"mcpServers": {
"anygrab": {
"command": "npx",
"args": ["-y", "@anygrab/mcp"]
}
}
}Claude Code CLI
claude mcp add anygrab -- npx -y @anygrab/mcpOpenAI Codex CLI (~/.codex/config.toml)
[mcp_servers.anygrab]
command = "npx"
args = ["-y", "@anygrab/mcp"]MCP Tool | Description |
| Fetches a public HTTP(S) URL, inlines external |
| Distills raw HTML + |
| Extracts deduplicated |
Chrome MV3 Visual Picker Extension (apps/extension)
Inspect and grab any live component in one click with zero host-page CSS pollution (mounted inside an isolated Open Shadow Root #__anygrab-host__, requesting only activeTab, scripting, storage, clipboardWrite — no <all_urls>):
Bilingual Out-of-the-Box (
中文 / EN): Ships with Chrome_locales(en+zh_CN), auto-detects browser language, and lets you switch中 / ENanytime from the Popup or floating HUD — generating localized AI prompts (locale: 'zh-CN' | 'en') ready to paste straight into Antigravity / Codex / Cursor.Built-in 30-Second Interactive Practice Arena (
guide.html): Click How to Use & Practice Arena inside the Popup to open a self-contained visual tutorial with live Pricing Card & Merged Financial Table practice targets so anyone can master picking in 30 seconds.
3-Step Local Load (or download prebuilt .zip from GitHub Releases):
Build the workspace:
pnpm install && pnpm buildOpen
chrome://extensionsin Chrome / Arc / Brave / Edge and enable Developer mode.Click Load unpacked and select the
distsubfolder (anygrab/apps/extension/dist, not the outerapps/extensionfolder).
Keyboard HUD Workflow (Alt+Shift+G):
Hover: Live indigo bounding box +<tag.class> · W×H px · ~N tokenspillArrowUp/ArrowDown: Expand selection to parent container or drill back downTab: Cycle output format (AI Prompt→Tailwind HTML→React JSX→Markdown)ClickorEnter: Distill & copy straight to clipboard + actionable paste toast + localRecent GrabshistoryEscape: Cleanly unmount Shadow Root with zero page residue
Bilingual Official Website, Playground & Leaderboard (apps/playground)
Run the zero-backend 5-section Official Website (Overview · AI Workflows · Live Playground · AnyGrab-Bench Leaderboard · Quick Start & Install) locally:
pnpm playgroundSwitch seamlessly between English / 简体中文, copy battle-tested Antigravity / Codex / Cursor workflow prompts, paste dirty HTML+CSS on the left, drag the Token Budget (200–4,000) slider, compare Original vs. Tailwind Live Sandbox Previews, and inspect extracted Design Token Swatches.
Community Adapters & Contributing
AnyGrab ships with 4 built-in public standard adapters (docs-mdx, github-ui, arxiv-paper, marketing-pricing) and a declarative AnyGrabAdapter plugin interface designed so anyone can add support for a documentation framework or UI kit in under 30 lines of TypeScript.
Read the 30-Line Adapter Tutorial in
CONTRIBUTING.mdPick one of 12 scoped starter tasks in
docs/GOOD_FIRST_ISSUES.md
License
MIT License © 2026 botshen & AnyGrab Contributors
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Unified 15-tool SEO, SERP, clean Markdown & GEO (LLM citation Share-of-Voice) MCP server.
Strips 85-97% of HTML bloat into clean Markdown, <200-token skeletons, or BM25 excerpts via MCP.
Real HTML, styles, measurements and brand tokens from any live site, for coding agents.
Strips 85-97% of HTML/DOM bloat into clean Markdown or JSON with cryptographic ROI proof.
Related MCP Servers
- AlicenseAqualityDmaintenanceMulti-framework MCP server that enables AI to generate clean, semantic CSS class names (e.g., btn-primary) instead of verbose utility strings, with support for Tailwind, Bootstrap, UnoCSS, Tachyons, SSR safety, and minification for token savings.1035 npm8MIT
- FlicenseAqualityCmaintenanceA local stdio MCP server that exposes compact semantic observations from UI elements annotated with data-agent-* hints, designed to work alongside the official Playwright MCP for browser automation.2-
- AlicenseNot gradedqualityNot gradedmaintenanceEnables autonomous web agents to prune raw HTML into accessibility-friendly semantic trees with 80%+ token reduction, auto-map form input schemas, convert HTML/Markdown tables into type-inferred JSON records, and score agent execution trajectories. Runs as a zero-dependency, stdlib-only MCP stdio server for Claude Desktop, Cursor, and Windsurf.MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI agents and MCP-compliant clients to dynamically shrink long-horizon context windows, pruning verbose tool outputs, HTML boilerplate, and semantic redundancy by roughly 40-70% without frontier LLM round-trips. Runs deterministically as a zero-dependency Python stdio server, accepting a payload plus optional compression and risk-bound options.7-