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 guessing from pixels and clicks, the page publishes named actions with schemas. The specification says such pages can be thought of as client-side MCP servers.

Draft Community Group Report Draft dated Oct 16, 2026 W3C Web Machine Learning CG Editors from Microsoft & Google
CONCEPTS

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.

STATUS

What is shipping, and what is still experimental

The imperative API is the current specification: document.modelContext.registerTool(), discovery, execution, cancellation, events, annotations and cross-frame exposure. Chrome 149 and Edge 150 list origin trials; ChatGPT Desktop lists WebMCP support. Browser support is still experimental and must be feature-detected.

Declarative HTML forms are a separate proposal: attributes such as toolname, tooldescription, toolparamdescription and toolautosubmit are not part of the normative specification today. The audit inventories this markup as experimental evidence but does not grade it as spec conformance.

THE API

The API in one look

Three methods on document.modelContext carry registration, discovery and invocation. Registration and execution each use an AbortSignal; toolchange, toolactivated and toolcancel expose lifecycle events.

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
install-tools.jsdocument.modelContext
async function installTools() {
const mc = document.modelContext;
if (!mc?.registerTool) return () => {};

const lifecycle = new AbortController();
await mc.registerTool({
  name: "search_products",
  title: "Search Products",
  description: "Search product catalog",
  inputSchema: {
    type: "object",
    properties: {
      query: { type: "string" },
      maxResults: { type: "number" }
    }
  },
  execute: async (input, { signal }) => {
    // Validate in code; schema is not authorization.
    const { query, maxResults = 10 } = validate(input);
    return search({ query, maxResults, signal });
  },
  annotations: {
    readOnlyHint: true,
    untrustedContentHint: true,
    consequentialHint: false,
    debugging: false
  }
}, { signal: lifecycle.signal });

return () => lifecycle.abort();
}

const disposeTools = await installTools();
// Later, on logout, route change or teardown:
// disposeTools();
CHECKLIST

Implementation checklist

  1. Serve the page in a secure context and feature-detect document.modelContext. Do not use the removed navigator.modelContext, provideContext() or unregisterTool() surfaces.
  2. Use stable 1–128 character names from A-Z a-z 0-9 _ . -; write a precise positive description and a real JSON Schema object.
  3. Validate every invocation inside execute. Respect its cancellation signal, update visible page state before resolving, and return a concise JSON-serializable value.
  4. Pass a registration AbortSignal and abort it when the tool is no longer valid. Register only tools that match the current route, role and signed-in state.
  5. Set all applicable annotations: readOnlyHint, untrustedContentHint, consequentialHint and debugging. They are hints, not access control.
  6. Keep cross-origin access narrow. The tools Permissions Policy defaults to self; pair any iframe grant with an exact exposedTo origin.
  7. Never put secrets in client code or tool metadata. Keep high-risk confirmation in a human-controlled UI and test valid, invalid, cancelled and repeated calls.
AUDIT METHODOLOGY

Three independent views, zero tool execution

PASS 1 · NATIVE OFF

What a normal browser sees

Loads without a forced WebMCP flag, reads native registrations, response headers, Permissions Policy and origin-trial tokens.

PASS 2 · NATIVE ON

What the integration could expose

Forces the experimental Blink feature and compares the result with pass 1. This separates a live deployment from code that is present but dark.

PASS 3 · CAPTURE HOOK

What the page authored

Installs a document-start recorder to retain legacy entry points, raw schemas, annotations and exposedTo before WebIDL normalizes them.

Also inventoried: all readable frames, experimental declarative-form attributes, iframe allow="tools" grants, redirects, HTTP status and resource budgets. Findings are deterministic and carry a field-level citation.

Agent readiness: four extra fetches (robots.txt, llms.txt, the sitemap, /.well-known/security.txt) and the page's head metadata feed a separate checklist that never affects the grade. Each check and its source.

Deliberate limits: the public audit never calls a tool, does not sign in, cannot prove that a description matches the hidden implementation, and observes one point in time after a fixed settle window. A clean report is not a certification and cannot cover authenticated states, user-only routes or behavior that appears after interaction.

THREAT MODEL

The spec's own warning label

The security section is guidance, not a page-author conformance class. We label findings derived from it SECURITY, not SPEC; only actual API requirements are reported as spec violations.

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