Skip to main content

What Is WebMCP?

WebMCP is a W3C Community Group standard that allows websites to expose structured tools to AI agents through browser-native APIs. Websites can opt in by annotating HTML forms or registering tools via JavaScript. BAP includes first-class WebMCP support — agents using BAP do not need a separate WebMCP integration.

Two API Surfaces

Declarative (HTML Attributes)

Websites annotate forms with tool metadata:

Imperative (JavaScript)

Websites register tools programmatically:

Discovering WebMCP Tools

CLI

TypeScript SDK

MCP Tool

The discover_tools MCP tool is available to any MCP-native agent:

Fused Discovery with Observe

Get interactive elements and WebMCP tools in a single call:

Progressive Detection

BAP’s discovery implementation follows a three-step strategy:
1

Declarative Scan

Query the DOM for form[toolname] elements and extract tool metadata from HTML attributes. Fast, no JavaScript execution required.
2

Imperative Scan

Check for navigator.modelContext and enumerate programmatically registered tools. Catches dynamic tools without DOM representation.
3

Graceful Fallback

If neither API surface is present, return an empty tool list with totalDiscovered: 0. No errors — the agent proceeds with standard BAP automation.

Agent Decision Pattern

The recommended pattern for agents:
Today, discover_tools returns empty on virtually every website — WebMCP adoption is in early stages (Chrome 146 Canary behind a flag). But calling it costs nothing. Call it speculatively on every page. When adoption grows, agents automatically benefit without code changes.

Discovery Response Format

Each tool includes a source field: "webmcp-declarative" for HTML attribute-based tools or "webmcp-imperative" for JavaScript API-based tools.