Guesswork
Inferring intent from labels, classes, and layout.
Google I/O Extended Nairobi 2026 · Agent-Ready Websites with WebMCP
Today, agents parse HTML, the accessibility tree, and screenshots — brittle, slow, and easy to get wrong.
WebMCP lets your site declare what it can do as structured tools on
document.modelContext. Agents see a contract, supply JSON arguments, and your code runs —
with the user still in control.
Same page action, two agent strategies. Play the simulation — scraping fumbles through the UI; WebMCP calls one registered tool with structured arguments.
Inferring intent from labels, classes, and layout.
One registered tool — name, schema, arguments. Same contract as imperative registerTool.
Simulation only on this page. Live sites with real registerTool and declarative forms are linked below.
Three steps — whether you register tools in JavaScript or annotate HTML forms.
Declare actions an agent can take: name, description, JSON Schema, and an execute handler — the same shape as server-side MCP tools. Use the Imperative API (registerTool) or the Declarative API (form attributes).
A WebMCP-aware browser or extension collects tools from document.modelContext and presents them to the user's agent — scoped to your origin, alongside the page URL and title.
No more “find the right button.” The agent picks a tool, supplies structured arguments, and your handler runs — navigation, search, booking, content generation, or read-only lookups.
Same tool contract — name, description, JSON Schema, and an execute handler. Different runtime: server-side MCP servers vs tools registered by the page in the browser.
| Aspect | MCP | WebMCP |
|---|---|---|
| Where it runs | Server or desktop — an MCP host connects to MCP servers | Browser tab — the open web page on your origin |
| Who provides tools | MCP servers (GitHub, Postgres, filesystem, custom APIs) | Your site via document.modelContext |
| Transport | stdio, SSE, or streamable HTTP between host and server | In-page JavaScript API; browser bridges tools to the agent |
| Tool shape | name, description, inputSchema, handler |
Same — imperative registerTool or declarative form attributes |
| Agent access | Agent connects to configured MCP servers as a client | Agent reads tools from the page the user has open |
| Best for | Backend data, files, APIs, long-running or offline jobs | User-facing actions — forms, search, filters, navigation, booking |
| User context | Server-side credentials and permissions | User session, cookies, and visible UI state on that page |
| Setup | Install and run an MCP server; wire it in your agent host | Add registerTool or WebMCP form attributes to your site |
WebMCP brings MCP-style tools to the web platform. Many agent flows use both — MCP servers for backend access, WebMCP for what the user is doing in the browser right now.
Pick the API that fits your stack. Many sites use both — imperative tools for app logic, declarative forms for simple inputs.
registerToolSearch, filters, navigation, state — anything your app already does in code. Full control over schema and execution.
document.modelContext.registerTool({
name: "sessions_search",
description: "Search public session listings.",
inputSchema: {
type: "object",
properties: {
query: { type: "string" },
room: { type: "string" }
}
},
annotations: { readOnlyHint: true },
execute({ query, room }) {
return { sessions: filterSessions(query, room) };
}
});
Standard <form> plus WebMCP attributes — no JS wiring. The browser derives the tool schema from fields.
<form toolname="draft_content"
tooldescription="Create a content draft"
toolautosubmit>
<select name="topic"
toolparamdescription="Subject">…</select>
<select name="tone"
toolparamdescription="Voice">…</select>
<button type="submit">Generate</button>
</form>
Blackie Labs explains WebMCP. These companion sites ship both imperative and declarative tools — fork them for your own event or product.
HTML forms with toolname and toolparamdescription — social posts, speaker intros, no extra JS.
registerTool for session search, speaker lookup, schedule building, and navigation — full agent-ready event site.
The platform hook is document.modelContext (also exposed on navigator.modelContext in some builds).
registerTool(def, opts?)execute. Pass { signal } to unregister on teardown.getTools()toolname · tooldescription<form>. Names the tool and tells agents when to use it.toolparamdescription · toolautosubmitreadOnlyHint and avoid PII in tool inputs on public pages.modelContext, not DOM scraping.registerTool tools).Inspired by the Chrome Labs explainer — tailored for GDG Nairobi with both imperative and declarative examples.