AI Engineering
What Is WebMCP? How WebMCP Enables AI Agents to Interact with Web Applications
By DI Solutions
Developer


WebMCP is a proposed browser API that lets a web page declare structured tools to an AI agent running in the browser. Instead of the agent guessing at buttons and form fields, the site publishes named functions with typed inputs that the agent can call directly — inside the user's existing session, with the user's existing permissions.
Key takeaways
- WebMCP brings the Model Context Protocol tool model into the browser tab.
- The page is the tool provider. The transport is a JavaScript API on
navigator.modelContext, not a server connection. - Authorisation comes free: tools run in the user's tab with their existing cookies and session.
- It replaces brittle DOM scraping with typed, named operations that survive a redesign.
- Status: an explainer in the W3C Web Machine Learning Community Group with early Chrome experimentation — build behind a feature check.
How does WebMCP work?
- The page registers its tools. On load, your JavaScript declares each tool with a name, a natural-language description, and a JSON Schema for its inputs.
- The browser exposes them to the agent. Whatever agent the user is running — a browser assistant, an extension, a sidebar model — sees the tool list for the active tab.
- The user asks for something. "Reorder my usual basket", "move this ticket to done and assign it to Priya".
- The agent picks a tool and fills the arguments. It matches intent to a declared tool and produces arguments that satisfy the schema.
- Your handler executes in the page. The call runs your own JavaScript, hitting your own API with the session already in the tab.
- A structured result goes back. The agent receives real data — an order id, an error, a list — not a screenshot it has to interpret.
The current explainer proposes registration through navigator.modelContext. A minimal tool looks like this:
if ("modelContext" in navigator) {
navigator.modelContext.registerTool({
name: "add-to-cart",
description: "Add a product to the shopping cart by SKU.",
inputSchema: {
type: "object",
properties: {
sku: { type: "string", description: "Product SKU" },
quantity: { type: "number", description: "How many units" }
},
required: ["sku"]
},
async execute({ sku, quantity = 1 }) {
const res = await fetch("/api/cart", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ sku, quantity })
});
if (!res.ok) {
return { content: [{ type: "text", text: "Could not add item." }] };
}
const cart = await res.json();
return {
content: [
{ type: "text", text: `Added ${quantity} x ${sku}. Cart total: ${cart.total}` }
]
};
}
});
}Note the feature check. The API is still being incubated, so the page must work perfectly when navigator.modelContext is undefined.
WebMCP vs MCP vs browser automation
| Aspect | WebMCP | MCP (server) | DOM / browser automation |
|---|---|---|---|
| Where tools live | In the web page | In a local or remote MCP server | Nowhere — inferred from HTML |
| Who publishes them | The site owner | The API or integration owner | The agent guesses |
| Authentication | Existing browser session | API keys or OAuth on the server | Session, but credentials often exposed to the agent |
| Breaks on redesign | No | No | Constantly |
| Token cost | Low — schema plus structured result | Low | High — screenshots and full DOM |
| Best for | Logged-in web app workflows | Backend systems, files, databases | Sites that expose nothing else |
What are the benefits of WebMCP?
- Reliability. A named tool with a schema does not break when the CSS class names change.
- No new credentials. The tool runs in the tab, so the session the user already has is the authorisation. Nothing is handed to a third party.
- Cheaper and faster. One structured call replaces a screenshot-click-screenshot loop, cutting both latency and token spend.
- You keep control of the surface. The site decides exactly which operations an agent may perform — a much smaller attack surface than "anything a user can click".
- Accessibility dividend. Declaring what your app can do in typed, described operations benefits assistive technology as well as agents.
- Agent-readiness for discovery. As AI assistants become a route to purchase, a site an agent can actually operate has a real advantage over one it cannot.
What are the use cases for WebMCP?
- E-commerce. Search catalogue, add to cart, apply a voucher, track an order — with checkout confirmation always left to the human.
- Booking and scheduling. Find availability, hold a slot, reschedule, cancel within policy.
- CRM and admin dashboards. Create a record, change a status, assign an owner, pull a filtered report.
- Support portals. Open a ticket with the right metadata, attach the current context, check status.
- Internal line-of-business tools. The highest-value case, because these apps are used daily and almost never have a public API worth integrating.
- Data-heavy SaaS. Expose filtering and export as tools so an agent can answer questions over the user's own data instead of scraping a table.
Security: what to get right before you ship
- Assume prompt injection. Hostile text in a review, a comment or an email rendered on your page will try to steer the agent. Tool arguments are untrusted input, always.
- Re-authorise server-side. The tool handler is convenience, not a security boundary. Your API must check permissions exactly as it does for a manual click.
- Never exceed the user's own rights. If a logged-in user cannot delete an invoice through the UI, no tool may do it either.
- Gate destructive and financial actions. Payments, deletions, permission changes and outbound messages need explicit human confirmation in the page, not agent discretion.
- Rate-limit and log. Agents retry. Record every tool call with its arguments so an incident can be reconstructed.
- Keep tool descriptions honest and narrow. Vague descriptions invite wrong calls; over-broad tools invite abuse.
Limitations and current status
- It is a proposal, not a shipped standard. The API surface is being incubated in the W3C Web Machine Learning Community Group and can change.
- Browser support is early. Treat WebMCP as progressive enhancement layered on a fully working app.
- Tools only exist while the tab is open. There is no background or server-side reachability — that is what server-side MCP is for.
- Discovery is unsolved. An agent finds tools by being on the page; there is no directory of WebMCP-capable sites.
- Maintenance cost. Tool definitions are a second interface to your product and drift out of date exactly like documentation does.
How to get started with WebMCP
- List your top five user journeys. The flows support tickets are actually about — those are your first tools.
- Make each one a single operation. One tool per outcome, not one tool per click.
- Write strict input schemas. Enumerate allowed values; a loose schema is how an agent produces nonsense arguments.
- Return structured, quotable results. Ids, statuses and totals — the things the agent will repeat back to the user.
- Split read from write. Ship read-only tools first, then add mutations behind confirmation.
- Feature-detect and degrade. Everything must still work in a browser with no
navigator.modelContext.
If your agent also needs facts rather than actions — policies, documentation, catalogue detail — pair WebMCP with retrieval-augmented generation. And if you are considering agents that tune their own tool definitions over time, read recursive self-improving agents first.
Frequently Asked Questions (FAQs)
What is WebMCP?
WebMCP is a proposed browser API that lets a web page declare structured tools to an AI agent running in the browser. Instead of the agent guessing at buttons and form fields, the site publishes named functions with typed inputs that the agent can call directly inside the user's existing session.
How is WebMCP different from MCP?
MCP connects an AI model to servers over stdio or HTTP, usually on the developer's machine or in the backend. WebMCP moves the same tool-calling idea into the browser tab. The page itself is the tool provider, the transport is a JavaScript API, and the user's existing cookies and login carry the authorisation.
Why is WebMCP better than browser automation for AI agents?
DOM-scraping agents read pixels and HTML, then click. They break on every redesign, burn tokens on screenshots, and cannot tell a confirm button from a delete button. WebMCP gives the agent named operations with typed arguments and structured results, which is faster, cheaper and far more reliable.
Does WebMCP require the user to log in again?
No. Tools execute inside the page in the user's own tab, so the existing session cookie, token and permissions apply unchanged. There is no separate API key to provision and no credential handed to a third-party agent, which is one of the main security arguments for the design.
Is WebMCP a finished web standard?
Not yet. WebMCP is an explainer and proposal being incubated in the W3C Web Machine Learning Community Group, with early Chrome experimentation. The API surface can still change, so build behind a feature check and keep your normal UI and backend API fully functional without it.
What are the security risks of WebMCP?
Prompt injection is the main one: hostile content on the page can try to steer the agent into calling a destructive tool. Treat every tool call as untrusted input, re-check authorisation server-side, require explicit user confirmation for payments and deletions, and never expose a tool that a logged-in user could not perform manually.
Which applications benefit most from WebMCP?
Anything with multi-step workflows behind a login: e-commerce checkout, booking and scheduling, CRM and admin dashboards, support portals, and internal line-of-business tools. These are exactly the flows that screen-scraping agents handle badly and where a typed tool call is dramatically more reliable.
Conclusion
WebMCP answers a question every product team is about to face: when an AI agent arrives at your web app on a user's behalf, does it have to guess, or can you simply tell it what your app does? Declaring a handful of typed tools turns brittle, expensive screen-scraping into ordinary function calls that run inside the user's own session, under your own authorisation rules. The specification is still moving, so treat it as progressive enhancement — but the work of naming your core operations and giving them strict schemas pays off regardless of which version of the API ships, because it is the same work that makes your product usable by any agent at all.
Want your web app ready for AI agents?
DI Solutions maps your key user journeys to safe, typed tools and ships them behind proper confirmation and audit controls — hire our web and AI engineers to make your product agent-ready.




