@agent-browser-io/browser 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
# @agent-browser-io/browser
|
|
2
2
|
|
|
3
|
-
Token efficient agent browser
|
|
3
|
+
**Token efficient agent browser.**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @agent-browser-io/browser
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
**ESM (TypeScript / modern Node / bundlers):**
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { VERSION } from '@agent-browser-io/browser';
|
|
17
|
-
```
|
|
5
|
+
This package lets AI agents control a real browser ( navigate, click, type, interact via ASCII wireframes ) in a token-efficient way. Use it from [MCP](https://modelcontextprotocol.io) clients (e.g. Cursor, Claude Desktop) or from code with the [Vercel AI SDK](https://sdk.vercel.ai).
|
|
18
6
|
|
|
19
|
-
**
|
|
7
|
+
**Ways to use:**
|
|
20
8
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
- **MCP** — Add the included MCP server to Cursor or another MCP client so the AI can drive a browser (see [How to add MCP](#how-to-add-mcp)).
|
|
10
|
+
- **Vercel AI SDK** — Use `createBrowserTools(browser)` with `generateText({ tools, ... })` in your app (see [Vercel AI SDK](#vercel-ai-sdk)).
|
|
11
|
+
- **CLI** — Run the interactive CLI for manual testing (`npx @agent-browser-io/browser` or `agent-browser-cli` after install).
|
|
24
12
|
|
|
25
|
-
|
|
13
|
+
## Install
|
|
26
14
|
|
|
27
15
|
```bash
|
|
28
|
-
|
|
29
|
-
# or, after install: browser
|
|
16
|
+
npm install @agent-browser-io/browser
|
|
30
17
|
```
|
|
31
18
|
|
|
32
|
-
Uses Node.js `readline` for a REPL. Commands: `help`, `version`, `exit` (or `q`).
|
|
33
|
-
|
|
34
19
|
## How to add MCP
|
|
35
20
|
|
|
36
|
-
|
|
21
|
+
[MCP](https://modelcontextprotocol.io) (Model Context Protocol) lets AI assistants in Cursor or Claude Desktop use browser tools over stdio. Your AI will be able to launch a browser, open URLs, get wireframes, click, type, scroll, screenshot, and more.
|
|
37
22
|
|
|
38
23
|
**Run the MCP server (for testing):**
|
|
39
24
|
|
|
@@ -61,7 +46,7 @@ npx @agent-browser-io/browser mcp
|
|
|
61
46
|
|
|
62
47
|
**Other MCP clients (e.g. Claude Desktop)**
|
|
63
48
|
|
|
64
|
-
Use the same stdio command in your client
|
|
49
|
+
Use the same stdio command in your client's config:
|
|
65
50
|
|
|
66
51
|
- **Command:** `npx` (or full path to `node`)
|
|
67
52
|
- **Args:** `["-y", "@agent-browser-io/browser", "mcp"]` (or `["path/to/bin/index.cjs", "mcp"]`)
|
|
@@ -72,6 +57,8 @@ The server speaks JSON-RPC over stdin/stdout; no extra env vars are required.
|
|
|
72
57
|
|
|
73
58
|
You can use the same browser automation as **tools** with the [Vercel AI SDK](https://sdk.vercel.ai) and `generateText`. The package exposes `createBrowserTools(browser)`, which returns an object of tools you can pass to `generateText({ tools, ... })`. The `ai` package is included as a dependency.
|
|
74
59
|
|
|
60
|
+
**Tools:** `launch`, `navigate`, `getWireframe`, `click`, `type`, `fill`, `dblclick`, `hover`, `press`, `select`, `check`, `uncheck`, `scroll`, `screenshot`, `close`. Same toolset as the MCP server, so behavior is consistent.
|
|
61
|
+
|
|
75
62
|
**Important:** Have the model call the `launch` tool first before other actions (navigate, getWireframe, click, etc.).
|
|
76
63
|
|
|
77
64
|
**Example:**
|
|
@@ -94,9 +81,11 @@ const { text } = await generateText({
|
|
|
94
81
|
|
|
95
82
|
## Development
|
|
96
83
|
|
|
84
|
+
Requires **Node 18+**. Browser automation uses **Playwright** (included as a dev dependency).
|
|
85
|
+
|
|
97
86
|
```bash
|
|
98
87
|
npm install
|
|
99
88
|
npm run build
|
|
100
89
|
```
|
|
101
90
|
|
|
102
|
-
Builds to `dist/cjs` (CommonJS) and `dist/esm` (ESM).
|
|
91
|
+
Builds to `dist/cjs` (CommonJS) and `dist/esm` (ESM).
|