Agent Browser

io.github.codeChap由 GitHub 账号 codeChap 发布v0.1.0更新于 Oct 26, 2026

MCP server for browser automation via Vercel's agent-browser CLI

概览

AI 生成的概览

本地 MCP 服务器,封装 Vercel 的 agent-browser CLI,让助手驱动真实 Chromium 浏览器:导航、点击、填表、快照与截图。

可以做什么
  • 导航页面,并按加载、URL、文本或选择器等待
  • 通过无障碍树快照和正则文本提取检查页面内容
  • 按元素引用进行点击、输入和表单填写
  • 截取屏幕截图与 PDF,并管理下载文件
  • 处理 Cookie、会话与持久登录状态,并提供 eval 与 CDP 访问
  • 用诊断工具检查 CLI、配置与守护进程状态
适用场景
适合需要助手操作真实浏览器而非抓取文档的场景:填写表单、点击登录后的站点、确认页面实际渲染结果或截图。它本身不提供搜索,通常先用搜索工具找到网址再导航。
运行要求
以本地 stdio 进程在桌面运行;需先安装 agent-browser CLI(cargo install agent-browser,再执行 agent-browser install),浏览器经 Playwright 驱动 Chromium。MCP 客户端需指向构建出的二进制文件。可选 TOML 配置位于 ~/.config/mcp-server-agent-browser/config.toml,可用 MCP_AGENT_BROWSER_CONFIG 覆盖;相关设置包括 AGENT_BROWSER_PATH、AGENT_BROWSER_HEADED 与 AGENT_BROWSER_ENCRYPTION_KEY。
安装前请注意
浏览器会操作真实网站:点击、填表和登录会改变远端状态,持久化配置或保存的会话状态可能带有登录凭据。~/.agent-browser 下的恢复文件属于凭据,未设置 AGENT_BROWSER_ENCRYPTION_KEY 时以明文保存。进程被强制结束可能残留 Chromium 守护进程。截图、PDF 和下载等写入仅限相对路径、/tmp 或 download_dir。处于 Beta 阶段:真实 Chromium 重启后的 Cookie 恢复仅做过手动验证。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Agent Browser,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mcp-server-agent-browser

Status: Beta — CLI wrapper is covered by unit tests and a fake-browser stdio smoke test. Cookie restore across a real Chromium restart is still a manual check.

Let LLMs drive a real browser. This MCP server wraps agent-browser (Vercel Labs) so any MCP client can navigate, fill forms, click, snapshot the accessibility tree, and screenshot.

It is not Grok's web_search / open_page. Those fetch documents. This one runs Chromium. Use search to find a URL, then browser_navigate.

Prerequisites

bash
cargo install agent-browseragent-browser install

Call browser_doctor if anything is missing.

Build

bash
cargo build --release

Binary: target/release/mcp-server-agent-browser

bash
cargo test./tests/test-stdio.sh

Real Chromium login-restore is not in CI. After a headed login, restart the MCP process and confirm the next browser_navigate is still logged in.

Configuration

MCP client (stdio):

json
{  "mcpServers": {    "agent-browser": {      "command": "/path/to/mcp-server-agent-browser"    }  }}

Optional TOML at ~/.config/mcp-server-agent-browser/config.toml (see config.example.toml). Missing file uses defaults. Override the path with MCP_AGENT_BROWSER_CONFIG.

SettingDefaultMeaning
headedfalseShow a window. Launch-time only; browser_close first if a headless daemon is already up. Also AGENT_BROWSER_HEADED=1.
persisttrue--session-name <namespace>-<session_id> (default session key default). There's no --namespace CLI flag — namespace is folded into that name instead.
keep_daemonfalseIf false, MCP exit runs close so restore state is saved and Chrome does not leak.
namespacemcp-serverPrefix of the --session-name restore key, isolating this MCP's restore files from a human using the CLI directly.
command_timeout_secs120Wrapper timeout. Playwright's own 25s action timeout is left alone (CLI IPC is ~30s).
idle_timeout1hSets AGENT_BROWSER_IDLE_TIMEOUT_MS (env only — there's no --idle-timeout CLI flag). Use "0" with keep_daemon = true.
download_dir~/Downloads--download-path. ~ is expanded.
profileunsetOptional persistent Chrome user-data dir. Not your daily Chrome profile.
encryption_key_fileunsetSets AGENT_BROWSER_ENCRYPTION_KEY. Restore files are credentials; plaintext unless this is set.
AGENT_BROWSER_PATHagent-browserCLI binary.

allowed_domains is optional. Localhost is allowed unless you set a list that excludes it.

What it can do

Same interaction set as before (navigate, click, type, snapshot, screenshot, cookies, eval, CDP, sessions), plus:

  • browser_doctor — CLI, config, persist, headed/DISPLAY, daemon guess. Does not launch Chrome.
  • browser_get_text pattern — regex over page text with two lines of context.
  • browser_wait — load / url / text as well as a selector.

Typical loop:

  1. browser_navigate
  2. browser_snapshot (-i for interactive)
  3. browser_click / browser_fill with @refs
  4. browser_screenshot if you need pixels

Persistence

With persist = true (default), each session saves cookies and localStorage on close and on the CLI's autosave interval. State lives under ~/.agent-browser/, namespaced to mcp-server. Isolated session_ids do not share a restore key.

Headed login once, browser_close or exit the MCP, start again. The next navigate should restore that session.

A killed MCP process may leave the daemon running. browser_doctor reports that. Idle shutdown still saves if persist is on.

Limitations

  • Chromium via agent-browser (Playwright). No search.
  • Headed is ignored until the existing daemon is closed.
  • Snap Chromium on Ubuntu can fail to advertise its DevTools port; prefer agent-browser install's browser or executable_path.
  • Writes (screenshot, pdf, download) must be relative, under /tmp, or under download_dir.
  • Element screenshots take a CSS selector or @ref, plus a trailing :has-text("..."). The selector is checked first, so a miss is an error, not a silent full-viewport shot. Not combinable with full_page.
  • 25s Playwright action timeout is an upstream CLI limit, not this wrapper.

License

MIT

来源:README.md,提交 7d1010f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。