Back to blog

WebMCP Architecture Diagram: How Browser-Native AI Agents Work (2026)

How to diagram a WebMCP (Web Model Context Protocol) architecture. Covers the Tool Contract model, window.AICommands, Declarative vs Imperative APIs, and how WebMCP differs from server-side MCP — with prompt templates.

R
Ryan·Senior AI Engineer
·

WebMCP (Web Model Context Protocol) is a browser-native standard, jointly developed by Google and Microsoft and published under the W3C Web Machine Learning Community Group, that lets websites expose structured, callable actions directly to AI agents running inside the browser. Instead of an agent inferring intent from screenshots, DOM scraping, or blind clicking, a WebMCP-enabled site publishes a Tool Contract — a machine-readable list of the actions it supports — that the in-browser agent can call directly, on the live, authenticated page.

Where server-side MCP connects an AI host to external tools and data sources over stdio or HTTP+SSE, WebMCP moves the same idea into the browser tab itself: the website is the server, the browser's AI agent is the client, and the "transport" is a JavaScript surface rather than a network connection. As WebMCP support lands in Chrome and Edge, architecture and product teams need diagrams that explain this new surface to engineers, security reviewers, and stakeholders. This guide covers the core components and includes ready-to-use prompt templates.

Why WebMCP exists

Before WebMCP, browser-based AI agents (browser extensions, agentic copilots, autonomous shopping or research assistants) had to interact with websites the same way a human does: parsing the rendered DOM, guessing which button does what, and clicking through multi-step flows. This approach is slow, brittle to UI changes, and can misfire on destructive actions like submitting a payment or deleting data.

WebMCP flips the model. A website that wants to be agent-friendly declares its capabilities explicitly — "add to cart," "apply this filter," "submit this form" — as typed, callable tools. The agent reads the Tool Contract, understands exactly what parameters each action needs, and calls it directly. This is the same shift MCP made for backend tool-calling, applied to the front end.

Core components of a WebMCP architecture

Tool Contract

The Tool Contract is the structured manifest a page publishes describing the actions it supports — each with a name, description, and typed input schema (similar in spirit to an MCP server's tool manifest). The agent fetches or receives this contract when it loads the page and uses it to decide which action fulfills the user's request.

Declarative API

For simple, static content — forms, buttons, standard e-commerce flows — sites can expose tools via HTML attributes on existing markup. This requires no JavaScript changes and lets an agent discover "add-to-cart" or "submit-form" actions directly from the page structure.

Imperative API: window.AICommands

For dynamic, stateful interactions, sites register tools programmatically through a JavaScript surface (window.AICommands). This lets a single-page app expose actions that depend on current client-side state — a filtered search, a multi-step checkout, an in-progress editor session — that the Declarative API can't capture.

In-browser agent

The agent itself runs inside the browser (as a browser feature, like Chrome's early preview, or as an extension) and acts on the live, authenticated session — it inherits the user's cookies and login state rather than needing separate credentials. This is the key architectural difference from server-side automation: the agent operates with the same permissions and context the user already has open in that tab.

WebMCP vs. server-side MCP

DimensionMCP (server-side)WebMCP (browser-native)
Where the tool runsExternal server or local processInside the web page itself
Transportstdio or HTTP + SSEIn-browser JS API (no network hop)
Auth modelAPI keys, OAuth tokens held by the serverInherits the user's live browser session
Who publishes toolsBackend/infra teams wrapping internal systemsFrontend teams, on the website itself
Originated byAnthropic (2024)Google & Microsoft, W3C (2026)
Typical useAgent reads a database, calls an internal APIAgent checks out a cart, fills a form, applies filters

In production, the two are complementary: a shopping agent might use server-side MCP to query a price-comparison API while using WebMCP to actually execute the checkout on the retailer's own site, inheriting the user's logged-in session rather than needing stored credentials.

Prompt templates for WebMCP architecture diagrams

E-commerce site with WebMCP checkout

"An e-commerce site exposes a WebMCP Tool Contract with three tools: search_products, add_to_cart, and checkout. Simple product filters use the Declarative API (HTML attributes on the filter form); the multi-step checkout uses the Imperative API via window.AICommands because it depends on client-side cart state. A browser-native AI agent (running as a Chrome extension) reads the Tool Contract on page load, calls search_products with a query from the user, then calls add_to_cart and checkout — all executing against the user's live, authenticated session with existing saved payment methods. No credentials are shared with the agent; it acts within the browser's existing cookie-based session. Show the Tool Contract as a manifest published at page load, and label each tool call with Declarative or Imperative to distinguish the two API paths."

Hybrid WebMCP + server-side MCP research agent

"A research agent combines WebMCP and server-side MCP. The agent runs in the browser and uses WebMCP to interact with three live websites: a company research database (calls its filter and export tools), an internal wiki (calls its search and page-create tools), and a spreadsheet app (calls its add-row tool) — all using the user's existing logged-in sessions in open tabs. Separately, the same agent connects over server-side MCP (HTTP+SSE) to a backend aggregation service that normalizes and deduplicates data pulled from the browser tabs. Show the browser-tab WebMCP interactions and the backend MCP connection as two visually distinct layers, with the agent orchestrating both."

What a good WebMCP diagram must show

  • Tool Contract boundary: Which actions the page has explicitly published — not every button on the page is agent-callable, only declared tools
  • Declarative vs. Imperative: Label which tools come from HTML attributes and which are registered via window.AICommands, since they have different update and testing implications
  • Session inheritance: Make explicit that the agent acts with the user's existing authenticated session — this is the biggest trust boundary difference from server-side automation
  • Destructive action guardrails: Flag tools that trigger irreversible actions (payment, delete, publish) so reviewers can verify confirmation steps exist
  • Cross-tab or cross-site flows: If the agent orchestrates across multiple open tabs, show each site's Tool Contract as a separate node

Frequently asked questions about WebMCP architecture

What is WebMCP?

WebMCP (Web Model Context Protocol) is a browser-native standard that lets websites publish a structured list of callable actions — a Tool Contract — so AI agents running in the browser can act on the page directly instead of interpreting the visual UI. It was jointly developed by Google and Microsoft and published under the W3C Web Machine Learning Community Group.

How is WebMCP different from MCP?

MCP connects an AI application (the host) to external tools and data sources — typically backend servers — over stdio or HTTP+SSE. WebMCP exposes tools directly from a web page to an in-browser agent, with no separate server process and no separate credentials: the agent acts within the user's existing authenticated browser session. The two protocols are complementary rather than competing.

Should I diagram WebMCP integrations separately from my backend architecture?

Yes. Because WebMCP tools execute client-side with the user's live session, they carry a different trust and security model than backend MCP tool calls. Keep WebMCP tool contracts in a distinct layer of your diagram, and clearly flag any tool that performs a destructive or financial action so it gets appropriate review.

Related guides: MCP architecture diagram, A2A protocol architecture, agent payment protocols, and AI agent architecture diagrams.

Ready to try it yourself?

Start Creating - Free