The WebMCP Shim — Greasemonkey for the AI Age
Turn any website into a structured tool API your AI agent can call.
No scraping. No screenshots. No browser restart.
Every agent framework hits the same wall: the web was built for humans with eyeballs, not machines with token budgets.
Every screenshot eats 2,000+ tokens of context window. A 5-step workflow burns 10,000 tokens just looking at pages — before the agent even reasons about them. That is money and latency set on fire.
Headless Chrome gets blocked instantly. So you export cookies, inject them into Playwright, pray the session holds, and restart when it doesn't. A five-minute task becomes a thirty-minute ritual.
CSS selectors are a bet against every deploy. One class rename, one React key change, and your entire automation is dead. Agents built on selectors are inherently fragile.
The WebMCP Shim sits inside your real browser — past Cloudflare, with your auth, speaking structured tool calls instead of pixel coordinates.
Community-contributed .webmcp.yaml per site — declarative tool schemas that map semantic actions to DOM operations.
navigator.modelContext polyfill injected by the extension — exposes a structured tool API on every page.
Runs in your real browser. Past Cloudflare. With your cookies. Human-approved, lease-gated, time-bounded.
# slack.webmcp.yaml name: slack version: 1.0.0 match: "*.slack.com/*" tools: send_message: description: "Send a message to the current channel" params: text: { type: string, required: true } action: selector: "[data-qa='message_input']" steps: [focus, clear, type, submit] read_messages: description: "Read recent messages from the current channel" params: limit: { type: number, default: 10 } returns: Message[]
Lev's Poly architecture generates every surface from a single handler declaration. One function becomes a CLI command, an MCP tool, an HTTP endpoint, and a WebMCP tool definition.
Poly generates every surface automatically
lev send_message
callTool("send_message")
.webmcp.yaml definition
# config.yaml — one declaration, every surface poly: surfaces: - id: send_message resolves_to: chatgpt/send_message - id: switch_model resolves_to: chatgpt/switch_model
Multi-step workflows become tool sequences. Deterministic execution with rollback at every stage.
Constraints enforce safety at compile time. Every tool surface inherits the system's invariants.
The AgentPing extension injects the WebMCP shim into every page you visit,
exposing navigator.modelContext as a structured API surface.
Matching .webmcp.yaml definitions are loaded from the community
registry (or auto-generated on the fly via agentic crawling).
Your agent calls semantic tools directly. No vision model. No coordinate math. Just clean function calls.
| Before: Screenshot Scraping | After: WebMCP Shim (Read) | GenUI (Write) | |
|---|---|---|---|
| Token cost | ~2,000 / step | ~50 / step 40x | ~100 / component |
| Speed | 3–5 seconds | <100ms | <200ms |
| What it does | Reads pixels from page | Reads structured data | Generates UI in-page |
| Cloudflare | Blocked | Passes | Passes |
| Auth | Cookie extraction ceremony | Inherits browser session | Inherits browser session |
| AI required? | Yes (LLM interprets screenshots) | No (structured tool calls) | Yes (LLM generates components) |
A growing registry of community-contributed tool definitions. One YAML file per site. Version-controlled. Fork-friendly.
Anyone can submit a .webmcp.yaml for any site.
Review, fork, and improve — just like userscripts,
but with schema validation and semantic versioning.
No YAML for a site yet? The extension can auto-generate tool definitions by crawling the page structure. AI writes the tool schema so you don't have to.
Lock to a specific version. Roll back when sites change. CI-testable definitions ensure your agent workflows stay green across deploys.
When browsers ship native navigator.modelContext,
the shim detects it and steps aside. Your tool definitions
keep working. Zero migration cost.
The WebMCP Shim is direction one. GenUI and CDP complete the picture — turning the browser into a full bidirectional agent interface.
Agent reads structured data from any website through semantic tool calls.
Agent generates and injects UI components directly into the page.
Agent manipulates the DOM directly through the browser's native debug interface.
The browser becomes a full bidirectional agent interface.
The foundation is live. The WebMCP Shim extends an already-operational agent-browser bridge.
WXT/MV3 architecture. Chrome Web Store ready. chrome.debugger CDP bridge for agent-to-browser communication.
Human approves every agent session. Scoped access per domain. Time-bounded leases that auto-expire. No ambient authority.
Agent → daemon → extension → browser tab. Full round-trip with structured responses. No screenshots in the loop.
20+ services mapped. Non-destructive extraction from your live browser session. No headless browser required.
dev-browser → PinchTab → agent-browser → browser-use → Skyvern. Automatic fallback through increasingly powerful tiers.
Full component library on @kingly/ui. Storybook green. DTS green. The interface layer is production-ready.
Every handler is an MCP tool. One declaration generates CLI, HTTP, and MCP surfaces automatically via Poly.
Deterministic workflow execution. Multi-step tool sequences with rollback, state tracking, and session management.
One shim. Every website. Every agent.