WebMCP vs MCP Servers: How Websites and Products Expose Tools to AI Agents
A browser agent fills in your quote form with a SKU you discontinued last week. A support agent quotes pricing from a draft nobody approved. In both cases the agent had tools, but the content behind those tools wasn't governed.
A browser agent fills in your quote form with a SKU you discontinued last week. A support agent quotes pricing from a draft nobody approved. In both cases the agent had tools, but the content behind those tools wasn't governed. To deliver CMS content as agent-ready tools, serve one structured backend through two surfaces. WebMCP tools registered in your pages handle in-browser agents. A hosted, read-only MCP endpoint handles every other agent. In Sanity Context, that endpoint is Context MCP, which queries published content in the Content Lake at request time.
The risk grows with every channel. An agent that answers from stale or unapproved content does it in your brand's voice, at scale, and usually somewhere no editor will see it. A tool catalog that grows without a plan also becomes a permission and prompt-injection problem.
This guide doesn't treat WebMCP vs MCP servers as a contest between protocols. The real questions are where the user is and what the agent is allowed to do. The guide covers how each model works, a numbered setup procedure, and a way to decide based on audience, authentication, actions, and session. It also explains why both models depend on the same structured, permissioned, and current content.
What is the difference between WebMCP and an MCP server?
Both expose tools to AI agents. WebMCP runs those tools inside a web page in the user's browser. An MCP server is a backend that agent platforms call over an API. The WebMCP explainer draws the line this way: MCP is a backend integration, where a service registers tools with an AI platform and the platform talks to the service's servers without going through the website's UI. WebMCP is the in-browser counterpart. Its tools are defined in the page's own JavaScript and run client-side, in plain view, sharing the page's context while the user watches.
Google and Microsoft proposed WebMCP as a web standard. As of November 2026 it is incubating in the W3C Web Machine Learning Community Group as a Draft Community Group Report, so it is not yet a standard. Chrome 149 runs it as an experimental origin trial, and developers can also turn it on through chrome://flags. WebMCP tools are used by browser and extension agents: the browser's built-in agent, extensions, DevTools, and system-level assistants.
An MCP server has no page and no browser. An agent loop connects to it from anywhere, discovers its tools, and calls them over the network. That makes MCP the right choice for agents that never visit your site, such as an internal Slack bot, a support agent embedded in another product, or a custom assistant built on any model provider.
The two are designed to work together. WebMCP doesn't replace MCP, and an MCP server can't give a browser agent the context of the page the user is looking at. A product team that wants agents to find, compare, and act on its content usually needs both: in-page tools for visitors already on the site, and a hosted endpoint for agents everywhere else.
Picking a protocol is the easy part. The hard part is making sure both surfaces answer from the same content and follow the same rules about what is public. That's why the rest of this guide spends as much time on the content behind the tools as on the tools themselves.
How do I implement an MCP server that delivers CMS content as agent-ready tools?
The fastest way is to configure a hosted, read-only MCP endpoint over your content instead of writing and hosting a tool server yourself. In Sanity Context, that endpoint is Context MCP. It gives any agent loop structured, read-only access to the Content Lake. It doesn't run the agent loop, and it can't write back to the dataset. Setup takes six steps:
1. Deploy your schema with `sanity schema deploy` (Studio v5.1.0 or later). GROQ mode needs a deployed schema, because the schema tells the agent where to look.
2. Create the endpoint and attach a dataset source. Leave the perspective on published, the default.
3. Limit what the agent can read with a groqFilter, a GROQ predicate such as `_type == "product" && public == true`.
4. Write the instructions field: up to 10,000 characters of plain-language guidance for the agent.
5. Issue a bearer organization API token with the Context Viewer permission.
6. Point your MCP client at https://api.sanity.io/v2026-11-03/context/organizations/:organizationId/mcp/:mcpEndpointName.
All of this configuration lives on the endpoint. Query parameters from the client can't override it, so an agent can't request its way into drafts.
GROQ mode queries the dataset at request time. There's no build step and nothing to keep in sync. A request like "size L latex gloves, under $200 a pallet" becomes a filter over product documents, and it stays exact across hundreds of thousands of records. When the useful detail sits in prose fields, turn on dataset embeddings and stay in GROQ mode. A single query can then filter on structured fields and rank with text::semanticSimilarity() inside score(). Semantic similarity only ranks results. It doesn't filter them, so narrow the candidate set first.
One trap to know about: an endpoint serves only one source type. If you attach a dataset source and Knowledge Base sources together, the dataset source wins silently. The Knowledge Bases are ignored and no error tells you why.

