WebMCP is a browser API proposal that lets web pages expose JavaScript functions as structured tools to AI agents. Built on top of the Model Context Protocol, it replaces DOM scraping and screenshot-based interaction with explicit document.modelContext.registerTool() calls, giving agents named tools with JSON Schema inputs and same-origin scoping by default.

In Plain Words

Until WebMCP, an AI agent driving a website had two choices. It could read the rendered DOM and try to figure out which button does what, or it could screenshot the page and ask a vision model to predict where to click. Both are brittle. Both break the moment the page redesigns a tooltip.

WebMCP flips the contract. The page itself declares: 'I expose these tools. Each takes these inputs. Call them like functions.' The agent stops guessing. It calls addToCart({ sku: 'A123', qty: 2 }) the same way it would call a remote MCP server, except the implementation runs inside the page that the user is already authenticated to.

How It Works

A page registers tools through document.modelContext. Each tool has a name, a natural-language description, an optional JSON Schema for its inputs, and an execute callback that runs in the page's own JavaScript context. registerTool() returns a promise, and passing an AbortSignal in its options unregisters the tool when the signal aborts.

await document.modelContext.registerTool({
  name: "addToCart",
  description: "Add a product to the user's shopping cart.",
  inputSchema: {
    type: "object",
    properties: {
      sku: { type: "string" },
      quantity: { type: "integer", minimum: 1 }
    },
    required: ["sku"]
  },
  async execute({ sku, quantity = 1 }) {
    return await cart.add(sku, quantity);
  }
});

An agent connected to the browser (a sidebar assistant, an extension, a desktop client) discovers the registered tools, picks one, and invokes it. The page handles auth, validation, and rendering. The agent never touches the DOM.

A declarative form variant is being explored separately: HTML attributes like toolname and tooldescription on a <form> element would let the browser synthesize a tool from existing markup. It was taken out of the spec in October 2026 and now lives in its own explainer, so only the JavaScript API is specified today.

Security Model

Tool exposure is gated by a Permissions Policy feature named tools, which defaults to 'self'. Tools are visible only to same-origin documents by default. Crossing origins needs a three-way opt-in: the embedder delegates allow="tools" to the iframe, the registering page lists the caller in exposedTo, and the caller names the provider in fromOrigins. Sites that never use WebMCP can switch it off with Permissions-Policy: tools=().

  • Read-only hint: readOnlyHint declares that a tool only reads data, which helps agents decide when a call is safe.
  • Untrusted content hint: untrustedContentHint flags output the page itself does not trust, so the agent can sanitize it or treat it as data rather than instructions.
  • Consequential hint: consequentialHint marks tools with real-world or irreversible effects, like booking a flight or moving money, so the agent can require the user's confirmation first.

Why It Matters

Agent reliability on the web is mostly bottlenecked by interface drift. A pixel-driven agent that books a flight today might fail tomorrow because the airline moved a button two columns over. WebMCP makes the contract structural instead of visual, so the surface that the agent depends on is the same surface the developer maintains intentionally.

It also reuses the trust boundary the user already established. The agent runs in the open tab where the user is logged in, with that origin's cookies and CSP. There is no separate OAuth dance to wire an agent into a SaaS account: the user's session is the credential.

WebMCP vs MCP

Both share a tool-and-schema vocabulary. The difference is where the tool runs.

MCPWebMCP
Tool hostStandalone server (local or remote)The web page itself
Auth modelServer credentials, OAuth, API keysUser's existing browser session
Transportstdio or HTTPIn-process via document.modelContext
DiscoveryConfigured per agentAnnounced by the active tab
Best forBackend APIs, local tools, IDEsLogged-in web apps, in-tab workflows

Origin

WebMCP is incubated by the W3C Web Machine Learning Community Group, with the initial proposal driven by engineers at Google and Microsoft. The first Draft Community Group Report landed on 20 May 2026. Chrome runs an origin trial from Chrome 149, Edge has one from Edge 150, and local testing works behind about:flags#enable-webmcp-testing. It is not yet on the W3C standards track, so the API surface is still moving: the getter moved from navigator to document in May 2026, and the requestUserInteraction() confirmation call was dropped in June.

See the editor's draft at webmachinelearning.github.io/webmcp for the current shape of the spec.