What is WebMCP?
WebMCP is a proposed web standard that lets a web page offer tools to AI agents. A tool is a named action with a description and a list of inputs, such as search_products or get_order_status, and an agent in the browser can call it directly. A page registers them with document.modelContext in JavaScript, or by adding a toolname attribute to an HTML form.
Updated
The problem it solves
An AI agent using a website today has to work the page out from what is on screen. It guesses which box is the search, which number is the price and whether the button it clicked did anything. Those guesses are often wrong.
With WebMCP, the page lists what it can do. Each tool has a description the agent reads and a schema for its inputs. The agent picks a tool, calls it and gets a result back as text or JSON.
How it works
There are two ways for a page to offer a tool.
In JavaScript
The page calls document.modelContext.registerTool() with a name, a description, a JSON Schema for its input and an execute function. When an agent calls the tool, the browser runs that function on the page and hands back what it returns.
document.modelContext.registerTool({
name: "search_products",
description: "Search the product catalogue and return matching products with prices.",
inputSchema: {
type: "object",
properties: { query: { type: "string", description: "What to search for" } },
required: ["query"]
},
annotations: { readOnlyHint: true },
async execute({ query }) {
const results = await searchCatalogue(query);
return { content: [{ type: "text", text: JSON.stringify(results) }] };
}
});In HTML
A form becomes a tool when it gets a toolname and a tooldescription. Its fields become the tool's inputs. The agent fills them in. With toolautosubmit the form submits itself; without it, the person presses the button.
<form toolname="find_store"
tooldescription="Find the nearest store to a postcode and return its address and opening hours."
action="/stores" method="get">
<input name="postcode" type="text" required>
<button type="submit">Find</button>
</form>Setting it up, testing it and turning it on for visitors are covered in How to add WebMCP to your site.
Where it runs today
Only in Chrome for now, in two ways:
- For you, with the flag
chrome://flags/#enable-webmcp-testingturned on. - For your visitors, from Chrome 149, once your site joins the WebMCP origin trial and adds its token.
Chrome only offers WebMCP on HTTPS pages. On plain HTTP, document.modelContext doesn't exist. Tools in an iframe from another origin only work if the page allows it with allow="tools".
Some early examples use navigator.modelContext, an older name. Chrome only has document.modelContext, so tools registered on navigator aren't visible to agents.
Who is behind it
WebMCP is being developed by the W3C Web Machine Learning Community Group, with authors from Microsoft and Google. Its terms come from the Model Context Protocol. The WebMCP vs MCP guide explains how the two differ.
Common questions
- Where does the name WebMCP come from?
- From the Model Context Protocol (MCP). WebMCP borrows its vocabulary (tools, input schemas, results) and brings it to web pages as a browser API.
- Is WebMCP a standard yet?
- Not yet. It is a proposal from the W3C Web Machine Learning Community Group, written by people at Google and Microsoft. Chrome has it behind a flag, and in an origin trial since Chrome 149.
- Which browsers support WebMCP?
- Chrome, behind the "WebMCP for testing" flag or on sites that have joined the origin trial. Chrome only offers it on secure (HTTPS) pages.
- Do I need a server to use WebMCP?
- No. Tools are JavaScript functions on your page, or HTML forms with a toolname attribute. They run in the visitor’s browser, logged in as the visitor, and can use the code your page already has.
- How do I check whether a site supports WebMCP?
- Scan it with Test WebMCP. It loads the page in Chrome with WebMCP on, lists the tools the page registers, calls the read-only ones and scores the page out of 100.