DEV Community

Chrome’s WebMCP Early Preview: the end of “AI agents clicking buttons”

If you’ve ever watched an AI agent “use” a website by guessing which button is “Checkout” and where the “Passenger Name” goes… you already know the core problem:

the web UI is for humans, but agents need structure.

That’s exactly what WebMCP is trying to fix.

WebMCP is a proposed web standard that lets a website expose structured tools directly to in-browser AI agents—so agents can call real functions (with schemas) instead of screen-scraping and hoping the DOM didn’t change.

Think of it as “MCP, but built into the browser tab.”


The big idea: publish tools, not pixels

WebMCP’s promise is simple:

Instead of an agent guessing what a button does, your site explicitly publishes a contract:

  • Discovery: what tools exist on this page (checkout, filter_results, etc.)
  • JSON Schemas: exactly what inputs/outputs look like (to reduce hallucinations)
  • State: shared understanding of what’s available right now on the page

That’s the difference between:

  • “Click around until something works”
  • and “Call book_flight({ origin, destination, outboundDate… })

The spec even highlights scenarios like flight booking, complex forms (medical/legal), and hidden “run diagnostics” flows.


Why this matters (even if you don’t care about agents)

Because agents are only going to become more common, and today’s integration methods are… messy:

  • brittle UI automation
  • DOM scraping
  • weird accessibility hacks
  • page updates breaking flows every week

WebMCP is basically saying:

“If agents are going to operate inside browsers, the browser should provide the handshake.”

And from a product perspective, it’s also a shift in control: the site defines what actions are allowed and how data should be passed.


How to try WebMCP in ~5 minutes

WebMCP is currently an early preview behind a flag in Chrome 146.
Currently, in the Canary Channel.

1) Enable the flag

Go to chrome://flags, search for WebMCP for testing, enable it, relaunch Chrome.

(If you’ve never used flags before: Chrome flags primer)

2) Install the inspector extension

There’s a Model Context Tool Inspector Extension that lets you:

  • see registered tools
  • execute tools manually
  • test with an agent using Gemini API integration

3) Use the live travel demo

The doc links a hosted demo and walks you through manually running a searchFlights tool (or invoking it via natural language).

Live demo: https://travel-demo.bandarra.me/


Two ways to expose tools: Imperative vs Declarative

WebMCP gives you two APIs.

1) Imperative API (JavaScript tools)

You register tools with navigator.modelContext:

  • registerTool() adds one tool without removing others
  • unregisterTool() removes a tool by name
  • provideContext() replaces the full toolset (useful when app state changes)
  • clearContext() removes everything

The key detail: tools include name, description, inputSchema, and execute().

2) Declarative API (turn HTML forms into tools)

This is the spicy part.

You can annotate an ordinary <form> with:

  • toolname
  • tooldescription
  • and optionally toolautosubmit

…and the browser will translate the form fields into a structured tool schema that agents can use.

Even better: when an agent invokes it, the browser can focus the form and pre-fill the fields. By default, the user still clicks submit—unless you enable autosubmit.


The hidden gem: agentInvoked + respondWith()

WebMCP adds agent-awareness to form submission.

  • SubmitEvent.agentInvoked tells you the submit came from an AI agent.
  • SubmitEvent.respondWith(Promise<any>) lets your form handler return a value back to the model as tool output (after preventDefault()).

This is a big deal because it means your web app can:

  • validate normally for humans
  • but return structured errors/results for agents (so they can self-correct)

UX signals: events + CSS pseudo-classes

When a tool is invoked via the declarative path:

  • "toolactivated" event fires when fields are pre-filled
  • "toolcancel" fires if the user cancels or resets the form

And the browser applies pseudo-classes for visual feedback:

  • :tool-form-active on the form
  • :tool-submit-active on the submit button

Chrome even defines placeholder styles by default.


Tool design rules that will save you weeks of pain

The doc includes a best-practices section that’s basically a cheat code for making tools agent-friendly:

1) Name tools like you mean it

Use verbs that describe the action precisely, and distinguish executing vs initiating a UI flow (e.g., create-event vs start-event-creation-process).

2) Design schemas that reduce “model math”

If the user says “11:00 to 15:00”, accept strings—don’t force the model to compute minutes-from-midnight.

