WebMCP

WebMCP lets a web page expose structured tools to an AI agent in the browser. Learn how it differs from MCP, what Chrome supports, security risks, and when to wait.

First published: Jul 17, 2026 · Last updated: Jul 20, 2026 · Advanced
1 evidence signal on this page

WebMCP is an experimental browser API that lets an open web page offer structured tools to an AI agent. It is useful for bounded page actions, not web discovery or rankings. As of July 17, 2026, it is a Community Group draft and Chrome 149 origin trial; current Chrome examples use document.modelContext, while navigator.modelContext is deprecated in Chrome 150.

TL;DR — WebMCP exposes page-owned tools from document.modelContext to an agent in the active browsing context. The imperative API registers a name, description, JSON Schema input, annotations, and an async callback; tools can be state-dependent and unregistered with an AbortSignal. Chrome documents a declarative form layer too, but the July 10, 2026 Community Group draft still labels its declarative section TODO. The feature is in a Chrome 149 origin trial, not a stable cross-browser baseline. Treat it as progressive enhancement, not SEO infrastructure, and secure it as an authenticated application surface.

How WebMCP works in the browser

A useful WebMCP lifecycle begins and ends with the page. The page registers only the actions that are valid in its current state; an agent already operating in that browsing context discovers and invokes one; the page executes its normal application logic, updates the human-visible interface, and returns a bounded result. When the state changes, the page removes tools that no longer apply. Evidence for this claim The imperative API registers named, described, schema-constrained callbacks and supports state-aware cleanup with AbortSignal plus tool-set change notifications. Scope: Current draft and Chrome experiment; API details may change before stable release. Confidence: high · Verified: WebMCP ModelContext API Chrome: WebMCP Imperative API

WebMCP tools should follow the page's real state: register a valid action, execute the same logic as the UI, and remove it when the action is no longer available. Source: Patrick Stox — WebMCP

Five numbered steps run left to right. First, the page registers a name, description, input schema, and callback. Second, an agent already in the page context discovers it. Third, the agent invokes it with validated structured arguments. Fourth, the page reuses its normal application logic and updates the visible interface. Fifth, it returns a bounded result or safe error. A branch from execution shows that state changes or navigation should unregister the tool with AbortSignal and notify observers through toolchange.

© Patrick Stox LLC · CC BY 4.0 ·

This stateful lifecycle is one reason WebMCP should not become a static dump of every function in a JavaScript bundle. A tool that is impossible in the visible UI should normally be unavailable to the agent too.

WebMCP vs MCP: two different runtime boundaries

The names invite confusion, but the operational boundary is different. WebMCP lives in a document’s event loop and current browser session. Remote MCPMCP is an open protocol, created and open-sourced by Anthropic in November 2024, that standardizes how AI applications connect to external tools and data at runtime. It runs on a host–client–server architecture and lets agents call functions, read data, and take actions — the opposite of a static file like llms.txt. lives at the AI application’s integration boundary and commonly reaches a persistent backend server. Evidence for this claim WebMCP is designed for tools owned by an active page and its browser context, while remote MCP commonly connects an AI application to a persistent backend server. Scope: Architecture-selection guidance, not a rule that prevents an application from using both technologies. Confidence: high · Verified: Chrome: When to use WebMCP and MCP

WebMCP owns page-context actions; remote MCP owns durable application-to-server integrations. Many products will use both. Source: WebMCP

The left lane shows WebMCP: a browser agent interacts with an open web page, which owns a JavaScript tool and current visible session state. The page must be open for those tools to exist. The right lane shows remote MCP: an AI application connects through an MCP client to a persistent MCP server, which can remain available outside a browser tab. The two lanes are complementary rather than replacements.

© Patrick Stox LLC · CC BY 4.0 ·

InterfaceWhere it livesWhen it is discoveredPage must be open?Best fit
WebMCPActive browser documentAfter the client visits the pageYesCurrent UI state and page actions
Remote MCPAI client and an MCP serverThrough client/server configuration or discoveryNoPersistent tools, data, and backend workflows
Web/API endpointApplication backendThrough application-specific integrationNoStable programmatic access for known consumers
Structured dataStructured data is a standardized way of labeling page content (using the schema.org vocabulary in JSON-LD, Microdata, or RDFa) so search engines can understand its meaning. It's not a direct ranking factor — its value is rich results and entity understanding.Page markupDuring page processingUsually fetched as contentDescribing entities and page meaning, not executing actions
llms.txtStatic text fileWhen a client chooses to request itNo active tab requiredProposed content guidance; not a callable tool surface
Browser automationAgent/controller interpreting the UIAfter loading and inspecting the pageYesFallback where no explicit page tool exists