Use an organization token, not a project token
How does a website expose tools to browser agents with WebMCP?
A website registers WebMCP tools in the page in one of two ways: in JavaScript with document.modelContext.registerTool(), or declaratively by adding a toolname attribute to an HTML form. The page provides the tools, and browser and extension agents call them. Watch the namespace. Chrome renamed the API from navigator.modelContext to document.modelContext and dropped unregisterTool(), provideContext(), and clearContext(), so older examples will break.
A WebMCP tool has four parts: a name, a description, an inputSchema written in JSON Schema, and an execute() function. Annotations such as readOnlyHint tell the agent whether a call changes anything. To remove a tool, you abort the AbortSignal you registered it with. Other frames can use the tool only if you opt in through exposedTo, and only HTTPS origins are allowed. getTools() and executeTool() exist only for in-page agents and test harnesses, which makes them useful for automated tests of your tool catalog.
The developer experience is familiar because a tool is just page code. A product listing page might register a search_products tool. Its execute() would run the same GROQ query the page already uses to render results from the Content Lake, then return structured product objects instead of HTML. There's no Sanity plugin for this, and none is needed. The tool calls your existing content API the same way the page does.
The detail most teams miss is validation. The browser doesn't check arguments against inputSchema, so the schema is a hint to the agent, not a guard. execute() has to validate every argument itself, including types, ranges, and allowed values, before it runs a query or touches a cart.
Write tool descriptions with the same care. In most tool-calling setups, the schemas and descriptions are sent with every request, so they use up context tokens on every turn. A page with ten focused tools gives the agent a short list it can keep track of. With forty overlapping tools, it starts calling the wrong tool with the wrong arguments.
The browser does not validate tool arguments
How do you choose between WebMCP and a hosted MCP server?
Choose WebMCP when the agent acts for a user who is on your site, in a supporting browser, with a session already in place. Choose a hosted MCP server when the agent runs anywhere else. Four questions settle most cases.
Audience. WebMCP reaches only visitors on your pages in a browser that supports it, which today means the Chrome 149 origin trial or a flag. A hosted MCP server reaches custom agent loops, internal assistants, and any MCP client you configure, whether or not anyone opens your website.
Authentication. WebMCP tools run inside the user's existing session, so the page's own login is the security boundary. A hosted MCP server needs its own credential. Context MCP, for example, expects a bearer organization token with the Context Viewer permission. That suits a server-side agent loop rather than an anonymous end user.
Actions. Read tools query content and look up product information. Write tools change state, such as adding to a cart or canceling a subscription. Composite tools wrap a workflow, where one tool call maps to several backend calls. Read-only content retrieval fits a hosted endpoint well. Writes that act as a specific user belong where that user's identity is well established.
Session. If an action depends on who the user is, the agent should act as the user, not as a service account. An agent can reach only what its user can reach. A support agent inside your authenticated product can cancel a subscription because you control the login. The same agent in a chat channel that only knows a phone number can't do that safely. The weaker the identity, the fewer actions you can safely allow, so build the tool catalog per channel.
Most teams end up with a split. Public, read-only content retrieval goes through a hosted MCP endpoint that serves every channel. Session-bound actions go through WebMCP tools on the pages where users are signed in. Both surfaces should read from the same content so the answers match.
Why do both tool models need structured, permissioned, and current content?
WebMCP tools and hosted MCP servers depend on the same thing. The content has to be structured enough to filter, permissioned enough to limit, and current enough to trust. The protocol only carries the answer. If the content behind it is scraped HTML, a nightly export, or a dataset where drafts sit next to published documents, the agent repeats the problem with confidence.
Structure lets a tool filter instead of guess. A request for size L gloves under a price ceiling is exact when size and price are fields, and fragile when they're buried in a description. Permissions decide what an agent may read at all. Freshness decides whether what it reads is still true.
Sanity is the intelligent backend for companies building AI content operations at scale. It replaces headless CMSes instead of bolting an AI plugin onto one. Agent context storage and MCP delivery sit on the same Content Lake that renders the website. In practice, the page's WebMCP execute() runs a GROQ query against the Content Lake, and Context MCP queries the same dataset at request time. One schema and one set of documents serve two tool surfaces. The retrieval layer and tool definitions carry over across the website, a Slack bot, or a proactive surface.
Drafts stay out of public answers because of configuration, not convention. Context MCP defaults to the published perspective, which excludes drafts, versions, and future variants. A groqFilter limits which documents the agent can read. That configuration lives on the endpoint, so a client can't override it with query parameters.
Duplicated facts are the remaining risk. A help center says returns are accepted within 30 days while a product page says 45. Knowledge Bases (Beta, opt-in) detect that kind of conflict during a build and raise an issue showing both claims with their sources. An editor picks the ground truth before any agent repeats the wrong number.
Drafts stay out of agent answers by default
What does a self-built MCP server or crawl-based agent platform cost you?
A self-built MCP server costs you engineering time and ongoing ownership. A crawl-based agent platform costs you control over freshness and governance. Neither choice is wrong, but the costs show up in different places.
You can build your own MCP server over a CMS API, for example Contentful or Strapi with a custom server in front. The cost is that your team writes and hosts the tool layer, the authentication, the draft filtering, and the freshness logic. Then it has to keep all of that working as the CMS API and the MCP specification change. Every new tool is another code path that has to remember to exclude unpublished content.
Agent platforms with their own retrieval, such as Kapa.ai, Decagon, and Sierra AI, make the opposite trade. They crawl or ingest your site and docs, which gets you started quickly. But freshness then depends on the crawl schedule, and governance depends on what the crawler happened to see rather than on your source of truth. Lock-in follows, because the index, the prompts, and the tool definitions live in the vendor's console.
Enterprise reviews add two more questions. First, tool descriptions are trusted text. Every MCP server you install adds its descriptions to the prompt on every turn, so a sloppy or malicious one can steer the agent before the user types anything. Teams that combine a content MCP with a commerce or CRM MCP should review those descriptions like code. Second, compliance: Sanity holds SOC 2 Type II, supports GDPR compliance, offers regional hosting for data residency, and publishes its sub-processor list.
Keep Sanity's two MCP servers separate in your architecture. The mcp.sanity.io server is for editors and developers working in Claude, Cursor, and VS Code. It can read and write documents, including publishing drafts. Context MCP is the read-only, published-perspective endpoint for production agents. Context MCP works with any model, so switching between Anthropic, OpenAI, Gemini, or an open-weight model doesn't change the content layer.
WebMCP, self-hosted MCP, and crawl-based platforms compared with Sanity Context
| Feature | Sanity | WebMCP (in-page tools) | Self-hosted MCP over a CMS API | Agent platform crawl (Kapa.ai/Decagon) |
|---|---|---|---|---|
| Where the tools run | Hosted Context MCP endpoint over the Content Lake. Read-only, doesn't run the agent loop, and works with any LLM your agent loop uses. | In the page's JavaScript, client-side, inside the user's browser session while the user watches. Currently an experimental origin trial in Chrome 149. | On a server your team builds and hosts in front of the CMS delivery API. Tools, scaling, and uptime are all your responsibility. | Inside the vendor's platform, answering from an index built by crawling or ingesting your website and documentation. |
| Who can reach the tools | Any MCP client or custom agent loop that sends a bearer organization token with Context Viewer permission. The same tools serve web, Slack bots, and proactive surfaces. | Browser and extension agents on your pages in a supporting browser. Agents that never visit the site can't reach these tools. | Whichever MCP clients your server supports, using whatever authentication scheme your team implements and maintains. | Users of the vendor's own widgets and channels. Reuse in your other agents depends on the integrations the vendor offers. |
| Keeping drafts out of answers | Native: the endpoint uses the published perspective by default, excluding drafts, versions, and future variants. Query parameters can't override it. | Depends on the query execute() runs. The page has to request published content itself, because the browser adds no content rules. | Assembled: your server has to filter drafts on every query path, and one missed path can leak unpublished content. | Inherits whatever was public at crawl time. Unpublished content stays out, but retracted content can linger until the next crawl. |
| Scoping what the agent can read | groqFilter on the endpoint, a GROQ predicate of up to 10,000 characters such as _type == "product" && public == true. | Limited to what each tool's execute() returns and what the user's session allows. Cross-frame access is opt-in through exposedTo, HTTPS only. | Custom authorization logic in your server, usually written per tool and kept in line with CMS roles by hand. | Set by crawl rules and source selection in the vendor's console, not by fields in your own content model. |
| Structured plus semantic retrieval | With dataset embeddings on, structured filters and text::semanticSimilarity() inside score() run in one GROQ query. Filter first, then rank. | Whatever search the page's backend offers. WebMCP defines the tool contract, not how retrieval works behind it. | Assembled: CMS filters plus a separate vector store and sync job, combined in your own application code. | Vendor-managed semantic search over crawled pages. Structured fields from your schema may be flattened into plain text. |
| Freshness | GROQ mode queries the dataset at request time, with no build step and nothing to keep in sync. | Only as current as the API the page calls: live if execute() queries the source, stale if it reads cached page data. | Only as current as your sync or cache strategy. Webhook-driven updates are possible, but your team has to build and monitor them. | Limited by the crawl or ingest schedule, so freshness comes from the last crawl rather than from the source of truth. |
| Agent instructions | An instructions field on the endpoint holds up to 10,000 characters of plain-language guidance, configured alongside the endpoint's scope. | Tool names and descriptions live in page code and are sent with every prompt, so every change ships with a site deploy. | System prompt and tool descriptions live in your server's code or config, versioned and released with your deploys. | Configured in the vendor's console with its own prompt and persona settings, separate from where your content is written. |