WebMCP Agents
Let AI agents use your web page, and let the person on it see every step.
With WebMCP, a page hands an AI agent tools it can call: “add to cart”, “place order”. WebMCP Agents makes every call visible to the person on the page: a ghost cursor flies to the control, types the agent’s values into the real fields, and stops for a real click on anything that matters.
An agent adds a tee to the cart: the cursor flies to the form, types the values and clicks, and the cart opens.
A tool is one function with two callers
You already have the function. A person clicks the button; an agent calls the tool.
// An agent calls this.
useWebTool({
id: "clear_cart",
title: "Clear cart",
description: "Empty the cart. The user confirms on the page.",
requireConfirmation: true,
execute: clear,
});
// A person clicks this.
<Button onClick={clear}>Clear cart</Button>
Nothing is added to the button for the cursor: it finds the control by its name, like a screen reader would. With
requireConfirmation it parks there, and clear runs only after the person’s own click.
Choose your framework
Pick one. The docs remember it, and every page after shows that framework’s code.
Vite
A single-page app with React.
Next.js
The App Router, with client components for the tools.
TanStack Start
Full-stack React on Vite and TanStack Router.
Astro
Server-rendered pages with a React island.
No framework
Plain HTML and TypeScript, with createWebAgents.
Already set up?
Go straight to what you want to do. Each page shows your framework’s code.
| I want to… | Read |
|---|---|
| Let an agent press a button on my page | Define a tool |
| Let it fill in a form | Tools with input |
| Make it wait for the person’s click | Confirm before it runs |
| Have tools for the whole app, on the right pages | Tools across your app |
| Give it the time, the location, the current page | Common tools |
| Run a tool from my own button | Call a tool |
| Tell the assistant how my site works | Define an agent |
| Put a chat on the page | Add the chat |
| Run the assistant without a chat | Call an agent |
| See what the agent sees, and run tools myself | Devtools |
| Run the model in the browser, with no server | On-device agent |
| Ship it | Deploy |
Looking for one API? Open the reference.