Do not choose from the acronym. Choose from the owner of the action. If the action needs the current DOM, selection, cart, or UI state, WebMCP may fit. If it must run in the background, across many sites, or without an open tab, use an API or remote MCP.

The imperative API

The imperative API registers a tool through document.modelContext.registerTool(). The tool includes a unique name, description, JSON Schema input, an execute callback, and optional annotations. Chrome also documents getTools(), executeTool() for testing, and a toolchange event. Evidence for this claim Current Chrome documentation uses document.modelContext and says navigator.modelContext is deprecated beginning in Chrome 150. Scope: Chrome implementation guidance checked July 17, 2026; version and API-name claims expire quickly. Confidence: high · Verified: Chrome: WebMCP Imperative API

This illustrative candidate shows the intended shape for a future Schema Validator pilot. It is not running on this site, and the API may change before a stable release:

if (document.modelContext) {
  const registration = new AbortController();

  await document.modelContext.registerTool({
    name: 'validate_schema',
    description: 'Validate pasted JSON-LD and return bounded issues.',
    inputSchema: {
      type: 'object',
      properties: {
        markup: {
          type: 'string',
          description: 'JSON-LD markup to validate.',
          maxLength: 50000
        }
      },
      required: ['markup'],
      additionalProperties: false
    },
    annotations: {
      readOnlyHint: true,
      untrustedContentHint: true
    },
    execute: async ({ markup }) => {
      const result = await validateWithTheSameEngineAsTheUI(markup);
      renderResultInTheVisibleUI(result);
      return minimizeValidationResult(result);
    }
  }, { signal: registration.signal });

  // When this page state no longer supports validation:
  // registration.abort();
}

The important architecture is not the wrapper. It is that the callback calls the same validator as the visible UI, server-side limits and authorization still apply, and the response is deliberately minimized. Feature detection preserves the full human workflow in unsupported browsers.

Use document.modelContext, not stale examples built around navigator.modelContext; Chrome marks the latter deprecated beginning in Chrome 150. Date that advice because the feature remains experimental.

The declarative API has a standards mismatch

Chrome documents a declarative approach that annotates ordinary forms with attributes such as toolname, tooldescription, and toolparamdescription. It also documents optional toolautosubmit; otherwise, the user clicks Submit. SubmitEvent.agentInvoked identifies an agent-triggered submission. Evidence for this claim Chrome documents declarative WebMCP form annotations, but the July 10, 2026 Community Group draft says its Declarative WebMCP section is entirely TODO. Scope: A direct comparison between Chrome implementation documentation and the current draft; it does not imply Chrome's experimental implementation is unavailable. Confidence: high · Verified: Chrome: WebMCP Declarative API WebMCP: Declarative WebMCP

However, the July 10 Community Group Report says its Declarative WebMCP section is “entirely a TODO” and leaves the form-to-JSON-Schema algorithm undefined. That does not mean Chrome’s experiment is imaginary. It means the implementation documentation is ahead of the normative draft. Treat declarative markup as an experimental Chrome surface, not settled cross-browser HTML.

For now, ordinary semantic forms remain the durable base. An experimental annotation layer should enhance them, never replace labels, validation, accessibilityWeb accessibility means designing sites so people with disabilities can use them, per the W3C's WCAG guidelines. It overlaps with SEO in specific, checkable ways — alt text, heading structure, descriptive link text, captions, and page speed all serve both audiences — but Google has said accessibility itself is not a ranking factor, and most WCAG success criteria (keyboard focus order, ARIA live regions, form labels) have no SEO effect at all., confirmation, or server-side authorization.

Tool discovery, lifecycle, and cross-origin boundaries

The current API has several boundaries worth designing explicitly:

  • Browsing context: Chrome’s experiment requires a browser context. The client visits the site before it discovers the site’s tools.
  • Dynamic availability: register tools when they are valid and abort their registration when state or navigation invalidates them. Observers can listen for toolchange.
  • Same origin by default: the tools Permissions Policy defaults to 'self'. Cross-origin iframesHTML element that displays one webpage inside another — how embeds work. need explicit delegation such as allow="tools".
  • Two-sided cross-origin consent: a tool can use exposedTo to list allowed secure origins, while a caller requests tools from named origins with fromOrigins. One side opting in is not enough.
  • Progressive enhancement: unsupported or disabled WebMCP must leave the ordinary page fully usable.

These are useful platform controls, but they do not turn a risky application action into a safe one.

Security: the browser session raises the stakes

