Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/v020-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@browseragentprotocol/protocol": minor
"@browseragentprotocol/logger": minor
"@browseragentprotocol/client": minor
"@browseragentprotocol/server-playwright": minor
"@browseragentprotocol/mcp": minor
---

v0.2.0 — browser selection, clean tool names, smarter extract
7 changes: 7 additions & 0 deletions .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "BAPBrowser",
"description": "AI-optimized browser automation with semantic selectors, smart observations, and multi-step actions. Navigate, click, fill forms, extract data, and take screenshots across Chrome, Firefox, and WebKit.",
"author": {
"name": "Browser Agent Protocol"
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ coverage/
# Claude Code instructions (local only)
CLAUDE.md
docs/plans/

# Internal roadmap (local only)
ROADMAP.md
8 changes: 8 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"bap-browser": {
"command": "npx",
"args": ["-y", "@browseragentprotocol/mcp@0.2.0"]
}
}
}
75 changes: 55 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Browser Agent Protocol (BAP)

[![npm version](https://badge.fury.io/js/@browseragentprotocol%2Fprotocol.svg)](https://www.npmjs.com/package/@browseragentprotocol/protocol)
[![npm version](https://badge.fury.io/js/@browseragentprotocol%2Fmcp.svg)](https://www.npmjs.com/package/@browseragentprotocol/mcp)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

An open standard for AI agents to interact with web browsers.

> **v0.1.0:** First public release. APIs may evolve based on feedback.
> **v0.2.0:** Renamed MCP tools, auto-reconnect, multi-context support, streaming, and more. APIs may evolve based on feedback.

## Overview

Expand Down Expand Up @@ -49,69 +49,104 @@ BAP (Browser Agent Protocol) provides a standardized way for AI agents to contro

## Quick Start

### Using with MCP (Recommended for AI Agents)
BAP works with any MCP-compatible client. The server auto-starts — no separate setup needed.

BAP works with any MCP-compatible client including Claude Code, Claude Desktop, OpenAI Codex, and Google Antigravity.
### Claude Code

**Claude Code:**
**MCP server** (one command):
```bash
claude mcp add --transport stdio bap-browser -- npx @browseragentprotocol/mcp
claude mcp add --transport stdio bap-browser -- npx -y @browseragentprotocol/mcp
```

**Plugin** (includes SKILL.md for smarter tool usage):
```bash
claude plugin add --from https://github.com/browseragentprotocol/bap
```

<p align="center">
<img src="assets/claude-code-demo.png" alt="BAP with Claude Code" width="600"><br>
<img src="assets/claude-code-demo.png" alt="BAP in Claude Code" width="600"><br>
<em>Claude Code browsing Hacker News with BAP</em>
</p>

**Claude Desktop** (`claude_desktop_config.json`):
### Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
"mcpServers": {
"bap-browser": {
"command": "npx",
"args": ["@browseragentprotocol/mcp"]
"args": ["-y", "@browseragentprotocol/mcp"]
}
}
}
```

Restart Claude Desktop after saving.

<p align="center">
<img src="assets/claude-desktop-demo.png" alt="BAP with Claude Desktop" width="600"><br>
<img src="assets/claude-desktop-demo.png" alt="BAP in Claude Desktop" width="600"><br>
<em>Claude Desktop browsing Hacker News with BAP</em>
</p>

**Codex CLI:**
### Codex CLI

```bash
codex mcp add bap-browser -- npx @browseragentprotocol/mcp
codex mcp add bap-browser -- npx -y @browseragentprotocol/mcp
```

Or add to `~/.codex/config.toml`:

```toml
[mcp_servers.bap-browser]
command = "npx"
args = ["-y", "@browseragentprotocol/mcp"]
```

<p align="center">
<img src="assets/codex-cli-demo.png" alt="BAP with OpenAI Codex CLI" width="600"><br>
<img src="assets/codex-cli-demo.png" alt="BAP in Codex CLI" width="600"><br>
<em>Codex CLI browsing Hacker News with BAP</em>
</p>

**Codex Desktop** (`~/.codex/config.toml`):
### Codex Desktop

Add to `~/.codex/config.toml`:

```toml
[mcp_servers.bap-browser]
command = "npx"
args = ["@browseragentprotocol/mcp"]
args = ["-y", "@browseragentprotocol/mcp"]
```

<p align="center">
<img src="assets/codex-desktop-demo.png" alt="BAP with OpenAI Codex Desktop" width="600"><br>
<img src="assets/codex-desktop-demo.png" alt="BAP in Codex Desktop" width="600"><br>
<em>Codex Desktop browsing Hacker News with BAP</em>
</p>

> **💡 Tip:** Codex may default to web search. Be explicit: *"Using the bap-browser MCP tools..."*
### Browser Selection

By default, BAP uses your locally installed Chrome. You can choose a different browser with the `--browser` flag:

```bash
npx @browseragentprotocol/mcp --browser firefox
```

| Value | Browser | Notes |
|---|---|---|
| `chrome` (default) | Local Chrome | Falls back to bundled Chromium if not installed |
| `chromium` | Bundled Chromium | Playwright's built-in Chromium |
| `firefox` | Firefox | Requires local Firefox |
| `webkit` | WebKit | Playwright's WebKit engine |
| `edge` | Microsoft Edge | Requires local Edge |

**Antigravity** (`mcp_config.json` via "..." → MCP Store → Manage):
In a JSON MCP config, pass the flag via args:
```json
{
"mcpServers": {
"bap-browser": {
"command": "npx",
"args": ["@browseragentprotocol/mcp"]
"args": ["-y", "@browseragentprotocol/mcp", "--browser", "firefox"]
}
}
}
Expand Down Expand Up @@ -255,7 +290,7 @@ const data = await client.extract({
});
```

> **Note:** `agent/extract` (and `bap_extract` in MCP) uses heuristic-based extraction (CSS patterns). For complex pages, consider using `bap_content` to get page content as markdown and extract data yourself.
> **Note:** `agent/extract` (and `extract` in MCP) uses heuristic-based extraction (CSS patterns). For complex pages, consider using `content` to get page content as markdown and extract data yourself.

## Server Options

Expand Down
37 changes: 37 additions & 0 deletions packages/client/src/__tests__/client-methods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,43 @@ describe("BAPClient Methods", () => {
expect(parsed.params.headless).toBe(true);
});

it("launch() passes channel param correctly", async () => {
const { client, transport } = await createConnectedClient();
transport.setAutoResponse("browser/launch", { browserId: "browser-2" });

const result = await client.launch({ browser: "chromium", channel: "chrome", headless: false });

expect(result.browserId).toBe("browser-2");

const launchRequest = transport.sentMessages.find((msg) => {
const parsed = JSON.parse(msg);
return parsed.method === "browser/launch";
});
expect(launchRequest).toBeDefined();
const parsed = JSON.parse(launchRequest!);
expect(parsed.params.browser).toBe("chromium");
expect(parsed.params.channel).toBe("chrome");
expect(parsed.params.headless).toBe(false);
});

it("launch() without channel works (backwards compat)", async () => {
const { client, transport } = await createConnectedClient();
transport.setAutoResponse("browser/launch", { browserId: "browser-3" });

const result = await client.launch({ browser: "firefox" });

expect(result.browserId).toBe("browser-3");

const launchRequest = transport.sentMessages.find((msg) => {
const parsed = JSON.parse(msg);
return parsed.method === "browser/launch";
});
expect(launchRequest).toBeDefined();
const parsed = JSON.parse(launchRequest!);
expect(parsed.params.browser).toBe("firefox");
expect(parsed.params.channel).toBeUndefined();
});

it("closeBrowser() sends correct request", async () => {
const { client, transport } = await createConnectedClient();
transport.setAutoResponse("browser/close", {});
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export class BAPClient extends EventEmitter {
this.options = {
token: options.token,
name: options.name ?? "bap-client",
version: options.version ?? "0.1.0",
version: options.version ?? "0.2.0",
timeout: options.timeout ?? 30000,
events: options.events ?? ["page", "console", "network", "dialog"],
};
Expand Down
Loading
Loading