ai-browser

ai-browser

Enables AI agents to fully control a terminal browser via MCP, navigating pages, filling forms, logging in, and managing cookies with deterministic numbered links and forms. Also provides an interactive human CLI.

Category
访问服务器

README

ai-browser

A full-featured terminal browser that an AI can completely control — navigate, read pages, log in, sign up, handle 2FA, generate disposable emails, store credentials, download files, and replay whole processes — from any MCP-capable agent (opencode, Claude Desktop, etc.). Humans get an interactive terminal CLI too.

No UI needed: it renders pages to plain text with numbered LINKS and FORMS so an AI can act on [3] or 1.2 without a DOM. It works with plain HTML (fast, zero heavy deps) and can optionally upgrade to a real headless Chromium engine when Playwright is available.

Features

Browser core

  • Persistent session: cookies and history saved to ~/.ai-browser/, logins survive restarts.
  • Deterministic addressing: pages render to text with numbered LINKS and FORMS; the AI acts by index (3, 1.2) or by name/id/CSS.
  • Multiple tabs, each with its own history, one shared session.
  • Page cache (LRU) — back/forward/reload are instant.
  • Retry-with-backoff and gzip on all requests for speed and reliability.
  • Proxy support (http://, socks5://).

AI agent tools (55 via MCP)

  • Navigation: navigate, read_page, back/forward/reload, history, tabs, wait, wait_for_text, find_text, screenshot (JS mode), save/download/fetch.
  • Forms: fill, check, select, submit, click, extract, extract_json.
  • Auth: auto_login, auto_signup (auto-detects email/name/password/confirm fields), analyze_page (detects login/signup/CAPTCHA/2FA).
  • Credential vault: save_credentials, get_credentials, list/delete, auto_login_vault — passwords obfuscated on disk.
  • Disposable email (mail.tm API): create inbox, list messages, read, extract verification codes — so signups that need an email address work.
  • Macros: record a whole process once, replay anywhere, with conditional steps (if_contains, goto, stop).
  • Detection: CAPTCHA and 2FA/OTP pages are flagged so the AI knows a human step is required.

JavaScript (optional)

enable_js() upgrades to Playwright + Chromium headless for JS-only sites:

  • pip install playwright && playwright install chromium
  • (On Termux/Android use termux-x11; on desktop it works out of the box.)

Try it offline (no internet needed)

python demo_server.py        # terminal 1: a tiny login-protected site on :8080
python cli.py http://127.0.0.1:8080/login   # terminal 2: human browser
# login: admin / secret   (or emma / secret)

Or let the AI do the whole flow through MCP: navigate → signup → fetch → login → vault → email → macro.

Download & Install

1. Download the code

git clone https://github.com/void-builder-1/ai-browser.git
cd ai-browser

Or download the ZIP from GitHub: Code → Download ZIP, then unzip:

unzip ai-browser-main.zip
cd ai-browser-main

2. Install dependencies

Requires Python 3.8+ and pip:

pip install -r requirements.txt

(On Termux/Android: pkg install python && pip install -r requirements.txt. If pip is blocked system-wide, use a virtualenv: python -m venv venv && source venv/bin/activate.)

3. Run

python cli.py            # human terminal browser
python cli.py https://example.com   # open a URL directly

To uninstall, just delete the folder:

rm -rf ai-browser

Optional: JavaScript engine

pip install playwright && playwright install chromium

(On Termux/Android use termux-x11; on desktop it works out of the box.)

Let the AI drive it

With opencode

Add to opencode.json (project or ~/.config/opencode/opencode.json):

{
  "mcp": {
    "aibrowser": {
      "type": "local",
      "command": ["python3", "/absolute/path/to/aibrowser/mcp_server.py"]
    }
  }
}

Restart opencode, then tell it: "use the aibrowser MCP server to sign up on example.com and do X".

With any other MCP client

Point the client at aibrowser/mcp_server.py (stdio transport). 55 tools are exposed — the full list comes from tools/list, but the main workflow tools:

tool purpose
navigate(url) open a URL, returns text snapshot
read_page() readable text + numbered links + forms
auto_login(u, p) / auto_signup(email, pass, name) one-shot auth
fill / check / select / submit / click drive forms
save_credentials / get_credentials / auto_login_vault vault
email_create / email_messages / email_read / email_code disposable mail
analyze_page() login/signup/CAPTCHA/2FA detection
record_start / record_stop / macro_run reusable processes
enable_js / screenshot / set_proxy / status advanced

The AI workflow pattern

  1. navigate("https://target-site.com/signup")
  2. analyze_page() → see the form structure and any 2FA/CAPTCHA
  3. email_create() → get a disposable address for the signup
  4. auto_signup(email, "Str0ng!pass", "Alice")
  5. email_messages() + email_code(msg_id) → read the verification email
  6. fill("1.1", code) + submit("1") → finish verification
  7. save_credentials(site, email, pass) → store for next time
  8. get_cookies() to confirm the session; cookies persist on disk

CLI commands

open, links, forms, click, fill, check, select, submit, login, signup, analyze, vault/vaultsave/vaultget/vaultdel/ vlogin, mail/mailmsgs/mailread/mailcode, fetch, find, waitfor, cache, save, download, grab, grabjson, record, stop, run, macros, back, fwd, reload, cookies, clearcookies, history, js, shot, proxy, status, raw, url, title, help, quit.

Tests

python test_engine.py    # 37 checks: nav, auth, vault, tabs, macros, cache...

Limitations

  • No JavaScript unless you install Playwright (then enable_js()).
  • CAPTCHAs are detected and flagged for the AI, not solved automatically.
  • 2FA codes are read from the disposable inbox when the site emails them.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选