> ## Documentation Index
> Fetch the complete documentation index at: https://piyushvyas.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# BAP vs WebMCP

> Universal browser automation vs cooperative website tools -- complementary technologies for AI agents.

## The Fundamental Difference

BAP and WebMCP solve different problems at different layers of the AI-browser interaction stack.

<CardGroup cols={2}>
  <Card title="BAP: Universal Model" icon="globe">
    The agent controls the browser directly. Works on any website through accessibility tree
    inspection, semantic selectors, and browser automation. No site changes required.
  </Card>

  <Card title="WebMCP: Cooperative Model" icon="handshake">
    The website exposes tools to agents. Requires the site author to annotate forms or register
    tools via JavaScript. The agent discovers only what the site chooses to expose.
  </Card>
</CardGroup>

## Comparison

| Dimension             | BAP                                                                                    | WebMCP                                                      |
| --------------------- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| **Who acts**          | Agent controls the browser                                                             | Website provides tools; agent calls them                    |
| **Site cooperation**  | Not required                                                                           | Required                                                    |
| **Coverage**          | Every website                                                                          | Only sites that implement WebMCP                            |
| **Interaction model** | Browser automation (observe, click, fill, extract)                                     | Function call (invoke a declared tool)                      |
| **Available today**   | Yes (npm, PyPI)                                                                        | Chrome 146 Canary (behind experimental flag)                |
| **Browser support**   | Chromium, Firefox, WebKit                                                              | Chrome only (no other browsers announced)                   |
| **Performance**       | Fusion operations cut roundtrips; response tiers minimize payloads                     | Single function call per tool, no DOM traversal overhead    |
| **Capabilities**      | Full browser control (navigation, forms, screenshots, storage, multi-tab)              | Scoped to declared tools only                               |
| **Developer effort**  | Install one package                                                                    | Per-site HTML/JS annotation                                 |
| **Ecosystem**         | TypeScript SDK, Python SDK, MCP bridge, CLI (26 commands), 13 platform skill installer | W3C Community Group spec, Chrome implementation in progress |

## Complementary, Not Competing

These technologies address different parts of the problem:

| Aspect          | BAP                | WebMCP                       | Together                                         |
| --------------- | ------------------ | ---------------------------- | ------------------------------------------------ |
| **Works on**    | Any website        | Opted-in websites            | Every website, with richer tools where available |
| **Interaction** | Browser automation | Tool invocation              | Agent picks the best approach per-action         |
| **Available**   | Today              | Chrome Canary (experimental) | BAP bridges WebMCP tools as they appear          |
| **Site effort** | None               | Attributes or JavaScript     | Incremental -- sites add WebMCP at their pace    |

## The Progressive Strategy

When an agent encounters a page:

<Steps>
  <Step title="Check for WebMCP tools">
    Call `discover_tools` or use `observe({ includeWebMCPTools: true })`. If tools are available, prefer them -- they represent the site's intended agent interface with defined semantics.
  </Step>

  <Step title="No WebMCP tools?">
    Fall back to BAP's universal automation: observe the page, identify interactive elements, and act.
  </Step>

  <Step title="Partial coverage?">
    Use WebMCP tools for declared functionality, BAP automation for everything else.
  </Step>
</Steps>

## BAP's Built-In WebMCP Bridge

BAP includes first-class WebMCP support so agents do not need a separate integration:

| BAP Feature                             | What It Does                                                                                              |
| --------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `discovery/discover`                    | Protocol method to scan a page for WebMCP tools                                                           |
| `discover_tools`                        | MCP tool for agent-facing discovery                                                                       |
| `observe({ includeWebMCPTools: true })` | Fused discovery -- get elements and WebMCP tools in one call                                              |
| Progressive detection                   | Declarative scan (HTML attributes) then imperative scan (`navigator.modelContext`) then graceful fallback |

```typescript theme={null}
const obs = await client.observe({
  includeInteractiveElements: true,
  includeWebMCPTools: true,
});

// Standard elements available on every page
console.log("Elements:", obs.interactiveElements?.length);

// WebMCP tools available only on cooperative pages
console.log("WebMCP tools:", obs.webmcpTools?.length ?? 0);
```

<Tip>
  Calling `discover_tools` costs nothing on pages without WebMCP -- it returns an empty list with no
  errors. Call it speculatively on every page. When WebMCP adoption grows, agents automatically
  benefit.
</Tip>

## When to Use Which

| Priority                       | Approach                            | Why                                                        |
| ------------------------------ | ----------------------------------- | ---------------------------------------------------------- |
| Max speed on cooperative sites | WebMCP tools (via `discover_tools`) | No DOM traversal, native function call                     |
| Universal coverage             | BAP automation (`observe` + `act`)  | Works on any site today                                    |
| Fewest tokens                  | BAP fused ops + response tiers      | Fewer roundtrips, smaller payloads                         |
| Best of all worlds             | BAP + `includeWebMCPTools`          | Automatic fallback -- WebMCP when available, BAP otherwise |
