Google's new browser API lets your website talk directly to AI agents — no DOM scraping, no fragile automation scripts. Here's how it works and why it matters for every web developer.
Imagine an AI agent trying to book a flight on your website. Today, it renders the page, takes a screenshot, asks a vision model to guess which button is "Search", and hopes for the best. Change a button's CSS class, move it 5 pixels to the left, or rename "Submit" to "Search Flights" — the agent breaks.
This fragile, pixel-peeping approach is what WebMCP (Web Model Context Protocol)
aims to eliminate. Unveiled at Google I/O 2026 on May 19-20 as one of the "15 updates powering
the agentic web," WebMCP is Google's proposed open web standard that lets your website declare
exactly what it can do — as typed, callable JavaScript tools — directly to AI agents through
the navigator.modelContext browser API.
Instead of an agent guessing where to click, your website says: "I support searchFlights(from, to, date, passengers), getHotelAvailability(location, dates), and completeBooking(bookingId). Here are the exact parameters."
This is a fundamental shift. Websites are no longer just human-readable documents — they become executable toolkits for AI agents. In this guide, I'll walk through exactly what WebMCP is, how to implement it, code examples for both the Imperative and Declarative APIs, and what this means for your web development strategy.
WebMCP is a proposed web standard developed by Google's Chrome team, published as a developer
trial on May 18, 2026. It introduces a new browser API — navigator.modelContext —
that allows websites to publish a structured, machine-readable manifest of callable tools.
The key insight is simple: agents don't need to see your UI to use your website. They need to know what operations you support and how to call them. WebMCP provides exactly that — a "tool contract" between the website and the AI agent.
searchFlights, bookHotel) with typed parameters and return valuesIt's important to distinguish WebMCP from Anthropic's Model Context Protocol (MCP). They're different standards for different contexts:
| Feature | WebMCP (Google) | MCP (Anthropic) |
|---|---|---|
| Environment | Browser (via navigator.modelContext) |
Standalone server ↔ LLM |
| Purpose | Websites declare tools to in-browser agents | LLM applications connect to external data/tools |
| Discovery | Automatic — agent queries navigator.modelContext |
Manual — MCP server URL configured in client |
| Scope | Per-page tools and state | Global data sources and tool collections |
| Standardization | W3C / WICG proposal (open web standard) | Open source protocol specification |
They're complementary. A website using WebMCP exposes its tools to an in-browser agent. That agent, in turn, could use Anthropic's MCP to access external databases or APIs. Together, they form a complete ecosystem for agent-web interaction.
Before WebMCP, AI agents interacted with websites through actuation — simulating human behavior: rendering the page, taking screenshots, feeding them to multimodal vision models, and guessing where to click.
This approach has fundamental problems:
WebMCP eliminates all of these problems by replacing pixel-based interaction with
structured API calls. The agent calls searchFlights("NYC", "LAX", "2026-06-15", 2)
instead of clicking through a 5-step form. It's faster, cheaper, more reliable, and more private.
WebMCP is currently available as a Developer Trial in Chrome. You need
to enable it either through chrome://flags or by registering for an origin trial token.
In Chrome, navigate to chrome://flags/#enable-web-mcp and enable the flag.
Alternatively, register for a WebMCP origin trial token
and add it to your page's <head>:
<meta http-equiv="origin-trial" content="YOUR_ORIGIN_TRIAL_TOKEN">
Before using WebMCP, always check if it's available in the user's browser:
if (navigator.modelContext) {
console.log('WebMCP is available!');
// Proceed with tool registration
} else {
console.log('WebMCP not available — fall back to normal UX');
// The site works fine without it
}
WebMCP is designed as progressive enhancement — your site must work perfectly without it.
The Imperative API is the most flexible way to use WebMCP. You define tools programmatically using JavaScript, which gives you full control over tool names, parameters, and execution logic.
Use navigator.modelContext.registerTool() to define each tool your website supports:
navigator.modelContext.registerTool({
name: 'searchFlights',
description: 'Search for available flights between two airports on a given date',
parameters: {
type: 'object',
properties: {
origin: {
type: 'string',
description: 'IATA airport code for departure (e.g., JFK, LAX, LHR)'
},
destination: {
type: 'string',
description: 'IATA airport code for arrival'
},
date: {
type: 'string',
format: 'date',
description: 'Departure date (YYYY-MM-DD)'
},
passengers: {
type: 'integer',
minimum: 1,
default: 1,
description: 'Number of passengers'
}
},
required: ['origin', 'destination', 'date']
},
handler: async (params) => {
const results = await fetch('/api/flights', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(params)
});
return await results.json();
}
});
Beyond tools, you can expose structured data about the current page state:
// Expose the current page state to agents
navigator.modelContext.setContext({
pageType: 'flight-search-results',
currentPage: 1,
totalResults: 47,
filters: {
maxPrice: 500,
airlines: ['Delta', 'United'],
stops: 'nonstop'
},
tripType: 'round-trip',
currency: 'USD'
});
Agents discover your tools by querying the browser. The browser returns the full tool manifest:
// This is what the agent does internally:
const tools = await navigator.modelContext.getTools();
// Returns: [{ name: 'searchFlights', description: '...', parameters: {...} }, ...]
const context = await navigator.modelContext.getContext();
// Returns: { pageType: 'flight-search-results', currentPage: 1, ... }
WebMCP fires events when tools are called, letting you track agent usage:
navigator.modelContext.addEventListener('toolinvoke', (event) => {
console.log(`Agent invoked tool: ${event.detail.toolName}`);
console.log(`Parameters:`, event.detail.parameters);
console.log(`Execution ID: ${event.detail.executionId}`);
// You could log agent interactions for analytics
});
The Declarative API lets you annotate existing HTML elements with WebMCP metadata. This is ideal when you want to expose form functionality without writing custom JavaScript tool handlers.
<form data-mcp-tool="bookHotel" data-mcp-description="Book a hotel room">
<label>Hotel Name</label>
<input type="text" name="hotelId"
data-mcp-param="hotelId"
data-mcp-type="string"
data-mcp-description="Hotel identifier from search results">
<label>Check-in Date</label>
<input type="date" name="checkin"
data-mcp-param="checkin"
data-mcp-type="date"
data-mcp-description="Check-in date">
<label>Check-out Date</label>
<input type="date" name="checkout"
data-mcp-param="checkout"
data-mcp-type="date"
data-mcp-description="Check-out date">
<label>Guests</label>
<input type="number" name="guests"
data-mcp-param="guests"
data-mcp-type="integer"
data-mcp-description="Number of guests"
data-mcp-default="1">
<button type="submit">Book Now</button>
</form>
With the Declarative API, the browser automatically generates tool definitions from your
HTML annotations. The agent sees the same tool (bookHotel) with the same
parameters, but you didn't write a single line of JavaScript beyond your normal form handler.
An AI shopping assistant can browse multiple stores, find the best price for a product, and complete the purchase through WebMCP tools — without the user ever visiting each store manually.
// Agent workflow across stores
const results = [];
for (const store of stores) {
// Agent calls searchProduct on each store
const items = await agent.invokeTool(store, 'searchProduct', {
query: 'iPhone 16 Pro',
maxPrice: 1200
});
results.push(...items);
}
// Agent sorts by price and calls checkout on the best store
await agent.invokeTool(bestStore, 'checkout', {
productId: results[0].id,
shippingAddress: user.address,
paymentMethodId: user.preferredCard
});
"Book me a trip to Tokyo" triggers a chain: search flights → search hotels → compare options → reserve. Each step calls a different tool on the same website, with the agent choosing the optimal combination.
A customer asks their AI assistant "What's my order status?" The assistant navigates to
the retailer's site, calls getOrderStatus(orderId) via WebMCP, and returns
the result conversationally. If the order is delayed, it can call initiateReturn(orderId)
or contactSupport(orderId, message).
"Show me last month's conversion rate by traffic source" — the agent queries the analytics
dashboard's tools, aggregates the data, and presents it in a human-readable format.
The dashboard exposes tools like queryMetrics(metric, dimensions, dateRange, filters).
"Create a new project in Asana, add tasks from this Google Doc, and invite the team" — an agent orchestrates across multiple SaaS tools, each exposing its tools via WebMCP.
WebMCP supports the Permissions Policy header, giving you control over which origins can access your tools. This is critical for cross-origin iframe scenarios:
Permissions-Policy: web-mcp=(self "https://trusted-agent.com")
navigator.modelContext.unregisterTool(toolName)
Each tool should represent a user intent, not an API endpoint. Instead of
getProductData + getPricingData + getAvailabilityData,
create one searchProducts(query, filters) tool that returns everything an agent
needs to make a decision.
Your site must work perfectly without WebMCP. The agent layer is an enhancement, not a requirement. Test your site with WebMCP disabled — if it breaks, you've done it wrong.
Tool names and descriptions are what agents use to choose the right tool. Be explicit:
process(data)searchFlights(origin, destination, date, passengers)Return structured errors so the agent can recover. If a flight search returns no results, the agent should know it's a "no results" vs "server error" vs "invalid parameters" situation:
handler: async (params) => {
try {
const data = await searchFlightsApi(params);
return {
success: true,
results: data,
totalCount: data.length
};
} catch (error) {
return {
success: false,
error: {
code: 'NO_RESULTS',
message: 'No flights found for the given criteria',
suggestion: 'Try different dates or nearby airports'
}
};
}
}
As your site evolves, tools may change. Use the tool name to communicate versioning:
searchFlights_v2 or include version in your tool definition
metadata if supported.
Chrome provides an Inspector Extension that lets you imitate agent chat and test your tools without writing a separate agent application. You can:
Open Chrome DevTools, look for the "WebMCP" panel (available under the "AI" section when the flag is enabled). From there, you can interact with your tools as if you were an AI agent.
WebMCP is more than just another API — it's a fundamental rethinking of how websites interact with non-human visitors. As AI agents become the primary interface for more and more users (booking travel, shopping, managing tasks), websites that expose structured, agent-friendly tool interfaces will have a significant competitive advantage.
For SEO and discoverability: Just as semantic HTML helped search engines understand web content in the 2000s, WebMCP helps AI agents understand web functionality in the 2020s. A website with well-defined WebMCP tools is more likely to be used by agents on behalf of users — effectively a new form of agent-side discoverability.
For web developers: This is a new skill to learn, but the fundamentals are familiar. If you've written REST APIs, you can write WebMCP tools. If you've used structured data (JSON-LD) for SEO, you understand the concept of machine-readable metadata. WebMCP applies the same principle to functionality.
The combination of Chrome's Built-in AI (Prompt API with on-device Gemini Nano) with WebMCP is particularly powerful. A user's browser can run a local AI agent that understands your website's tools natively, executes them on-device, and returns results — all without any server calls to third-party AI providers. For a deeper dive into browser-native AI, see my Chrome Prompt API guide. To understand the JavaScript platform features powering these modern APIs, read the ES2026 Complete Guide.
navigator.modelContext browser API. Instead of an agent guessing where to click on a page, the website declares exactly what operations it supports — search, book, filter, checkout — as typed JavaScript functions that agents can call directly.navigator.modelContext and works with any website. Anthropic's MCP is a protocol for connecting LLM applications to external data sources and tools via a standalone server. WebMCP focuses on in-browser agent-website interaction, while MCP focuses on server-to-LLM tool connectivity. They can complement each other: a website using WebMCP could expose tools that an MCP server brokers to an LLM.chrome://flags or an origin trial token. The API is in active development — Google encourages developers to experiment and provide feedback. The API surface may change before standardization. For the latest status, check the Chrome Platform Status page.WebMCP represents a major shift in how websites will interact with AI agents. The early adopters — websites that invest in structured, agent-friendly interfaces now — will have a significant advantage as AI-driven browsing becomes mainstream.
I'm a full-stack developer with deep experience in modern web APIs, browser technologies, and AI integration. If you're planning to make your website agent-ready with WebMCP or exploring how AI will impact your web strategy, let's talk — I provide free initial consultations.
Planning to prepare your website for AI agents? I can help you implement WebMCP, integrate browser AI, and build for the agentic web.