Guide : WebMCP

WebMCP lets a web page expose structured outils to an AI agent in le navigateur. Apprendre how it differs from MCP, ce que Chrome supports, security risks, and quand to wait.

Première publication : 17 juil. 2026 · Dernière mise à jour : 3 août 2026 · Advanced
Langues
1 indice probant sur cette page

WebMCP is an experimental navigateur API que lets an ouvrir web page offer structured outils to an AI agent. It is utile pour bounded page actions, pas web discovery or rankings. As of July 17, 2026, it is a Community Groupe draft and Chrome 149 origin trial; current Chrome exemples utiliser document.modelContext, pendant que navigator.modelContext is deprecated in Chrome 150.

TL;DR — WebMCP exposes page-owned outils from document.modelContext to an agent in the active browsing context. The imperative API registers a nom, description, JSON Schema input, annotations, and an async callback; outils peut be state-dependent and unregistered with an AbortSignal. Chrome documents a declarative formulaire couche aussi, but the July 10, 2026 Community Groupe draft encore étiquettes its declarative section TODO. The fonctionnalité is in a Chrome 149 origin trial, pas a stable cross-browser baseline. Treat it as progressive enhancement, pas SEO infrastructure, and secure it as an authenticated application surface.

Evidence for this claim Chrome documents declarative form annotations such as toolname and tooldescription, but the declarative section of the July 10, 2026 Community Group draft is still marked TODO. Scope: secure browser context Confidence: high · Verified: WebMCP Draft Community Group Report

How WebMCP fonctionne in le navigateur

A utile WebMCP lifecycle begins and ends with lune page. Lune page registers seulement the actions que are valid in its current state; an agent déjà operating in que browsing context discovers and invokes un; lune page executes its normal application logic, updates the human-visible interface, and renvoie a bounded result. Quand the state changements, lune page removes outils que ne … plus appliquer. 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 ·

Ce stateful lifecycle is un raison WebMCP ne doit pas become a static dump of every function in a JavaScript bundle. A outil que is impossible in the visible UI devrait normally be unavailable to the agent aussi.

WebMCP vs MCP: two différent runtime boundaries

The noms invite confusion, but the operational boundary is différent. WebMCP lives in a document’s event loop and current navigateur session. Remote MCP 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 ·

InterfaceOù it livesQuand it is découvertPage doit be ouvrir?Meilleur fit
WebMCPActive navigateur documentAprès the client visits lune pageYesCurrent UI state and page actions
Remote MCPAI client and an MCP serverVia client/server configuration or discoveryAucunPersistent outils, données, and backend workflows
Web/API endpointApplication backendVia application-specific integrationAucunStable programmatic accès pour connu consumers
Données structuréesPage markupDuring page processingUsually récupéré as contentDescribing entities and page meaning, pas executing actions
llms.txtStatic text fichierQuand a client chooses to requête itAucun active tab requisProposed content guidance; pas a callable outil surface
Navigateur automationAgent/controller interpreting the UIAprès chargement and inspecting lune pageYesFallback où aucun explicit page outil exists

Ne faites pas choisir from the acronym. Choisir from the owner of the action. Si the action nécessite the current DOM, selection, cart, or UI state, WebMCP may fit. Si it doit run in the background, à travers nombreux sites, or sans an ouvrir tab, utiliser an API or remote MCP.

The imperative API

The imperative API registers a outil via document.modelContext.registerTool(). The outil inclut a unique nom, description, JSON Schema input, an execute callback, and optional annotations. Chrome aussi documents getTools(), executeTool() pour 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

Ce illustrative candidate montre the intended shape pour a future Schema Validator pilot. It n’est pas running on ce site, and the API may modifier avant 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 n’est pas the wrapper. It is que the callback calls the même validator as the visible UI, server-side limites and authorization encore appliquer, and la réponse is deliberately minimized. Fonctionnalité detection preserves the complet human workflow in unsupported navigateurs.

Utiliser document.modelContext, pas stale exemples construit autour navigator.modelContext; Chrome marks the latter deprecated beginning in Chrome 150. Date que advice parce que the fonctionnalité remains experimental.

Evidence for this claim Current Chrome documentation uses document.modelContext; navigator.modelContext is deprecated in Chrome 150. Scope: browser document Confidence: high · Verified: WebMCP Imperative API

The declarative API has a standards mismatch

Chrome documents a declarative approach que annotates ordinary formulaires with attributes tel as toolname, tooldescription, and toolparamdescription. It aussi documents optional toolautosubmit; sinon, the utilisateur 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

Cependant, the July 10 Community Groupe Report dit its Declarative WebMCP section is “entirely a TODO” and leaves the form-to-JSON-Schema algorithm undefined. Que ne fait pas mean Chrome’s experiment is imaginary. It signifie the implementation documentation is ahead of the normative draft. Treat declarative markup as an experimental Chrome surface, pas settled cross-browser HTML.

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

Pour now, ordinary semantic formulaires remain the durable base. An experimental annotation couche devrait enhance les, jamais replace étiquettes, validation, accessibility, confirmation, or server-side authorization.