3) Validate strictly in code, loosely in schema

Assume the schema won’t fully protect you. Return descriptive errors so the model can retry correctly.

4) Make tools atomic + composable

Avoid a zoo of overlapping tools. Prefer one tool with parameters over ten near-duplicates.


Limitations (read these before you get too excited)

This is still an early preview, and the doc is clear about what’s missing:

  • No headless mode: tool calls require a visible browsing context (tab/webview).
  • UI must stay in sync: your app has to reflect state updates whether they come from a human or an agent.
  • Complex apps may need refactors to make tool-driven UI updates clean.
  • Discoverability isn’t solved: there’s no built-in way for clients to know which sites support tools without visiting them.

Translation: WebMCP isn’t a magic wand. It’s a contract—you still have to implement the contract well.


WebMCP vs MCP (the 10-second explanation)

  • MCP: server-side protocol; you deploy tools on your own server. (https://modelcontextprotocol.io/)
  • WebMCP: inspired by MCP, but lets you provide tools to in-browser agents using client-side functions or annotated forms.

Where this goes next (and why you should care now)

If WebMCP lands as a real standard, it nudges the web toward a new baseline expectation:

every serious web app becomes both:

  • a UI for humans
  • a tool surface for agents

And the apps that win won’t be the ones with the prettiest interface—they’ll be the ones with the clearest tool contracts.


Want to influence the spec?

The doc explicitly asks for feedback around use cases, API shape/usability, tooling, and implementation issues.

There are links for:


Your turn

If you were adding WebMCP to a real product, what would your first tool be?

  • checkout
  • book_appointment
  • export_report
  • reset_password
  • something else entirely?

And what’s the one UI flow you’d love to delete from your “agent automation” backlog forever?

P.S. Check Vexrail's Newsletter to know more about Monetization / Advertising in AI chat apps

Top comments (11)

Collapse
 
haribalaji_b profile image
hari balaji

For those who are searching for the flag,
The flag name is "Experimental Web Platform features"

Collapse
 
draganfill profile image
Dragan Filipović

Strange, in Canary it has its own flag.

WebMCP for testing
Enter fullscreen mode Exit fullscreen mode

Collapse
 
axrisi profile image
Nikoloz Turazashvili (@axrisi)

I thought it's only on Canary build. Is this in prod chrome version?

Collapse
 
haribalaji_b profile image
hari balaji

The screenshot i shared is from canary.

Collapse
 
anmolbaranwal profile image
Anmol Baranwal

didn't know about this. let me dive a little over the weekend. have you tried any agents that run in the browser (using this pattern). I know a couple of frameworks but never tried it.

Collapse
 
axrisi profile image
Nikoloz Turazashvili (@axrisi)

I have tried only the demo website for plane tickets that is described in the article. Haven't seen any other demos. Drop here if you find them

Collapse
 
anmolbaranwal profile image
Anmol Baranwal

the values on the demo is hardcoded (which you only see after trying a random query) and still it doesn't work for me somehow. Maybe it's happening because I didn't enable the flag.

Thread Thread
 
axrisi profile image
Nikoloz Turazashvili (@axrisi)

They are hardcoded, but it doesn't really matter. AI agent called the Tool. it doesn't matter if it didn't find actual tickets.

But for sure you need to enable the flag. for me hardest was to find the right channel that has the right chrome version. I installed all of them, Beta, Dev, Canary. haha. worked on Canary!

Collapse
 
nedcodes profile image
Ned C

This is really interesting. The "publish tools, not pixels" framing nails it.

The parallel to how we handle AI coding tools is striking. Right now with Cursor and similar tools, we give the AI context through rules files and documentation instead of letting it guess from the code. WebMCP is basically the same idea applied to browsers - give the agent structured context instead of making it reverse-engineer the UI.

The adoption challenge is real though. Getting websites to voluntarily expose structured APIs for agents to use is a chicken-and-egg problem. Sites won't add WebMCP until agents use it, and agents won't prioritize it until sites support it.

Collapse
 
netsi1964 profile image
netsi1964 🙏🏻

Thank you for sharing - I made a demo here: netsi.dk/experiments/webMCP.html

Collapse
 
axrisi profile image
Nikoloz Turazashvili (@axrisi)

Works like a charm!
Good one! Really liked it.