Home / Articles / WebMCP: exposing website tools so agents stop scraping the DOM

This article is published in English.

WebMCP: exposing website tools so agents stop scraping the DOM

WebMCP lets pages declare structured tools for AI agents—imperative and declarative APIs—so bookings and checkouts stop relying on brittle browser automation.

904 words

Websites were designed for human clicks, forms, and APIs. Increasingly, the “user” may be an AI agent that never touches the visual UI. Agents that scrape DOM trees or drive browsers break when markup shifts. WebMCP (Web Model Context Protocol), proposed in the Chrome ecosystem, aims to let sites expose structured tools directly to agents—names, inputs, outputs, and when to call them—so automation becomes explicit rather than inferred.

What is WebMCP?

In short, WebMCP lets a page publish agent-facing tools instead of hoping scrapers guess correctly.

Without WebMCP, an agent improvises against opaque UI:

AI Agent → Reads HTML → Guesses → Clicks → Hopes it works

With WebMCP, the same intent becomes a declared tool call:

AI Agent → Reads structured tools → Executes correctly

Chrome’s documentation frames the win as speed, reliability, and precision for agentic interactions.

Why WebMCP exists

Consider booking a hotel. The fragile path opens a page, finds inputs, interprets dates, clicks search, and parses results—brittle under DOM churn. With WebMCP the agent invokes a structured operation:

searchHotels({
 location: "Tokyo",
 checkIn: "2026-08-10",
 checkOut: "2026-08-15",
 guests: 2
})

No XPath archaeology, no CSS selector roulette, no vision detours for routine flows—just typed execution.

How WebMCP works

Two complementary APIs:

1. Imperative API

JavaScript registers tools explicitly:

navigator.webMCP.registerTool({
  name: "create-event",
  description: "Creates a calendar event",
  inputSchema: {
    type: "object",
    properties: {
      title: { type: "string" },
      date: { type: "string" }
    }
  },
  execute: async ({ title, date }) => {
    return await createCalendarEvent(title, date);
  }
});

Agents receive tool name, purpose, required inputs, and an execution path—frontend logic exported as callable capabilities.

2. Declarative API

HTML-first, especially for forms:

<form webmcp-tool="book-flight">
  <input name="from" />
  <input name="to" />
  <input name="date" />
</form>

The runtime lifts the form into a structured tool, so existing apps can become agent-compatible with small markup changes.

WebMCP versus MCP

Confusion is common. A practical split: WebMCP targets the frontend surface; MCP targets backend systems and services. One mental model is MCP as the server-side brain and WebMCP as the UI body. Together they cover full-stack agent tooling without forcing every action through brittle browser automation.

Real-world use cases

1. Ecommerce

A shopper asks for running shoes under a budget and checkout. Declared tools might include:

searchProducts()
filterProducts()
addToCart()
applyCoupon()
checkout()

The agent completes the flow without clicking through grids.

2. Travel booking

Search flights, compare hotels, book ground transport, add insurance—via tools, not fragile macros.

3. SaaS dashboards

Analytics surfaces can publish operations such as:

generateReport()
downloadCSV()
inviteMember()
changeBillingPlan()

In-product copilots then call the same capabilities humans see as buttons.

4. CRM systems

Instead of ten screens of clicks:

createLead()
assignSalesRep()
scheduleFollowUp()

5. Customer support

Cancel subscriptions, raise refunds, track shipments through audited tools rather than HTML archaeology.

Why developers should care

Frontend work expands from “paint pixels” to “publish tools for agents.” Responsibilities shift toward clear naming, strong schemas, and reliable execution. The before/after of feature design looks less like:

Build components for humans

and more like:

Build components for humans + machines

Best practices

Keep tools single-purpose

Avoid kitchen-sink operations:

manageEverything()

Prefer focused tools:

createInvoice()
sendInvoice()
downloadInvoice()

Specificity improves agent accuracy.

Use clear names

Opaque labels:

doTask()

Intent-revealing names:

submitExpenseClaim()

Reduce cognitive load

Do not force the model to pre-compute what the app already knows. Avoid:

durationInMinutes

Prefer accepting raw inputs the backend can normalize:

startTime: "10:00"
endTime: "12:00"

Handle failures gracefully

Agents retry. Tools should be safe under retries—idempotency matters.

Security concerns

If agents can execute tools, hostile script injection of fake tools is a research concern. Mitigations to plan for include origin validation, registration auditing, permission boundaries, and user confirmations for side effects. Do not trust registrations blindly.

The bigger picture

WebMCP sits inside a broader agentic web: sites expose capabilities, agents understand them, people delegate, work finishes faster. Teams already build APIs for developers; the next surface is tools for agents. Early adopters who ask “which parts of this app should become AI tools?” will shape the next wave of web architecture—similar to how REST, GraphQL, WebSockets, and server components moved from niche to default. The technology is early, but the direction is hard to ignore.

Adoption path for existing apps

Start by marking one high-value form or checkout step with the declarative API, measure agent success against the old scraper, then expand imperative tools for flows that need custom validation. Keep a human confirmation gate on payments and destructive account changes until telemetry shows safe idempotency. Treat tool schemas like public APIs: review names, version them, and reject registrations from untrusted scripts.