By
What is WebMCP
WebMCP is a browser API that lets a web page publish tools — named functions with a description and an input schema — that an AI agent in the browser can discover and call. Instead of an agent working out how your checkout form behaves by looking at it, your page tells the agent: “there is an add_to_cart tool, it takes a product ID and a quantity.”
This part covers the problem it solves, how it relates to MCP, and what the API looks like.
The Problem: Agents Driving UIs Built for Humans
Today, a browser agent that wants to “add two bags of oat milk to my cart” usually does something like this:
- Take a screenshot or read the accessibility tree
- Guess which element is the search box
- Type, wait, take another screenshot
- Guess which result is the right product, find the quantity control, click “Add”
- Check another screenshot to see if it worked
Every step is an inference. It is slow (many model round trips), expensive (screenshots are large), and fragile — a redesign, an A/B test or a cookie banner can break it. The agent also cannot tell which buttons are safe to press and which spend money.
The site, meanwhile, already has clean functions for all of this. It just has no way to offer them.
The Idea: Let the Page Describe Its Own Actions
WebMCP gives the page that channel. The page registers tools; the browser keeps track of them; an agent (built into the browser, or an extension) lists the tools and calls them.
sequenceDiagram
participant Page as Web page
participant Browser as Browser (document.modelContext)
participant Agent as AI agent
Page->>Browser: registerTool({ name, description, inputSchema, execute })
Agent->>Browser: What tools does this page offer?
Browser-->>Agent: search_products, add_to_cart, ...
Agent->>Browser: call add_to_cart({ productId: "oat-milk-1l", quantity: 2 })
Browser->>Page: execute({ productId, quantity })
Page-->>Browser: "Added 2 × Oat Milk 1L. Cart total: €4.20"
Browser-->>Agent: result
The same oat-milk request becomes one tool call. The page runs its own code, in its own session, with the user’s existing login — and updates its UI as it normally would, so the user sees what happened.
WebMCP vs MCP
WebMCP borrows its vocabulary from the Model Context Protocol: tools, descriptions, JSON Schema inputs, hints about side effects. But it runs somewhere very different.
| MCP server | WebMCP | |
|---|---|---|
| Runs | A separate process or remote service | Inside the web page, in the browser |
| Auth | API keys, OAuth set up for the agent | The user’s existing browser session |
| Lifetime | As long as the server runs | As long as the page (or tool) is alive |
| UI | None — headless | Shares the page with the user |
| Who builds it | Backend / platform team | Front-end team, on the existing site |
They are complementary. An MCP server is right for headless, long-running integrations. WebMCP is right when the user is on your site and the agent is helping them use it — the human stays in the loop and can see every change on screen.
Two APIs
WebMCP offers two ways to define tools.
Imperative — register a tool from JavaScript:
document.modelContext.registerTool({
name: 'add_to_cart',
description: 'Add a product to the shopping cart.',
inputSchema: {
type: 'object',
properties: {
productId: { type: 'string', description: 'Product ID from search_products' },
quantity: { type: 'integer', minimum: 1, default: 1 },
},
required: ['productId'],
},
async execute({ productId, quantity = 1 }) {
const cart = await cartStore.add(productId, quantity)
return `Added ${quantity} × ${cart.lastItem.name}. Cart total: ${cart.total}`
},
})Declarative — annotate an existing HTML form, and the browser builds the tool from its fields:
<form toolname="search_products" tooldescription="Search the store catalogue by keyword.">
<input name="q" toolparamdescription="Search keywords, e.g. 'oat milk'" required />
<button>Search</button>
</form>Use the declarative API when a form already does the job. Use the imperative API when the action lives in JavaScript, needs custom logic, or should return structured data. Parts 2 and 3 cover each in detail.
What WebMCP Is Not
- Not a backend protocol. Tools run in the page. If the tab closes, the tools are gone.
- Not an agent. WebMCP does not include a model. It is the interface an agent uses.
- Not a security boundary. A tool runs with your page’s full privileges. Part 4 covers what that means.
- Not a replacement for accessibility. Agents will still meet pages without tools. Good semantic HTML remains the fallback.
Status and Support
As of November 2026:
- Spec: a Draft Community Group Report from the W3C Web Machine Learning Community Group, edited by people from Microsoft and Google. Not on the standards track yet.
- Chrome: available in an origin trial from Chrome 149. For local testing, enable
chrome://flags/#enable-webmcp-testing. - Edge: available behind a flag.
- Firefox and Safari: no public commitment.
The API has moved during 2026. If you find examples online, check for these outdated forms:
| Outdated | Current |
|---|---|
navigator.modelContext |
document.modelContext (the navigator version is deprecated since Chrome 150) |
provideContext() / clearContext() |
Removed — register tools one at a time |
unregisterTool(name) |
Never shipped — abort the signal passed at registration |
Summary
- Agents operating UIs by sight are slow and fragile; WebMCP lets the page describe its actions directly.
- A tool is a name, a description, an input schema and an
executefunction that runs in your page. - WebMCP brings MCP’s ideas into the browser, using the user’s session and keeping them in the loop.
- There is an imperative API (JavaScript) and a declarative one (HTML forms).
Next, Part 2 builds the store’s tools with the imperative API.
— 1 —