A browser agent may operate inside the user’s authenticated session. That can be the feature—access to the current cart, account, or workspace—and the danger. Chrome and the draft discuss prompt injection, misleading tool metadata, contaminated tool output, over-broad parameters, privacy leakage, cross-origin exposure, and misuse of signed-in authority. Evidence for this claim WebMCP tool hints can communicate read-only and untrusted-output intent, but they do not eliminate prompt injection, misleading metadata, privacy leakage, cross-origin risk, or misuse of authenticated browser authority. Scope: Threat-model and defensive guidance; application authorization and confirmation remain implementation responsibilities. Confidence: high · Verified: WebMCP security and privacy considerations Chrome: WebMCP tool security Chrome: Agent security considerations

Treat every tool as a public application endpoint with an unusual caller:

  1. Keep the tool narrow. One job, explicit inputs, tight enums and lengths, no hidden “do anything” parameter.
  2. Enforce authorization in application logic. The agent does not gain more authority than the signed-in user, and a hint is not permission.
  3. Separate reads from writes. readOnlyHint and untrustedContentHint communicate risk; they do not enforce it.
  4. Require visible confirmation for consequences. Purchases, submissions, deletions, messages, and account changes need a human-understandable checkpoint.
  5. Minimize output. Return only what the task needs; never spill session data, raw headers, secrets, or unrelated records.
  6. Treat output as untrusted. A string returned by one tool can become input to later model reasoning. Do not allow it to smuggle instructions or authority.
  7. Log the boundary. Record the tool, input class, authorization decision, confirmation, result class, error, origin, and lifecycle without logging secrets.

The safe question is not “Can an agent call this?” It is “Would I expose this as a reviewed endpoint to a caller that can misunderstand instructions and relay untrusted text?”

Test contracts and agent behavior separately

Chrome’s eval guidance separates deterministic product tests from probabilistic agent tests. Evidence for this claim WebMCP testing should combine deterministic contract and UI-state tests with probabilistic evaluation of agent tool selection and use. Scope: Chrome's evaluation guidance; teams must define product-specific tasks, models, risks, and thresholds. Confidence: high · Verified: Chrome: Evals for WebMCP Both matter:

Deterministic tests should verify registration, schema rejection, valid and invalid inputs, authorization, rate limits, side effects, error shape, output minimization, UI parity, unregister behavior, and unsupported-browser fallback.

Probabilistic evals should measure whether representative agents discover the right tool, avoid irrelevant tools, choose the correct parameters, ask for clarification when required, respect confirmations, stop after success, and resist adversarial descriptions or output.

Do not use one demo prompt as the release gate. A successful callback proves the code ran; it does not prove that models select it reliably or that the action is safe.

Cloudflare Browser Run: useful lab, not enablement

Cloudflare documents WebMCP support in Browser Run’s experimental lab pool and says lab sessions should not be used for production workloads. Its April 23 page also contains older Chrome-era testing names, so use that page as evidence of Cloudflare’s current product offering—not as the authority for the latest WebMCP API shape. Evidence for this claim Cloudflare Browser Run offers experimental lab sessions that can consume and test page-provided WebMCP tools, but the page still owns tool registration and Cloudflare says lab sessions are not for production workloads. Scope: Cloudflare product documentation last updated April 23, 2026; its example API names lag current Chrome documentation and should not be used as the API authority. Confidence: high · Verified: Cloudflare Browser Run: WebMCP

Cloudflare can provide a browser session and an agent path that consumes tools. It cannot infer the safe contract for your application or register page-owned tools you did not build.

Proposed patrickstox.com pilot: Schema Validator

The Schema Markup Validator is a good future pilot candidate, not a live WebMCP implementation. It already has a bounded pasted input, deterministic logic, structured issues, and a visible result. A future validate_schema tool could reuse the same validation engine as the UI and the existing remote MCP tool suite.

The pilot should wait until the browser API reaches a stable, non-experimental release and passes a fresh security review. The first version should be read-only, feature-detected, input-limited, response-minimized, and unavailable on preview, admin, or owner-only surfaces. This site does not currently claim WebMCP support.

Decision: build, experiment, wait, or skip

SituationDecision
Stable browser support is required for a customer workflowWait and keep the normal UI/API complete
You have a bounded read-only action and can run a private labExperiment, with feature detection and no production dependency
The task needs background or headless executionUse an API or remote MCP
The page only publishes contentSkip WebMCP; improve semantic, accessible HTML
The action writes, purchases, submits, deletes, or exposes private dataDo not pilot casually; require a separate threat model and confirmation design
A stable implementation ships and all contract/security/parity tests passConsider a progressive production pilot

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.