@agent-browser-io/browser

中文文档
0.3.0发布于 2026/02/08TypeScriptESM + CJS近 30 天下载 4.3万

Token efficient agent browser

原始使用文档
文档目录4 节
  1. Install
  2. How to add MCP
  3. Vercel AI SDK
  4. Development

@agent-browser-io/browser

Token efficient agent browser.

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 clients (e.g. Cursor, Claude Desktop) or from code with the Vercel AI SDK.

Ways to use:

  • MCP — Add the included MCP server to Cursor or another MCP client so the AI can drive a browser (see How to add MCP).
  • Vercel AI SDK — Use createBrowserTools(browser) with generateText({ tools, ... }) in your app (see Vercel AI SDK).
  • CLI — Run the interactive CLI for manual testing (npx @agent-browser-io/browser or agent-browser-cli after install).

Install

npm install @agent-browser-io/browser

How to add MCP

MCP (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.

Run the MCP server (for testing):

npx @agent-browser-io/browser mcp

Add to Cursor

  1. Open Cursor settings → MCP (or edit your MCP config file, e.g. ~/.cursor/mcp.json or project .cursor/mcp.json).
  2. Add a server entry:
{
  "mcpServers": {
    "agent-browser": {
      "command": "npx",
      "args": ["-y", "@agent-browser-io/browser", "mcp"]
    }
  }
}
  1. Restart Cursor or reload MCP so it picks up the new server. The agent-browser tools will appear for the AI to use.

Other MCP clients (e.g. Claude Desktop)

Use the same stdio command in your client's config:

  • Command: npx (or full path to node)
  • Args: ["-y", "@agent-browser-io/browser", "mcp"] (or ["path/to/bin/index.cjs", "mcp"])

The server speaks JSON-RPC over stdin/stdout; no extra env vars are required.

Vercel AI SDK

You can use the same browser automation as tools with the Vercel AI SDK 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.

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.

Important: Have the model call the launch tool first before other actions (navigate, getWireframe, click, etc.).

Example:

import { createBrowserTools, AgentBrowser, DefaultBrowserBackend } from '@agent-browser-io/browser';
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';

const browser = new AgentBrowser(new DefaultBrowserBackend());
const tools = createBrowserTools(browser);

const { text } = await generateText({
  model: openai('gpt-4o'),
  tools,
  prompt: 'Go to hackernews visit on top 3 news, and summarize their content.',
});
// Model will call launch, then navigate, then getWireframe, etc.

Development

Requires Node 18+. Browser automation uses Playwright (included as a dev dependency).

npm install
npm run build

Builds to dist/cjs (CommonJS) and dist/esm (ESM).

版本与发布记录

@agent-browser-io/browser 共发布 4 个版本,首次发布于 2026/02/08;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.3.0latest2026/02/088 个月前
0.2.12026/02/088 个月前
0.2.02026/02/088 个月前
0.1.02026/02/088 个月前

关于 @agent-browser-io/browser 的常见问题

@agent-browser-io/browser 是什么?

Token efficient agent browser

如何安装 @agent-browser-io/browser?

在项目目录运行 npm install @agent-browser-io/browser,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 agent-browser-cli,可以用 npx agent-browser-cli 直接运行。

@agent-browser-io/browser 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agent-browser-io/browser 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@agent-browser-io/browser 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@agent-browser-io/browser 可以商用吗?

@agent-browser-io/browser 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@agent-browser-io/browser 的下载量有多少?

根据 npm 官方下载统计,@agent-browser-io/browser 在 2026/10/05 – 2026/11/03 这 30 天内被下载 43,076 次,日均约 1,436 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agent-browser-io/browser 还在维护吗?

最新版本 0.3.0 发布于 2026/02/08(8 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/02/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。