EXPLAINER ยท /webmcp

What is WebMCP?

WebMCP is a JavaScript API that lets a web page expose its functionality as tools AI agents can call. Instead of an agent scraping your UI, your page tells it exactly what it can do. In effect, every page becomes a client-side MCP server.

Draft Community Group Report Published Aug 26, 2026 W3C Web Machine Learning CG Editors from Microsoft & Google

Four concepts to know

Tool

A JavaScript function with a natural language description and a JSON Schema for its inputs. Agents discover it, call it, and read its serialized result.

ModelContext

The registry of tools attached to every document, reached via document.modelContext. Register, list and execute tools through it.

Agent

An autonomous assistant acting on the user's behalf: built into the browser, an AI platform, or in-page JavaScript.

Observation

What a browser agent sees of the page: available tools, possibly with screenshots and the accessibility tree.

The API in one look

Three methods on document.modelContext carry the whole protocol:

registerTool() declare a tool with schema, execute callback, annotations and optional cross-origin exposure
getTools() list registered tools from the document and its frames
executeTool() invoke a tool and get its stringified result back
await document.modelContext.registerTool({
  name: "search_products",
  title: "Search Products",
  description: "Search product catalog",
  inputSchema: {
    type: "object",
    properties: {
      query: { type: "string" },
      maxResults: { type: "number" }
    }
  },
  execute: async ({ query, maxResults }) => {
    return { results: [ ... ] };
  },
  annotations: {
    readOnlyHint: true,
    untrustedContentHint: false
  }
});

The spec's own warning label

The security section of the draft reads like a pentester's checklist. These are the risks it names, and the ones our audit is built around:

Prompt injection

Malicious instructions in tool metadata or outputs manipulate the agent: metadata poisoning, output injection, attacks on tool implementations.

Misrepresented intent

A tool's description need not match its behavior. Authenticated tools can purchase, transfer or delete without explicit verification.

Privacy leakage

Over-parameterized input schemas quietly exfiltrate sensitive user data through tool parameters.

Origin boundary violations

Cross-origin access requires explicit exposedTo grants; the "tools" permissions policy defaults to same-origin only.

Shipping WebMCP tools?

Run them through the audit before an agent does it for you.

Audit my site