Think of WebMCP as giving an AI assistant a remote control for your website. Instead of the AI fumbling through UI clicks blindly, it calls structured JavaScript functions you define — so it can filter products, submit forms, or update the UI directly inside your running page, while you stay in control and watch it happen live.
WebMCP is a W3C Web Machine Learning Working Group proposal co-developed by Google, Microsoft, and W3C. It defines a standard way for web pages to expose JavaScript-based tools that AI agents can call directly in the browser context — without a separate server, without custom middleware, and without breaking the user's live UI.
The key distinction from backend MCP: WebMCP tools run inside the running page. The user sees changes happen in real time. The human stays in the loop. This makes WebMCP ideal for human-in-the-loop workflows where an AI agent assists — rather than replaces — the user.
Setting Up the WebMCP Server Architecture
A WebMCP server typically operates over an HTTP transport layer using Server-Sent Events (SSE) for real-time communication. This allows the AI client to maintain a persistent connection to the server's toolset. We will implement a basic server structure that follows the standard protocol handshake.
The 4-step WebMCP flow works entirely inside the browser: the page loads as usual, the cloud LLM communicates with a browser-integrated agent, the agent uses the WebMCP JS API to call JavaScript functions in the live page, and those functions can update the UI or make HTTP calls to third-party services.
webmcp-register-tools.jsJAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Register tools on your page that the AI agent can call
navigator.mcp.registerTool({
name: 'filter_products',
description: 'Filter the product list by category and price range',
parameters: {
type: 'object',
properties: {
category: { type: 'string', description: 'Product category' },
maxPrice: { type: 'number', description: 'Maximum price in USD' }
},
required: ['category']
},
handler: async ({ category, maxPrice }) => {
// This runs directly in your live page contextconst products = awaitfetchProducts({ category, maxPrice });
renderProductGrid(products); // updates UI immediatelyreturn { count: products.length, category };
}
});
console.log('WebMCP tools registered — AI agent can now use filter_products');
Output
WebMCP tools registered — AI agent can now use filter_products
Still a W3C Proposal
WebMCP is an early-stage specification. The navigator.mcp API is not yet available in stable browsers. Follow the W3C Web Machine Learning Working Group for ratification status before using in production.
Detailed WebMCP Architecture: From LLM Intent to Browser-Native API Execution.
thecodeforge.io
Webmcp Ai Tool Integration
Exposing Tools to the AI Client
Tools are the core of WebMCP. They represent JavaScript functions registered on your page that the AI agent can discover and call. Unlike backend MCP which requires a separate server process, WebMCP tools live in your page's JavaScript context — meaning they have direct access to your DOM, your app state, and your existing frontend code.
This is the fundamental difference from backend MCP: when a WebMCP tool runs, the user sees the result immediately in the live UI. No separate agent-provided interface. No manual wiring. The human stays in control and in the loop.
webmcp-tool-schema.jsJAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Tool definitions follow JSON Schema — same pattern as backend MCP// but handler runs in-browser, not on a server
navigator.mcp.registerTool({
name: 'calculate_revenue_projection',
description: 'Calculates quarterly growth and updates the dashboard chart',
parameters: {
type: 'object',
properties: {
current_arr: { type: 'number', description: 'Current Annual Recurring Revenue' },
growth_rate: { type: 'number', description: 'Expected quarterly growth rate (0-1)' }
},
required: ['current_arr']
},
handler: async ({ current_arr, growth_rate = 0.1 }) => {
const q1 = current_arr * (1 + growth_rate);
const q2 = q1 * (1 + growth_rate);
// Update the live chart in the page
window.revenueChart.update([current_arr, q1, q2]);
return { q1: q1.toFixed(2), q2: q2.toFixed(2) };
}
});
Output
// AI agent calls the tool → chart updates live in the browser
// User sees the revenue projection rendered immediately
Schema Integrity
The more descriptive your tool descriptions and parameter schemas are, the more accurately the LLM will select and use them. Write descriptions as if explaining to a junior developer what the function does and when to call it.
thecodeforge.io
WebMCP (browser-native) vs Backend MCP (server-side) — Architecture Comparison
Webmcp Ai Tool Integration
Feature
WebMCP (Browser)
Backend MCP (Server)
Standard REST API
Where tools run
Inside live browser page
Separate server process
Server endpoint
UI integration
✅ Live page updates
❌ Agent provides own UI
❌ No awareness
Human in loop
✅ User sees changes live
⚠️ Manual wiring needed
❌ None
Tool discovery
✅ Auto via navigator.mcp
✅ Auto via tools/list
❌ Manual (Swagger)
Setup required
JS in your page only
Separate MCP server
REST endpoints
Spec status
W3C Proposal (early)
Open standard (stable)
Mature standard
Key takeaways
1
WebMCP is a W3C proposal co-developed by Google, Microsoft, and W3C
not yet a stable standard.
2
Tools are JavaScript functions registered on your page via navigator.mcp.registerTool().
3
Unlike backend MCP, WebMCP tools run in the live browser page
the user sees changes in real time.
4
The human-in-the-loop model is WebMCP's core advantage over server-side AI integrations.
5
Tool schema quality directly determines how accurately the AI agent selects and calls your tools.
INTERVIEW PREP · PRACTICE MODE
Interview Questions on This Topic
Q01JUNIOR
What is WebMCP and how does it differ from backend MCP?
Q02JUNIOR
Why is the human-in-the-loop aspect important in WebMCP?
Q03JUNIOR
What organisations are behind WebMCP?
Q04JUNIOR
When would you choose WebMCP over backend MCP?
Q01 of 04JUNIOR
What is WebMCP and how does it differ from backend MCP?
ANSWER
WebMCP is a W3C proposal that lets web pages expose JavaScript functions as AI-callable tools running directly in the browser. Backend MCP runs tools on a separate server process. The key difference: WebMCP tools execute in the live page context, so the user sees UI changes in real time and stays in the loop. Backend MCP requires the agent to provide its own UI separately.
Q02 of 04JUNIOR
Why is the human-in-the-loop aspect important in WebMCP?
ANSWER
Because WebMCP tools run inside the running page, the user watches the AI agent's actions happen live in their own UI. They can intervene, correct, or approve at any point. This is fundamentally different from backend integrations where the agent acts autonomously and the user only sees the final result.
Q03 of 04JUNIOR
What organisations are behind WebMCP?
ANSWER
WebMCP is co-developed by Google, Microsoft, and the W3C Web Machine Learning Working Group. It is an early-stage proposal, not yet a ratified standard.
Q04 of 04JUNIOR
When would you choose WebMCP over backend MCP?
ANSWER
Choose WebMCP when the user needs to stay in the loop and see live UI changes, when you want to avoid running a separate server, or when your tools naturally belong in the frontend (DOM manipulation, form filling, UI filtering). Choose backend MCP when the agent needs to interact with databases, internal APIs, or services that should not be exposed to the browser.
01
What is WebMCP and how does it differ from backend MCP?
JUNIOR
02
Why is the human-in-the-loop aspect important in WebMCP?
JUNIOR
03
What organisations are behind WebMCP?
JUNIOR
04
When would you choose WebMCP over backend MCP?
JUNIOR
FAQ · 3 QUESTIONS
Frequently Asked Questions
01
Can I use WebMCP in production today?
Not in stable browsers — WebMCP is still a W3C proposal. Monitor the Web Machine Learning Working Group at github.com/webmachinelearning/webmcp for ratification updates.
Was this helpful?
02
Does WebMCP work with any AI model?
Yes, as long as the browser-integrated agent supports the WebMCP protocol. The tools you register are model-agnostic — the schema-driven approach works with any LLM that can call structured tools.
Was this helpful?
03
What is the difference between a WebMCP tool and a regular JavaScript function?
A WebMCP tool is a regular JavaScript function wrapped in a structured schema (name, description, parameters) and registered with the browser agent via navigator.mcp. The schema is what makes the function discoverable and callable by an AI agent.