WebMCP explained: should your site expose tools to AI agents?
What WebMCP is, how the imperative and declarative APIs register tools for in-browser AI agents, its Chrome origin trial status, and whether to act now.
By Crawlito · 9 min read
In short
- WebMCP is a proposed web standard that lets a page register tools, JavaScript functions or HTML forms with a name, description and JSON Schema, that an AI agent in the browser can call.
- The specification is a Draft Community Group Report from the W3C Web Machine Learning Community Group, not a W3C Standard, and the API lives on document.modelContext.
- Chrome opened a WebMCP origin trial in Chrome 149, originally running to Chrome 156, and an intent posted in September 2026 asks to extend it to Chrome 162.
- Chrome's documentation says WebMCP is primarily designed for local browser workflows with a human in the loop, and that clients must visit a site to learn whether it has tools, so it is not a way for AI search crawlers to read your site.
- Adding WebMCP is optional progressive enhancement; crawlable HTML and working forms remain what AI search crawlers and browser agents rely on today.
On this page
- What WebMCP is
- The imperative API: registering tools in JavaScript
- The declarative API: turning a form into a tool
- Status: origin trial, not a shipped feature
- WebMCP vs an MCP server vs crawler readability
- Security points to settle before you register tools
- Should you add WebMCP now?
- Frequently asked questions
- Get the basics right first
WebMCP is a proposed web standard that lets a web page hand an AI agent a list of tools: named functions with a description and a JSON Schema for their inputs, which an agent running in the browser can call instead of guessing which buttons to click. Chrome is testing it in an origin trial that started in Chrome 149. Most sites do not need to act yet. It is worth prototyping if you run a web app with complex forms or multi-step tasks that agents already struggle with, and it has nothing to do with whether AI search engines can find or quote your pages.
This post covers what the draft and Chrome's documentation actually say, the two ways to define a tool, the current status, and how WebMCP differs from an MCP server on your backend. For NLWeb and remote MCP endpoints, see our separate guide to NLWeb and MCP for websites.
What WebMCP is
Chrome's WebMCP overview describes it as a proposed web standard for building and exposing structured tools for AI agents. Today, a browser agent completes a task by reading the page and simulating clicks and typing, which Chrome calls actuation. With WebMCP, the page declares what it can do, and the agent calls those tools directly. Chrome says this improves the accuracy and reliability of agent tasks and can be added as progressive enhancement.
The specification is published by the W3C Web Machine Learning Community Group. At the time of writing it is a Draft Community Group Report dated 13 November 2026, with editors from Microsoft and Google. The document itself states that it is not a W3C Standard and not on the Standards Track. The explainer repository sets out the intent:
- Human in the loop. The explainer targets cooperative scenarios where a user delegates tasks to an agent in the browser and stays involved.
- More reliable agents. Defined client-side tools replace fragile DOM scraping and simulated clicks.
- Reuse existing code. The JavaScript that already powers your UI can become a tool.
The explainer lists fully autonomous workflows without a browser UI, replacing backend protocols such as MCP, and replacing the human interface as non-goals.
The imperative API: registering tools in JavaScript
The imperative API registers a tool with document.modelContext.registerTool(). If you see navigator.modelContext in an example, check it: the current spec defines modelContext on Document, and Chrome's imperative API page uses document.modelContext. Each tool needs a name, a description, an inputSchema and an execute function. The execute function receives the input arguments first and an options object with an AbortSignal named signal second. This example follows the pattern in Chrome's documentation:
const controller = new AbortController();
await document.modelContext.registerTool({
name: 'check_stock',
description: 'Check whether a product is in stock at a given store.',
inputSchema: {
type: 'object',
properties: {
sku: { type: 'string', description: 'Product SKU' },
storeId: { type: 'string', description: 'Store identifier' },
},
required: ['sku'],
},
annotations: { readOnlyHint: true },
execute: async ({ sku, storeId }, { signal }) => {
const res = await fetch(`/api/stock?sku=${encodeURIComponent(sku)}&store=${encodeURIComponent(storeId ?? '')}`, { signal });
const data = await res.json();
return `${sku}: ${data.inStock ? 'in stock' : 'out of stock'}`;
},
}, { signal: controller.signal });
// Remove the tool later, for example when the user leaves this view.
controller.abort();What the spec and Chrome's documentation say about the rest of the surface:
| Part | What it does |
|---|---|
registerTool(tool, options) | Adds one tool. Per the spec, it rejects a duplicate name, an empty name or description, a name over 128 characters, or a schema that cannot be serialized |
signal option | Unregisters the tool when its AbortController aborts. From Chrome 153 this does not break executions already in progress |
getTools() | Returns the tools the calling document may access, in alphabetical order, same-origin by default |
executeTool(tool, args) | Runs a tool from getTools() and returns its result, or null if it triggered a navigation |
exposedTo option | Lists other origins allowed to see and run the tool; the caller must also name your origin in fromOrigins |
annotations | Hints: readOnlyHint, untrustedContentHint, consequentialHint and debugging (Chrome 156 and later), all false by default |
consequentialHint marks an action as significant or irreversible, such as a booking or a payment, so an agent may ask the user to confirm. untrustedContentHint flags output that contains content you do not vouch for, such as user reviews.
The declarative API: turning a form into a tool
The declarative API needs no JavaScript to start. You add attributes to an existing HTML form, and the browser builds the JSON Schema from its fields:
<form toolname="track_order"
tooldescription="Look up the delivery status of an order."
action="/orders/track">
<label for="order">Order number</label>
<input id="order" name="order" required>
<label for="email">Email used for the order</label>
<input id="email" name="email" type="email" required>
<button type="submit">Track</button>
</form>The attributes Chrome documents:
toolnameandtooldescriptionon the<form>register the tool. Removing either one unregisters it.toolparamdescriptionon a field describes that parameter. Without it, the browser uses the field's<label>, thenaria-description. Good labels therefore do double duty.toolautosubmiton the<form>lets the agent submit and navigate. Without it, the agent fills the fields and the user has to press Submit.
In your submit handler, SubmitEvent.agentInvoked is true when an agent filled the form, and respondWith() returns a value to the model after you call preventDefault(). Chrome also adds the CSS pseudo-classes :tool-form-active and :tool-submit-active so you can style a form while an agent is using it, and fires toolactivated and toolcancel events on document.modelContext.
Status: origin trial, not a shipped feature
At the time of writing, WebMCP is an experiment in Chrome only.
| Item | Status |
|---|---|
| Specification | Draft Community Group Report, not on the W3C Standards Track |
| Chrome origin trial | Opened in Chrome 149, announced 9 June 2026 |
| Trial end | Originally Chrome 156; an intent to extend posted 29 September 2026 asks for Chrome 162, citing API changes from trial feedback |
| Local testing | The chrome://flags/#enable-webmcp-testing flag |
| API stability | Chrome says the APIs are under active discussion and may change |
To use it on a live site, register for the trial and send the token Chrome gives you, either in the page head or as a response header, as Chrome's origin trials guide describes:
<meta http-equiv="origin-trial" content="YOUR_TOKEN">Origin-Trial: YOUR_TOKENChrome ignores expired tokens, and when a trial is extended you have to renew the token for each origin, so treat anything you ship as an experiment that needs a fallback. Chrome's version notes already show changes between releases: JSON-stringified input arguments were deprecated in Chrome 155, and from Chrome 156 the window.ontoolactivated and window.ontoolcancel handlers are not supported.
WebMCP vs an MCP server vs crawler readability
The name invites confusion, so it helps to separate three things.
| WebMCP | MCP server | Crawlable HTML | |
|---|---|---|---|
| Where it runs | In the user's open browser tab | On your backend, reached over Streamable HTTP | Your normal web server |
| Who uses it | An agent in the browser, with the user present | An AI application the user connected to your server | Search and AI crawlers, and fetchers acting for a user |
| How it is found | The agent has to load the page first | The user or developer adds the server URL | Links, sitemaps, search indexes |
| Session | The user's own logged-in session and page state | Its own authorization; the MCP spec defines an optional OAuth 2.1 flow for HTTP | Usually none |
The explainer says WebMCP borrows MCP's vocabulary of tools and schemas but deliberately does not adopt the Model Context Protocol spec directly, because MCP lacks web concepts such as origins, permissions and the DOM. It describes WebMCP as a complement to backend protocols, not a replacement.
The most important line for search is in Chrome's limitations: clients must visit a site to learn whether it has tools, and the API is primarily designed for local browser workflows with a human in the loop. A crawler such as OAI-SearchBot or Claude-SearchBot fetches HTML; it does not open a tab, run your scripts and call tools. No AI search operator documents using WebMCP tools to build answers at the time of writing. WebMCP will not help a page get indexed or cited, and a page that crawlers cannot read is not fixed by adding it. The groundwork for that is covered in our guides to raw versus rendered HTML and serving Markdown to agents.
Security points to settle before you register tools
A tool is an API that an AI model decides when to call, with the user's session. The spec's security section is long, and Chrome publishes separate secure-tools guidance. The practical points:
- Prompt injection runs both ways. The spec covers poisoned tool metadata and tool output that carries instructions. Mark user-generated output with
untrustedContentHint. - Mark consequential actions. Use
consequentialHintfor purchases, deletions and account changes, and keep a confirmation step you control. Chrome's overview says a tool can request user interaction with a confirmation dialog, and the spec adds that agents cannot rely only on a site's own descriptions and annotations for security. - Do not over-ask. The spec warns that a tool with many harmless-looking parameters can get an agent to fill them from the user's personal data, which lets a site build a profile without consent. Ask only for what the task requires.
- Validate as if the input were hostile. Tool input comes from a model. Validate it on the server exactly as you would a form post.
- Control iframes. Access is gated by the
toolsPermissions Policy, whose default allowlist is'self'. Cross-origin iframes cannot register tools unless the parent addsallow="tools", and cross-origin exposure needsexposedToon one side andfromOriginson the other. The spec notes that aPermissions-Policy: tools=()header turns WebMCP off for the page and its frames. - Keep descriptions short. Chrome's secure tools guidance recommends, at the time of writing, about 30 characters for tool and parameter names, 150 for a parameter description, 500 for a tool description and 1.5K for a single tool output. These are recommendations, not enforced limits.
Should you add WebMCP now?
| Your site | Suggested step |
|---|---|
| Content site, blog or marketing site | Skip it; focus on crawlable HTML and clear forms |
| Ecommerce or booking flow with complex forms | Try the declarative API on one form behind the origin trial |
| Web app where users do multi-step tasks | Prototype imperative tools that wrap existing UI functions |
| Product with a public API | Build an MCP server first; consider WebMCP for in-app tasks later |
Whatever you decide, the cheapest preparation is the same: forms with real <label> elements, descriptive field names and server-side validation. The declarative API reads labels directly, and browser agents without WebMCP rely on the same signals. Our guide to AI browser agents in server logs shows what browser agents look like in your logs, and our guide to Lighthouse's agentic browsing audits covers the Lighthouse checks that include WebMCP.
To test locally, enable the flag above and use one of the extensions Chrome lists, such as the Model Context Tool Inspector, to see your tools and call them. Chrome notes these test extensions are separate from Gemini in Chrome.
Frequently asked questions
Is WebMCP the same as MCP?
No. MCP connects AI applications to servers over stdio or HTTP, while WebMCP is a browser API that lets a page register tools for an agent in the same tab. It reuses MCP's ideas of tools and schemas but is a separate specification.
Does WebMCP help my site appear in ChatGPT, Perplexity or Google AI answers?
Not on any documented basis. AI search crawlers fetch HTML, and Chrome says agents must visit a page to discover its tools. No AI search operator documents using WebMCP at the time of writing.
Which browsers support WebMCP?
At the time of writing, Chrome supports it through an origin trial that started in Chrome 149, and locally behind the enable-webmcp-testing flag. It is not a shipped web standard.
Is it navigator.modelContext or document.modelContext?
The current draft and Chrome's documentation use document.modelContext. The spec does not define navigator.modelContext, so update any code or tutorial that uses it.
Do I need JavaScript to use WebMCP?
No. The declarative API turns an existing HTML form into a tool with the toolname and tooldescription attributes. JavaScript is only needed for custom tools or to return results with respondWith().
Get the basics right first
WebMCP is an optional layer on top of a page that already works. Before you experiment with it, run the free check on an important page to see whether AI crawlers can reach it and read its content in the HTML.
Filed under Strategy and audits. Topics: ai-agents, javascript, strategy, html