WebMCP imperative API: what the check tests and how to fix it

Tracked, not scored. Looks for document.modelContext or registerTool in inline scripts, up to five same-site scripts, or an origin-trial token. None: skip.

Agent Protocols · Tracked, not scored

How common is it?

4% of 1223 measured sites publish a passing result (observed adoption; this check does not change the score).

Latest audit of each site under rubric v3.1. A site with nothing published counts as not passing. A partial result does not count as a pass.

What this check tests

This is a tracked check: it does not change your score. Unlike WebMCP declarative, which reads form attributes, this one looks for JavaScript that registers tools. It has three sources of evidence.

  1. Inline scripts. On every crawled page (the homepage plus up to nine more) it reads each <script> without a src that is JavaScript, meaning no type, a JavaScript or module type, and not a Next.js flight payload. It tests the text with one pattern: document.modelContext or navigator.modelContext (optionally with ?.), the bracket form ["modelContext"], or modelContext.registerTool.
  2. External scripts, fetched only if no inline script matched. While reading pages it collects up to five distinct <script src> addresses on the same site: same scheme, same port, same host apart from a leading www.. Each is fetched with a 5-second limit, up to three same-site redirects, a 2xx status, a declared size under 256 KB and at most 256 KB read, then tested with the same pattern. A script on a CDN host, or on a subdomain like static., is never fetched.
  3. Origin-trial tokens. Each <meta http-equiv="origin-trial"> tag is decoded; if its payload names a feature matching webmcp or modelcontext, that counts. The signature, expiry and origin are not verified, and an Origin-Trial HTTP header is not read.

Any inline or external match, or a token, is a pass, 100. A token alone passes with a note that no registration code was found. Nothing found is a skip with score 0. It never fails, and it has no partial.

The pattern matches the text, not the behavior, and it also accepts navigator.modelContext, which the explainer and the Chrome pages above do not use. A feature check such as if (document.modelContext) matches even if you never register a tool, and a bundle that builds the property name at run time does not.

Why it matters to agents

WebMCP is a proposal from the W3C Web Machine Learning Community Group. Its README says the specification defines the imperative document.modelContext.registerTool() API, where a page registers a tool with a name, a description, a JSON Schema for input and an execute function, and the browser mediates calls from an agent. The group is clear that it is meant to complement backend protocols such as MCP, not replace them.

Support is early. Per the implementation status, an origin trial runs in Chrome 149 and Edge 150, ChatGPT Desktop is listed as supporting it, and Firefox and Safari list standards-position requests only. Google's guide says WebMCP is in active development and may change. No fetched source says that an assistant recommends or ranks sites for registering tools. The practical payoff today is for pages that people use through a browser agent, such as an app with a complex interface.

How to fix it

Only if your site has actions worth exposing. Register tools with feature detection, so other browsers are unaffected:

if ("modelContext" in document) {
  document.modelContext.registerTool({
    name: "add-todo",
    description: "Add an item to the user's todo list",
    inputSchema: {
      type: "object",
      properties: { text: { type: "string", description: "Item text" } },
      required: ["text"],
    },
    async execute({ text }) {
      await addTodo(text);
      return { content: [{ type: "text", text: `Added: ${text}` }] };
    },
  });
}
  • To be seen by this audit, keep the registration in an inline script, or in a script on your exact host (or its www. form) that is among the first five distinct same-site script addresses found across the crawled pages, in page order.
  • Follow Chrome's security guidance: mark risky tools with consequentialHint, and treat tool output that includes user content as untrusted.
  • To test in Chrome 149 or later, use the origin trial or the local-development flag in the implementation status. A trial token is added as a <meta http-equiv="origin-trial"> tag or an HTTP header; only the tag is seen here.

Server-side tools are a different mechanism: see MCP endpoint and MCP server card.

Examples from measured sites

Up to 10 of the highest-scoring sites in each group, from recent audits. Failing includes partial results.

Passing

Sources

Verified against these sources on

Does your site pass this check?

Check your own site →