Outil discovery, lifecycle, and cross-origin boundaries

The current API has several boundaries worth designing explicitly:

  • Browsing context: Chrome’s experiment exige a navigateur context. The client visits le site avant it discovers le site’s outils.
  • Dynamic availability: register outils quand ils are valid and abort leur registration quand state or navigation invalidates les. Observers peut listen pour toolchange.
  • Même origin by par défaut: the tools Permissions Policy defaults to 'self'. Cross-origin iframes besoin explicit delegation tel as allow="tools".
  • Two-sided cross-origin consent: a outil peut utiliser exposedTo to liste allowed secure origins, pendant que a caller requêtes outils from named origins with fromOrigins. Un side opting in n’est pas suffisant.
  • Progressive enhancement: unsupported or disabled WebMCP doit leave the ordinary page entièrement usable.
Evidence for this claim WebMCP tool exposure is origin-isolated and controlled by the tools Permissions Policy; cross-origin iframes require explicit delegation. Scope: browser document Confidence: high · Verified: WebMCP Imperative API

Ces are utile platform contrôle, but ils ne faites pas turn a risky application action into a safe un.

Security: le navigateur session raises the stakes

A navigateur agent may operate à l’intérieur the user’s authenticated session. Que peut be the fonctionnalité—accès to the current cart, account, or workspace—and the danger. Chrome and the draft discuss prompt injection, misleading outil metadata, contaminated outil 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 outil as a public application endpoint with an unusual caller:

  1. Garder the outil narrow. Un job, explicit inputs, tight enums and lengths, aucun hidden “do anything” parameter.
  2. Enforce authorization in application logic. The agent ne fait pas gain plus authority que the signed-in utilisateur, and a hint n’est pas permission.
  3. Separate reads from writes. readOnlyHint and untrustedContentHint communicate risk; ils ne faites pas enforce it.
  4. Exiger visible confirmation pour consequences. Purchases, submissions, deletions, messages, and account changements besoin a human-understandable checkpoint.
  5. Minimize output. Retourner seulement ce que the task nécessite; jamais spill session données, raw headers, secrets, or unrelated records.
  6. Treat output as untrusted. A string renvoyé by un outil peut become input to plus tard model reasoning. Ne faites pas autoriser it to smuggle instructions or authority.
  7. Log the boundary. Record the outil, input class, authorization decision, confirmation, result class, error, origin, and lifecycle sans logging secrets.

The safe question n’est pas “Can an agent call this?” It is “Voudrait I expose ce as a reviewed endpoint to a caller que peut misunderstand instructions and relay untrusted text?”

Tester 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 Les deux matter:

Deterministic tests devrait vérifier registration, schema rejection, valid and invalid inputs, authorization, rate limites, side effects, error shape, output minimization, UI parity, unregister behavior, and unsupported-browser fallback.

Probabilistic evals devrait mesurer si representative agents découvrir the correct outil, éviter irrelevant outils, choisir the correct parameters, demander pour clarification quand requis, respect confirmations, arrêter après success, and resist adversarial descriptions or output.

Ne faites pas utiliser un demo prompt as the release gate. A successful callback proves the code ran; it ne fait pas prove que models select it reliably or que the action is safe.

Cloudflare Navigateur Run: utile lab, pas enablement

Cloudflare documents WebMCP prise en charge in Navigateur Run’s experimental lab pool and dit lab sessions ne doit pas be utilisé pour production workloads. Its April 23 page aussi contient older Chrome-era testing noms, so utiliser que page as evidence of Cloudflare’s current product offering—pas as the authority pour 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 peut provide a navigateur session and an agent chemin que consumes outils. It ne peut pas infer the safe contract pour votre application or register page-owned outils vous did pas construire.

Proposed patrickstox.com pilot: Schema Validator

The Balisage de données structurées Validator is a bon future pilot candidate, pas a live WebMCP implementation. It déjà has a bounded pasted input, deterministic logic, structured problèmes, and a visible result. A future validate_schema outil pourrait reuse the même validation engine as the UI and the existing remote MCP outil suite.

The pilot devrait wait jusqu’à le navigateur API reaches a stable, non-experimental release and passes a fresh security examiner. The premier version devrait be read-only, feature-detected, input-limited, response-minimized, and unavailable on preview, admin, or owner-only surfaces. Ce site fait pas currently claim WebMCP prise en charge.

Decision: construire, experiment, wait, or skip

SituationDecision
Stable navigateur prise en charge is requis pour a customer workflowWait and garder the normal UI/API complet
Vous have a bounded read-only action and peut run a private labExperiment, with fonctionnalité detection and aucun production dependency
The task nécessite background or headless executionUtiliser an API or remote MCP
Lune page seulement publishes contentSkip WebMCP; améliorer semantic, accessible HTML
The action writes, purchases, submits, deletes, or exposes private donnéesNe faites pas pilot casually; exiger a separate threat model and confirmation design
A stable implementation ships and tout contract/security/parity tests réussirConsidérer 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.