Think about how a browser agent uses a page today.
Say a user asks one to "decode this JWT and tell me when it expires", and it lands on our JWT decoder. It takes a screenshot, finds the text area, pastes the token, takes another screenshot, maybe scrolls, takes a third, and reads the expiry timestamp off the rendered page. If nothing on the page moves around, it gets the right answer. Either way it burns several model calls to do something the page could do in one function call. The function already exists. It's the same code that runs when a person clicks the button.
That gap is what WebMCP is trying to close. Instead of making agents reverse-engineer your interface from pixels, the page tells them directly: here are the things I can do, here's what each one needs, call them like functions.
For this post I read the latest draft spec, Chrome's documentation and the official type definitions, and wrote and type-checked tool code for this site's own search and forms. I haven't put these tools in front of real users yet, and I'll say so where that matters. This post is what I learned. It covers what WebMCP is and isn't, where it stands at the end of November 2026 (the API has changed a lot this year, and many tutorials you'll find are already out of date), how both of its APIs work, and the security questions you should answer before you register a single tool.
What WebMCP is, in one paragraph
WebMCP is a proposed browser API that lets a web page register "tools" that AI agents can discover and call. A tool has a name, a natural-language description, a JSON Schema for its input, and a JavaScript function that runs when it's called. The function runs in the page, in the user's browser tab, with the user's existing session. There's no server you have to deploy for it, no API key, and no separate authentication flow.
The name comes from the Model Context Protocol, the open protocol for connecting AI applications to tools and data, which we covered in depth in our MCP architecture deep dive. WebMCP borrows MCP's idea of a tool (name, description, input schema) and its vocabulary, but it's not the same thing and it doesn't use the MCP wire protocol. That distinction confused me at first, so it's worth spelling out.
How it differs from an MCP server
A normal MCP server is a process. It runs on your machine or in the cloud, an AI client connects to it over stdio or HTTP, and the server does the work. If the server needs to act as a user, you give it credentials.
A WebMCP tool is a function on a web page. The "server" is the tab the user already has open. The browser, or an agent running inside or alongside the browser, discovers the page's tools and calls them. The function runs with the page's cookies, its in-memory state and its logged-in user, the same way a click handler would.
| MCP server | WebMCP tool | |
|---|---|---|
| Where the code runs | A separate process you deploy | Inside the web page, in the user's tab |
| Who it acts as | Whatever credentials you give it | The user who is signed in to the page |
| How agents find it | Configured in the client | Discovered from the page the user is on |
| Works without a browser | Yes | No |
| What you have to build | A server, auth, hosting | A few JavaScript functions |
The practical consequence: WebMCP is for the case where a person is on your site and asks an agent to help them do something there. It's not a way to let background agents hit your site at scale while nobody is watching. For that, you still want a real API or a real MCP server.
Where things stand in late 2026
This is the part that changes fastest, so here's the state of things as of November 28, 2026, with sources.
The spec is a Draft Community Group Report of the W3C Web Machine Learning Community Group. The latest draft is dated November 24, 2026. A community group report is not a W3C Standard and is not on the standards track yet. It's a proposal that browser vendors are discussing.
Chrome is the only browser that ships it, and only as an experiment. It's available as an origin trial starting in Chrome 149, and locally behind the chrome://flags/#enable-webmcp-testing flag. The Chrome WebMCP documentation was last updated in October, and the imperative API page was updated on November 26.
Other browsers haven't committed. The web-features explorer entry for document.modelContext lists the feature as limited availability, and records WebKit's standards position as opposed and Mozilla's as neutral. So you should treat this as a Chrome-only progressive enhancement for the foreseeable future, not as part of the web platform you can count on.
What changed this year
If you read about WebMCP in the spring, a lot of what you read is wrong now. Three changes matter.
The entry point moved from navigator to document. Early drafts and early origin-trial builds used navigator.modelContext. The current spec defines modelContext on Document, every example in Chrome's docs uses document.modelContext, and the web-features entry for the navigator version now redirects to the document one. A July post on DEV reports that the navigator version was deprecated in Chrome 150. Making it per-document makes sense: tools belong to the page that registered them, and each iframe has its own.
provideContext() and clearContext() are gone. Early versions had a method to replace the page's whole tool set in one call. The current spec has only registerTool(), and that same DEV post traces the removal to a spec issue. If a tutorial tells you to call provideContext, it predates the change.
There is no unregisterTool(). You unregister a tool by aborting an AbortSignal that you passed when you registered it. More on that below, because it's a nice design once you see it.
Chrome's docs also list features tied to specific versions: tools can be unregistered without cancelling calls already in progress from Chrome 153, JSON-string inputs to executeTool() are deprecated from 155, a debugging annotation arrives in 156, outputSchema in 159, and waitForToolsUntil() in 160. The web-features explorer currently lists 158 as the latest stable Chrome, so the last two aren't on stable yet as I write this.
The imperative API
Most of the time you'll register tools from JavaScript. The method is document.modelContext.registerTool(tool, options), and it returns a promise.
Here's a real example. This site has a search index for tutorials and blog posts. I want an agent to be able to search it the same way a reader does, so it can answer "find me an intermediate tutorial about React Server Components" without clicking through the search page.
async function registerSearchTool(signal) {
if (!document.modelContext) return; // not supported: do nothing
await document.modelContext.registerTool(
{
name: 'search_tutorials',
title: 'Search tutorials',
description:
'Search LearnWebCraft tutorials and blog posts by keyword. ' +
'Returns up to 5 results with title, URL, category, level and reading time.',
inputSchema: {
type: 'object',
properties: {
query: {
type: 'string',
description: 'Keywords, for example "react server components"',
},
level: {
type: 'string',
enum: ['Beginner', 'Intermediate', 'Advanced'],
},
},
required: ['query'],
},
annotations: { readOnlyHint: true },
async execute({ query, level }) {
const hits = await searchIndex(query);
const filtered = level ? hits.filter((t) => t.level === level) : hits;
return JSON.stringify({ results: filtered.slice(0, 5) });
},
},
{ signal },
);
}
Let's go through the descriptor field by field, because each one does real work.
name is the identifier the agent uses to call the tool. The spec restricts it to 1 to 128 characters of ASCII letters, digits, underscores, hyphens and dots. Pick something a model can guess from context. search_tutorials is better than st or doSearchV2.
title is a human-readable label. It's optional and is meant for interfaces that show the user which tool is running.
description is the most important field, and the one people put the least effort into. It's the only thing the model reads to decide whether this tool is the right one for the job. Say what the tool does, what it returns and any limits. Treat it like a docstring for a colleague who can't see your code.
inputSchema is a JSON Schema describing the arguments. The agent uses it to build a valid call, and the browser validates against it. Add a description to each property; it's where you put examples and units.
annotations are hints about how the tool behaves. All of them default to false. readOnlyHint says the tool doesn't change anything. consequentialHint says it does something significant or hard to reverse, like placing an order. untrustedContentHint says the output may contain content from untrusted sources, like user comments. We'll come back to these in the security section, because they matter more than they look.
execute is the function. It receives the input object and an options object with an AbortSignal in it. It can be async. You return the result for the agent, and the browser hands it back to the model. I return a JSON string, which works everywhere today; from Chrome 159, you can also declare an outputSchema and return structured data that agents can validate.
Registration can fail. The spec rejects the promise with an InvalidStateError if the name is already taken or invalid, or if the name or description is empty, and with a NotAllowedError if the page isn't allowed to use the feature (more on that under permissions). Await it, or at least attach a .catch, so a bad registration doesn't turn into an unhandled rejection.
Unregistering with an AbortSignal
The second argument to registerTool takes a signal. When that signal aborts, the tool is unregistered. That's the whole API for removal:
const controller = new AbortController();
await registerSearchTool(controller.signal);
// later, when the search feature is no longer on screen:
controller.abort();
I like this design. One controller can own all the tools for a feature or a route, and aborting it removes them together, so you can't forget one. It also maps cleanly onto patterns we already use for fetch and event listeners. Note one subtle thing from the spec: unregistering doesn't cancel a call that's already running. If an agent called the tool a second ago, that call finishes. If you need to cancel in-flight work too, check the signal passed to execute.
Watching what agents do
document.modelContext is an EventTarget. Three events are useful:
document.modelContext.addEventListener('toolchange', () => {
// a tool was registered or unregistered
});
document.modelContext.addEventListener('toolactivated', (e) => {
console.log('agent started', e.toolName);
});
document.modelContext.addEventListener('toolcancel', (e) => {
console.log('agent cancelled', e.toolName);
});
toolactivated is the one I'd use. Show something in your interface when an agent is acting on the user's behalf. Users should never wonder why the page just changed by itself.
Type-checking WebMCP tools in TypeScript
The Web Machine Learning group publishes TypeScript definitions as the webmcp-types package. I tested version 0.2.1, the latest as I write this, and I recommend it even if you don't use TypeScript in the rest of your project, because it catches mistakes in the place you're least likely to test: the boundary between your schema and your function.
The clever part is that it infers the type of the execute argument from the inputSchema you write. Declare query as a required string and level as an enum, and inside execute the editor knows query is a string and level is 'Beginner' | 'Intermediate' | 'Advanced' | undefined.
I tested this by putting the search tool above, plus a second "add to reading list" tool, into a file and running it through tsc --strict with TypeScript 6.0.3 against the package's index.d.ts. Both type-checked cleanly. Then I added a deliberately wrong tool:
document.modelContext?.registerTool({
name: 'x',
description: 'y',
inputSchema: {
type: 'object',
properties: { n: { type: 'number' } },
required: ['n'],
},
execute({ n }) {
const s: string = n;
return s;
},
});
And got:
tools.ts(56,28): error TS2322: Type 'number' is not assignable to type 'string'.
That's exactly the error you want. If you later change the schema from number to string and forget the function, the compiler tells you.
The comments in the package mention one quirk worth knowing. If your execute takes no parameters, TypeScript checks it before it infers the output schema, so literal return values get widened and may be rejected. Declaring the input parameter, even if you don't use it, avoids that.
Also note how the types declare the entry point: document.modelContext is optional, typed as possibly undefined. That's correct, and it forces you to feature-detect, which you must do anyway.
The declarative API: tools from HTML forms
The second API needs no JavaScript at all. Chrome lets you turn an existing <form> into a tool by adding attributes. This part is in Chrome's declarative API documentation, not in the current spec draft, so it's the more experimental of the two.
Here's a newsletter sign-up form turned into a tool:
<form
action="/newsletter"
method="post"
toolname="subscribe_newsletter"
tooldescription="Subscribe an email address to the weekly LearnWebCraft newsletter."
>
<label for="email">Email address</label>
<input id="email" name="email" type="email" required />
<label for="topic">Main interest</label>
<select id="topic" name="topic" toolparamdescription="The topic the reader cares about most">
<option value="react">React</option>
<option value="css">CSS</option>
<option value="ai">AI</option>
</select>
<button type="submit">Subscribe</button>
</form>
toolname and tooldescription on the form register it as a tool. Remove either attribute and the tool is unregistered. The browser builds the input schema from the form controls: a required input becomes a required property, and a <select> becomes a string with an enum of its option values.
Each parameter needs a description, and the browser looks for one in a sensible order. It uses toolparamdescription if you set it, otherwise the text of the control's <label>, otherwise aria-description. So a form that's already accessible is most of the way to being a good tool. I found that genuinely encouraging: the work you did for screen reader users pays off again.
What happens when an agent calls a form tool
By default, the browser focuses the form and fills in the fields, and then stops. The form stays visible, and the user has to click Submit. That's a good default. The person sees exactly what the agent is about to send and makes the final decision.
If you add the toolautosubmit attribute, the browser submits the form itself after filling it. Use that only for forms where submitting is harmless, like a search box.
Two CSS pseudo-classes let you style the form while an agent is filling it in. :tool-form-active matches the form, and :tool-submit-active matches its submit button:
form:tool-form-active {
outline: 2px solid var(--accent);
outline-offset: 4px;
}
button:tool-submit-active {
animation: pulse 1s ease-in-out infinite;
}
I'd do this on every declarative tool. It's a cheap way to show "an agent filled this in, please check it".
Returning a result to the agent
A normal form submission navigates to a new page, which doesn't give the agent much to work with. Chrome adds two things to SubmitEvent for this. agentInvoked is true when the submission came from an agent. respondWith() takes a promise, and whatever it resolves to is sent back to the model as the tool's result. You call preventDefault() first:
form.addEventListener('submit', (e) => {
if (!e.agentInvoked) return; // a person clicked; let it submit normally
e.preventDefault();
e.respondWith(
fetch(form.action, { method: 'POST', body: new FormData(form) })
.then((r) => (r.ok ? 'Subscribed.' : `Failed with status ${r.status}.`)),
);
});
The human path is unchanged. Only the agent gets a short text answer instead of a page navigation.
Using it in React and Next.js
In a component-based app, tools usually belong to a feature that's on screen, so the natural home is an effect. Register on mount, abort on unmount:
'use client';
import { useEffect } from 'react';
export function TutorialSearchTools() {
useEffect(() => {
if (!document.modelContext) return;
const controller = new AbortController();
registerSearchTool(controller.signal).catch((err) => {
console.warn('WebMCP registration failed', err);
});
return () => controller.abort();
}, []);
return null;
}
In Next.js this has to be a client component, because document doesn't exist during server rendering. Drop it into the layout of the routes where the tools make sense.
React's Strict Mode runs every effect twice in development (mount, clean up, mount again). With the abort pattern that's harmless: the cleanup aborts the first registration before the second one starts, so you don't hit the duplicate-name error. If you skip the abort, you'll see an InvalidStateError in development and spend twenty minutes wondering why.
You don't have to write this wrapper yourself. Chrome's docs point to small integrations for React (use-webmcp-tool), Angular, and Vue (a useWebMCP composable in @vueuse/core). I'd still read the twenty lines above before adopting one, so you know what it does on unmount.
Designing tools agents can actually use
Getting a tool registered is easy. Getting a model to use it well is the real work, and most of it is writing. Here's what I've settled on.
Expose tasks, not buttons. A tool called click_submit is useless. A tool called decode_jwt that takes a token and returns the header, payload and expiry is useful. Think about what a user would ask for in plain words, and make each tool answer one of those requests.
Keep the set small. Every tool you register is text the model has to read before it picks one. Five clear tools beat thirty overlapping ones. If two tools differ only by a flag, merge them and make the flag a parameter.
Return less than you think. The agent pays for every token you return, and long outputs crowd out the user's actual question. My search tool returns five results with five fields each, not the full article bodies. If the agent wants more, it can ask with another call.
Say what went wrong in plain words. When a call fails, return a message the model can act on, like "No tutorials matched 'reactt'. Try a different spelling." A thrown exception or an empty string gives it nothing to work with.
Mark read-only tools as read-only. It costs one line, and it lets the browser or agent skip confirmation prompts for safe actions, which makes the whole thing faster for the user.
Register tools where they make sense. A "checkout" tool on the blog page doesn't help anyone. Tools should match what the user can do on the current page, the same way the interface does.
Security: the part to read twice
WebMCP gives an AI model a way to run your code with your user's session. That deserves the same care as any other way of running code with your user's session. Here's what the spec and Chrome's docs provide, and what they leave to you.
The permission model
Tools only exist in secure contexts, so HTTPS only. Access is controlled by a tools Permissions Policy feature, which defaults to self. Cross-origin iframes can't register or call tools unless you explicitly grant it with allow="tools" on the iframe. If you embed third-party widgets and don't want them to expose tools on your page, the default already protects you. If you want to block the feature on your site entirely, send Permissions-Policy: tools=().
Sharing tools across origins needs consent from both sides. The page that registers a tool lists the origins allowed to see it in exposedTo. The page that wants to use tools from another origin lists the origins it trusts in fromOrigins when it calls getTools(). Neither side alone is enough.
What the permission model doesn't cover
The permission model controls which pages can talk to each other. It doesn't make the calls safe. Three risks remain, and they're yours to handle.
The first is prompt injection through your outputs. If a tool returns user-generated content, such as comments, reviews or forum posts, that content goes straight into the model's context. Anyone who can write a comment on your site can try to give instructions to every agent that reads it. Set untrustedContentHint: true on those tools so agents know to treat the output as data, and keep such outputs short. The OWASP entry on prompt injection is a good primer if this is new to you.
The second is consequential actions without a human in the loop. An agent can be wrong, and it can be manipulated. Anything that spends money, sends messages, deletes data or changes account settings should carry consequentialHint: true, which lets the browser or agent require confirmation. For the most sensitive actions, don't rely on a hint at all. Make the tool prepare the action and let the user confirm it in your own interface. For forms, that's simply the default: leave off toolautosubmit.
The third is that your server can't tell who clicked. A request triggered by a tool looks exactly like a request triggered by the user, because it uses the same session. So every authorization check must already be on the server, where it should be anyway. If your API trusts the client to only send allowed actions, WebMCP makes that bug much easier to reach. Chrome's docs add one more warning worth repeating: browser extensions' content scripts can see and call WebMCP tools too. Don't register anything you wouldn't be comfortable with an extension calling.
A simple test I use: if this tool were a public button on the page that anyone could click as many times as they liked, would I be fine with that? If yes, it's probably fine as a tool. If no, it needs a confirmation step or it shouldn't be a tool.
Testing it today
You can try all of this now without waiting for other browsers.
Turn on chrome://flags/#enable-webmcp-testing and relaunch Chrome. That gives you document.modelContext on any page you serve locally. For real users, register your origin for the WebMCP origin trial and add the token to your pages.
To see and call your tools, install the Model Context Tool Inspector extension. It lists the tools on the current page, lets you run them by hand with JSON input, and lets you try natural-language prompts against them. The prompt feature needs a Gemini API key. Chrome DevTools can also show registered tools and flag JSON Schema problems.
For examples, Google's webmcp-tools repository has several demos, including a React flight search and a declarative form-based restaurant booking, plus an example agent extension that can talk to different model providers. If you work on browsers, the shared web platform tests for WebMCP show what's actually implemented.
Because tools are just functions, you can unit-test the execute callbacks directly without a browser or a model. That's where I'd put most of the testing effort. The integration with the browser is thin; your function's behavior on odd input is where the bugs will be.
Should you ship it now?
My honest take: it depends on what kind of site you run.
If you run an app where users do repetitive tasks, like booking, searching with filters, filling in long forms or managing records, I'd start experimenting now. Users are already pointing agents at sites like yours, and those agents are already clicking through your interface by guessing. A handful of well-described tools makes that faster and much less error-prone, and the declarative API means some of it is a few attributes on forms you already have.
If you run a content site, like this one, the benefit is smaller. Agents already read articles well. Search and a few utility tools are worth exposing; the rest isn't.
In every case, treat it as progressive enhancement. Feature-detect document.modelContext, register nothing if it's missing, and never make a feature depend on it. With only one browser shipping, an origin trial that will end, and the API still moving (it changed its entry point and dropped two methods this year alone), you should write the integration so it's cheap to change. Keep the tool logic in plain functions your interface already calls, and keep the WebMCP registration layer thin. Then when the API changes again, you edit one file.
What I wouldn't do is wait for a finished standard before thinking about it. The work that makes WebMCP tools good is work that makes your site better anyway: clear labels on forms, functions with one job, server-side authorization on every action, and output that's short and accurate. If you do that now, registering the tools later is the easy part.
If you're building AI features that run in the user's browser more broadly, our guide to Chrome's built-in AI APIs covers the on-device model side, and our Vercel AI SDK guide covers tool calling from your own server.
Sources and further reading
- WebMCP draft specification (W3C Web Machine Learning Community Group, draft of November 24, 2026)
- Chrome: WebMCP overview, imperative API and declarative API
- Intent to Experiment thread on blink-dev
- web-features explorer:
document.modelContext webmcp-typeson npm- GoogleChromeLabs/webmcp-tools demos and example agent
- Model Context Protocol documentation
Frequently asked questions
Is WebMCP the same as the Model Context Protocol?
No. WebMCP borrows MCP's concept of a tool with a name, description and input schema, but it's a browser JavaScript API, not a network protocol. Tools run inside a web page with the user's session. An MCP server is a separate process that clients connect to over stdio or HTTP.
Is it navigator.modelContext or document.modelContext?
document.modelContext. Early drafts and early origin-trial builds used navigator.modelContext, but the current spec and Chrome's documentation define it on the document. Code that uses the navigator version is out of date.
Which browsers support WebMCP?
As of November 2026, only Chrome, through an origin trial that started in Chrome 149 and a local testing flag. Other browser engines haven't committed to it, so always feature-detect and treat it as an optional enhancement.
Do I need a backend or an API key?
No. Tools are JavaScript functions on your page. They can call your existing APIs with the user's session, the same way your interface does. You only need an API key if you want to test with an agent that uses a hosted model, such as the Model Context Tool Inspector's prompt feature.
Can WebMCP tools help my SEO?
Not directly. Search engines don't rank pages on registered tools. It helps the growing number of users who browse with an AI agent, and the groundwork it needs (accessible forms, clear labels, structured functions) is good for search and accessibility anyway.