TL;DR
- WebMCP lets a web page give named tools to an AI agent in the same browser. The agent calls
search_productsinstead of guessing where to click. - It is still a Chrome origin trial, now extended to Chrome 162. Safari’s engine team is against it, and Mozilla leans neutral.
- Shopify and BigCommerce have turned it on for their stores. Magento and Adobe Commerce have nothing in core.
- We built an open-source WebMCP module for Magento 2. The main lesson: keep every rule in server code, and let the agent build the cart, not pay.
What WebMCP is, in one minute
Today a browser agent uses a store the slow way. It reads the page, finds a button, clicks, waits and reads again. This costs a lot of tokens, and a small theme change can break it.
WebMCP gives the page a way to say: “Here are my tools, this is what each one does, and this is the input it needs.” The agent calls a tool like a function. The tool runs in the page, inside the shopper’s own session.
A tool has a name, a description, a JSON Schema for its input, and a function:
const controller = new AbortController();
await document.modelContext.registerTool({
name: 'search_products',
title: 'Search the store',
description: 'Search the catalog. Returns SKU, name, price, stock and URL.',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'Search words, e.g. "grey backpack"' }
},
required: ['query']
},
annotations: { readOnlyHint: true, untrustedContentHint: true },
async execute({ query }, { signal }) {
const res = await fetch('/api/search?q=' + encodeURIComponent(query), { signal });
return JSON.stringify(await res.json());
}
}, { signal: controller.signal });
// Later, to remove the tool:
controller.abort();
Three details are easy to miss:
- The API lives on
document.modelContext. Early demos usednavigator.modelContext, but that changed during the trial. - There is no
unregisterTool(). You remove a tool by aborting the signal you passed in. executegets a second argument with its ownsignal, so you can cancel a slowfetch().
There is also a declarative API. You add toolname and tooldescription attributes to an existing <form>, and the browser turns the form into a tool. The Chrome team says the JavaScript (imperative) API is more popular, so this article uses it.
Where WebMCP stands in November 2026
| Status | |
|---|---|
| Spec | Draft Community Group Report of the W3C Web Machine Learning Community Group. Latest draft: 19 November 2026. Not a W3C Standard. |
| Chrome | Early preview behind a flag in Chrome 146. Origin trial from Chrome 149, first planned to end with Chrome 156, now extended until Chrome 162. Stable today: Chrome 158. |
| Next step in Chrome | The team hopes to send an Intent to Ship before the extended trial ends. |
| Firefox | Mozilla’s proposed position is “neutral”. A main worry: a site could offer tools that do not match what the user sees. |
| Safari | The WebKit team says it is opposed. It thinks the gaps should be fixed in HTML and ARIA instead. |
| Shopify | On for every Liquid storefront since 5 August 2026, with no setup. Checkout tools were added on 28 September. |
| BigCommerce | Commerce.com and Cloudflare added it on 21 October 2026. Cloudflare injects the script at the edge, and each merchant can opt out. |
| Magento / Adobe Commerce | Nothing in core. Community modules only, including ours. |
If you read an older tutorial, check these changes from the trial:
navigator.modelContextbecamedocument.modelContext.provideContext()andclearContext()were removed early in 2026. Register tools one by one instead.- Chrome 153: unregistering a tool no longer breaks a call that is already running.
- Chrome 155: passing tool input as a JSON string is deprecated. Pass an object.
- Chrome 156: new
debuggingannotation.window.ontoolactivatedis gone; listen ondocument.modelContextinstead. - Chrome 159: optional
outputSchemafor the tool’s result. - New annotation
consequentialHintfor big or irreversible actions, so the agent or browser can ask the user first.
One number to keep in mind. In the trial extension thread on blink-dev, the Chrome team said origin trial registrations had reached about 0.51% of all Chrome page loads. A few days later, a Chrome reviewer put getTools() at about 0.01% of page loads. getTools() is one way an agent asks a page for its tools. It is not a perfect measure, but the gap is large. Our reading: many sites have added tools, but few agents use them yet. WebMCP is cheap to add and good to learn now. Do not expect real traffic from it this month.
WebMCP is not MCP (and a store may want both)
The name is confusing. WebMCP does not use the MCP protocol. It borrows the idea of tools.
| MCP | WebMCP | |
|---|---|---|
| Where the tools live | On a server, at an endpoint such as /mcp |
In the web page, in the browser |
| Who connects | An AI app (Claude, ChatGPT and others) | An agent inside the browser, using the open tab |
| Session | Its own: anonymous, a token, or account linking | The shopper’s own cookies and cart |
| Typical use | An assistant shops for someone without opening the store | An agent helps the shopper on the store page |
The two can share code. Commerce.com is a good example: Cloudflare injects a script that brings the store’s existing server-side MCP tools into the page. One set of tools, two doors.
Which tools should a store expose?
Start with what a shopper does before paying:
- Find products: search and product details.
- Build a cart: add to cart and view cart.
- Go to checkout.
Then make one decision: does the agent stop at checkout, or can it place the order?
- Shopify goes further. Its
complete_checkouttool places the order, but only after the buyer confirms. The tools do not accept new card details. - We stop one step earlier. Our tools build the cart and open the checkout page. The shopper pays there, as usual.
We chose this because a Magento checkout is rarely standard. Most stores have custom payment, shipping and fraud extensions. Rebuilding all of that as tools adds risk and gives little in return. Both choices are valid. If your tool can pay or do something that cannot be undone, set consequentialHint: true.
8 lessons from building WebMCP for Magento 2
Our module is angeo/module-webmcp (MIT). It registers five tools on every storefront page: search_products, get_product, add_to_cart, get_cart and go_to_checkout. It works with Luma and Hyvä. Here is what we learned.
1. Reuse the store’s own APIs
The read tools call the store’s own GraphQL endpoint with the current store code. So the agent sees the same prices, stock and catalog rules as the shopper. There is no new catalog API to maintain. This is also what the Chrome team hopes for: most tools should be thin wrappers around code the site already has.
2. Run in the shopper’s session, and keep CSRF protection
add_to_cart is a normal frontend POST with Magento’s form key. That is the same CSRF check as the real “Add to Cart” button. The agent changes the shopper’s real cart, and the mini cart updates. There is no new login and no second cart.
3. Put every rule in server code, not in the description
A tool description is a hint for a model. It is not a security boundary. In our module, PHP checks that the product is enabled, visible and on the current website. It caps the quantity (100 by default). Stock and sale rules run through Magento’s own Quote::addProduct(). Chrome’s own guidance says the same: validate in code, because schema limits are not guaranteed.
4. Hidden products should answer “not found”
A disabled or hidden product returns the same error as an SKU that does not exist. If the errors were different, a tool could be used to find products you have not launched yet.
5. Write errors the agent can fix
When a configurable product needs a size and the agent did not send one, the answer lists the allowed values:
{
"ok": false,
"error": "options_required",
"message": "Choose a value for each option, then try again.",
"details": { "missing": { "size": ["S", "M", "L"] }, "invalid": [] }
}
The agent reads this, asks the shopper or picks the right value, and calls the tool again. A plain “Bad request” would end the task.
6. Treat catalog text as untrusted
Product names and descriptions come from people, imports and suppliers. Some of that text could contain instructions meant for an agent. Our read tools set untrustedContentHint: true, so the agent treats the text as data, not as commands. We also strip HTML and cut long descriptions to 2,000 characters.
7. Return first, then navigate
go_to_checkout returns its result and only then opens the checkout page, in the next tick:
execute() {
setTimeout(() => location.assign(checkoutUrl), 0);
return Promise.resolve(JSON.stringify({ ok: true, url: checkoutUrl }));
}
Chrome’s docs say executeTool() returns null when the call starts a navigation. Returning first gives the agent a clear answer before the page changes.
8. Do not break caching, CSP or other browsers
- The config is printed as
<script type="application/json">. It is the same for every shopper, so full-page cache keeps working. The cart endpoints sendCache-Control: no-store. - There is no inline JavaScript, so a strict Content Security Policy still works.
- If
document.modelContextdoes not exist, the script stops at once. Safari and Firefox users see no change.
What our module does not do yet
To be fair, here are the gaps in version 1.0.1:
- No
outputSchemayet. It is new in Chrome 159 and would help agents with search results. - The
signalthatexecutereceives is not passed tofetch()yet. A cancelled call still finishes on the server. - Only simple, virtual and configurable products can be added to the cart. For bundles and products with required custom options, the tool returns the product URL, so the agent can send the shopper there.
How to test WebMCP tools
- In Chrome, open
chrome://flags/#enable-webmcp-testing, turn it on and restart. Or add an origin trial token to your page. - Open DevTools → Application → WebMCP. You see every registered tool.
- Call a tool from the console:
const tools = await document.modelContext.getTools();
const search = tools.find((t) => t.name === 'search_products');
await document.modelContext.executeTool(search, { query: 'backpack' });
- Test with a model. Chrome lists two helpers: the Model Context Tool Inspector extension (it needs a Gemini API key) and an example agent extension from Google Chrome Labs. There is also a flag to try tools with the on-device Prompt API.
- Test with real prompts, not only unit tests. Model answers vary, so Chrome suggests evaluation-driven testing.
Add WebMCP to a Magento 2 store
composer require angeo/module-webmcp
bin/magento module:enable Angeo_WebMcp
bin/magento setup:upgrade
bin/magento cache:flush
In production mode, also run bin/magento setup:static-content:deploy.
Then open Stores → Configuration → Angeo → WebMCP:
- Paste your Chrome origin trial token. A token works for one origin, so set it per store view if your store views use different domains.
- Switch each tool on or off.
- Set the limits: search results (default 10, at most 50) and quantity per add to cart (default 100).
Important if you joined the first trial (Chrome 149 to 156): when Chrome extends a trial, you must renew your registration and use a new token. Open “My Registrations” in the Chrome Origin Trials console, click Renew, and paste the new token in the admin.
Requirements: Magento Open Source, Mage-OS or Adobe Commerce 2.4.6 or newer, PHP 8.1 to 8.5, and GraphQL turned on (it is on by default).
The module works well with angeo/module-mcp-server for assistants that connect from outside the browser. angeo/module-agent-activity counts WebMCP calls by tool, so you can see if any agent uses them.
Should you add WebMCP now?
Add it now if your store already has a clean storefront API, and you can test in Chrome. The cost is small: one script and a few endpoints. You learn early, while the API is still open to feedback.
Wait if you would need to rebuild your frontend for it. Also fix the basics first: clean product data, correct JSON-LD and a working checkout. A browser agent still depends on good data.
Checklist
- Tools cover search, product details, add to cart, view cart and go to checkout.
- Each tool does one thing, and its name is a clear verb.
- All limits live in server code.
- Every write sends your CSRF token.
readOnlyHinton read tools,untrustedContentHinton catalog text,consequentialHinton anything that pays or cannot be undone.- Errors have codes and list the allowed values.
- The script checks that WebMCP exists, has no inline JavaScript and keeps pages cacheable.
- The origin trial token is renewed after the extension.
- Tools are tested with the flag, in DevTools and with real prompts.
FAQ
Is WebMCP the same as MCP? No. MCP tools live on a server, and an AI app connects to them. WebMCP tools live in the web page, and an agent in the same browser calls them in the shopper’s session. A store can offer both.
Which browsers support WebMCP? Only Chrome, as an origin trial from Chrome 149, now extended to Chrome 162. For testing you can also turn on a flag. Firefox and Safari do not support it, and the WebKit team says it is opposed.
Can an AI agent buy on my store with WebMCP? Only if you give it a tool that does. Shopify lets the agent place the order after the buyer confirms. Our Magento module stops at the checkout page, so the shopper always pays.
Does WebMCP slow down my store?
Not in a way you will notice. The script is small and loads with defer. It does nothing in browsers without WebMCP, and full-page cache keeps working.
Do I need an origin trial token? For real shoppers in Chrome, yes, until WebMCP ships. For your own testing, the flag is enough.
angeo.dev
A research project and blog about how AI agents read and buy from online stores. We publish open-source (MIT) modules for Magento 2 under the angeo/ name, on GitHub and Packagist.
Disclosure: angeo.dev maintains angeo/module-webmcp and the other open-source modules named in this article.
Sources
- WebMCP draft specification (W3C Web Machine Learning CG)
- WebMCP overview, Chrome for Developers
- WebMCP imperative API
- WebMCP declarative API
- WebMCP best practices
- Build secure WebMCP tools
- WebMCP origin trial announcement (Chrome 149)
- Intent to Experiment: WebMCP (blink-dev)
- Intent to Extend Experiment: WebMCP (blink-dev)
- Chrome origin trials: renewing a token
- Mozilla standards position on WebMCP
- WebKit standards position on WebMCP
- Shopify changelog: WebMCP on Liquid and Hydrogen
- Search Engine Journal: Shopify extends WebMCP into checkout
- Cloudflare: how Commerce.com and Cloudflare are getting storefronts ready for AI agents
- DataCamp WebMCP tutorial (notes the removal of provideContext)
- angeo/module-webmcp on GitHub