Complete WebMCP Implementation Guide for 2026

WebMCP lets AI agents — ChatGPT, Claude, Gemini, Copilot — read and interact with your website directly. A practical, code-first walkthrough of every API surface you need to ship an AI-ready page in 2026 (updated for the April 23, 2026 spec).

WebMCP is the client-side protocol that lets a browser expose site capabilities — forms, actions, data — directly to AI agents. Unlike server-side MCP (where the model connects to your backend), WebMCP runs in the page: whatever the user can do in their browser, an agent can do too, under the user's permissions and session. That's the whole unlock.

Spec update — May 2026: Reflects the W3C Community Group Draft Report published April 23, 2026. Microsoft Edge 147 now ships native WebMCP support; Chrome 149 is in an open Origin Trial (no longer Canary-only). The provideContext() / clearContext() methods from earlier drafts were removed in March 2026 — this guide uses the current registerTool() / unregisterTool() surface only.

This guide covers three implementation surfaces: the Declarative API (HTML attributes on existing forms), the Imperative API (navigator.modelContext), and the .well-known/webmcp manifest. Most sites only need the first two.

Step 1 — Audit what you already have

Before writing code, understand which actions on your site matter for agents. Good candidates: search, filter, add-to-cart, submit-contact, book-appointment, sign-up. Bad candidates: hover tooltips, carousel controls, cosmetic animations.

If you want a starting score, run the free audit — it will flag missing toolname attributes, absent .well-known/webmcp, and Imperative API gaps in under 15 seconds.

Step 2 — Declarative API (HTML form attributes)

The Declarative API is the fastest way to ship WebMCP. You add two attributes to an existing HTML <form>:

<form id="contact" toolname="contactSupport" tooldescription="Send a message to our support team. Use this when the user wants help with an order or account issue.">
  <input name="email" type="email" required>
  <textarea name="message" required></textarea>
  <button type="submit">Send</button>
</form>

The toolname is a camelCase identifier (think function name). The tooldescription is a sentence or two that tells the agent when to use this form, not what fields it has — those are inferred from name and type. Good descriptions dramatically improve discoverability.

Handling tool-initiated submissions server-side

When an agent submits the form, browsers set a SubmitEvent.agentInvoked flag. Use it for analytics, abuse detection, or to adjust UX — do not use it for authorization; that's the user's session, not the agent's.

Step 3 — Imperative API: navigator.modelContext

When your action isn't a form (a React modal, a Vue drawer, a custom stepper), use the Imperative API:

navigator.modelContext.registerTool({
  name: "addToCart",
  description: "Add a product to the shopping cart by SKU and quantity.",
  inputSchema: {
    type: "object",
    properties: {
      sku: { type: "string" },
      quantity: { type: "integer", minimum: 1, default: 1 }
    },
    required: ["sku"]
  },
  execute: async ({ sku, quantity }) => {
    const res = await fetch("/api/cart", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ sku, quantity })
    });
    return res.ok ? { success: true } : { success: false };
  }
});

Register tools after the view they belong to mounts, and unregisterTool() on unmount. Otherwise you expose tools the user can't actually see — a bad experience and a subtle abuse vector.

Step 4 — Encode page context in your tool descriptions

Earlier WebMCP drafts had a provideContext() method for passing page state to the agent — that method was removed in March 2026. The replacement pattern is to bake the relevant context directly into each tool's description, since descriptions are re-read every time the agent considers calling a tool. For example, on a product detail page:

navigator.modelContext.registerTool({
  name: "addToCart",
  description: `Add the currently displayed product (SKU sku-1234, Nike Pegasus 40, $129.99) to the user's cart.`,
  inputSchema: {
    type: "object",
    properties: {
      quantity: { type: "integer", minimum: 1, default: 1 },
      size: { type: "string", enum: ["8","9","10","11","12"] }
    }
  },
  execute: addToCartHandler
});

For richer page-level signals that don't fit in a tool description, use Schema.org JSON-LD (Product, Article, FAQPage) — agents read it during page parse and use it for disambiguation.

Step 5 — Ship the manifest

Serve a JSON manifest at https://yourdomain.com/.well-known/webmcp so crawlers (including WebMCP Checker) can discover your capabilities without JavaScript:

{
  "name": "Example Store",
  "description": "Online store for running gear.",
  "version": "1.0.0",
  "tools": [
    { "name": "searchProducts", "description": "Search the catalog." },
    { "name": "addToCart",       "description": "Add a product to the cart." }
  ]
}

Make sure the server returns Content-Type: application/json and doesn't 404 or redirect. That's one of the most common readiness checklist failures.

Step 6 — Test in Chrome Canary

WebMCP is available in Chrome 146 Canary behind a flag (chrome://flags#webmcp) as part of the Early Preview Program. Enable the flag, open DevTools → Application → WebMCP, and confirm your tools show up. Agents that implement the protocol will see the same list.

Common mistakes I see every week

Where to go next

If you want one page to hand to your team, our 42-page implementation PDF has React integration, industry playbooks, and a pre-launch checklist. For strategy, start with Agentic Engine Optimization (AEO). For the decision layer, read the WebMCP vs MCP vs NLWeb comparison.

Frequently Asked Questions

Do I need both the Declarative and Imperative APIs?

No. Start with the Declarative API for any action that is already an HTML form. Only reach for the Imperative API when the action is custom UI (modals, wizards, canvas-based editors) that is not a form.

Will WebMCP work in Firefox and Safari?

Not natively yet. As of April 2026, only Chrome 146 Canary ships the native implementation. For cross-browser support today, use the @mcp-b/global polyfill, which falls back gracefully.

Does implementing WebMCP hurt my SEO?

No — WebMCP attributes are ignored by search crawlers and the manifest lives at /.well-known/ (excluded from rankings). It can indirectly help you because agent-accessible sites get cited more in AI answer engines.

How big can the .well-known/webmcp manifest be?

There is no hard cap in the spec, but keep it under 64KB. Large manifests slow down agent discovery, and most tools should be registered dynamically via the Imperative API anyway.

Is WebMCP the same as Anthropic MCP?

No. Anthropic MCP is server-to-server (the model connects to your backend over stdio or HTTP). WebMCP is browser-side: the agent uses whatever the logged-in user can already do. See our detailed comparison.

KP

A decade-plus building in technical SEO, AEO, and AI-driven growth. Founder of SEOsmoHub, creator of WebMCP Checker, and publisher across a portfolio of content sites including topinlists.com. Writes about the open web at kulbhushanpareek.com.

Is your site ready for AI agents?

Run a free WebMCP readiness audit in 15 seconds — no signup.

Run Free Audit →