agent-browser

agent-browser

Provides a headless Chromium browser through MCP, enabling AI agents to browse JavaScript-rendered pages, search the web, capture screenshots, extract tables and data, and run stateful multi-step interactions like clicking, typing, and form submission.

Category
访问服务器

README

🌐 Agent Browser API

A universal, fully working headless-browser for AI agents. Give any agent — Zapier Agents, Custom GPTs, Claude, Cursor, LangChain, CrewAI, n8n, Make, or your own code — a real Chromium browser: JavaScript rendering, web search, clicking, typing, form filling, dropdowns, screenshots, table & data extraction, and PDF generation.

🇮🇳 Hindi TL;DR: Yeh ek real browser hai jo koi bhi AI agent use kar sakta hai — 3 tarike: simple REST API, OpenAPI import (Custom GPT), ya native MCP (Claude/Cursor/ChatGPT). Deploy karo, API key set karo, ho gaya. ✅ 26/26 tests passing.

🔌 Works with ANY agent — three ways to connect

Mode For How
REST API Zapier Agents, n8n, Make, LangChain, CrewAI, any code POST /v1/browse {"url": "..."} with X-API-Key header. Auto-discover via GET /v1/tools (OpenAI function format).
OpenAPI OpenAI Custom GPTs (Actions), API tooling Import /openapi.yaml — every endpoint documented.
MCP 🆕 Claude Desktop/Code, Cursor, Windsurf, ChatGPT, VS Code, n8n MCP Point your MCP client at https://YOUR-URL/mcp (Streamable HTTP) — 22 browser tools appear natively.

Full copy-paste guides per platform: INTEGRATIONS.md · Zapier specifics: ZAPIER_SETUP.md

✨ Features

Capability Endpoint What it does
📖 Browse POST /v1/browse Renders any page (JS included) → clean Markdown + title + links + metadata. LLM-ready.
🔍 Search POST /v1/search Web search via Brave/Bing/DDG with auto-fallback. No search API key needed.
📸 Screenshot POST /v1/screenshot PNG of page, full page, or a single element; custom viewport; binary or base64.
🧲 Extract POST /v1/extract Structured data via CSS selectors → JSON.
📊 Tables POST /v1/tables All data tables on a page → JSON (headers + rows), layout/hidden tables skipped.
🖱️ Elements POST /v1/elements Visible links/buttons/inputs with ready-to-use CSS selectors — agents can see what's clickable.
📄 PDF POST /v1/pdf Render any page to PDF (portrait/landscape).
🧭 Sessions POST /v1/sessions + actions Stateful multi-step flows: goto, click, type, fill, press, select, scroll, navigate (back/forward/reload), wait, evaluate, content, elements, screenshot.
🤝 MCP POST /mcp All of the above as native MCP tools (screenshots returned as real images).

Plus: API-key auth, CORS, rate limiting, SSRF guard, session auto-expiry + LRU eviction, stealth basics, SPA settle waits, output truncation for LLM context safety, helpful error hints, /llms.txt, and a full OpenAPI spec.

🚀 Quick start

Deploy free (Render) — recommended

  1. Fork/push this repo to GitHub.
  2. Go to render.com → New → Blueprint → pick this repo (render.yaml auto-detected).
  3. Copy the generated API_KEY from the service's Environment tab.
  4. Live at https://your-service.onrender.com 🎉

Also works on Railway, Fly.io, or any Docker host.

Docker

docker build -t agent-browser .
docker run -p 8080:8080 -e API_KEY=your-secret-key agent-browser

Run locally

npm install            # installs deps + Chromium
API_KEY=your-secret-key npm start
# → agent-browser v2.0.0 listening on :8080

🧪 Try it

BASE=http://localhost:8080; KEY=your-secret-key

# Read a JS-heavy page as markdown
curl -X POST $BASE/v1/browse -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://news.ycombinator.com"}'

# Search the web
curl -X POST $BASE/v1/search -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"query":"best CRM for startups","limit":5}'

# Extract every table on a page as JSON
curl -X POST $BASE/v1/tables -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://www.scrapethissite.com/pages/forms/"}'

# Multi-step: search Wikipedia interactively
SID=$(curl -s -X POST $BASE/v1/sessions -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org"}' | jq -r .sessionId)
curl -X POST $BASE/v1/sessions/$SID/fill -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"fields":{"input[name=search]":"Artificial intelligence"}}'
curl -X POST $BASE/v1/sessions/$SID/press -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"key":"Enter"}'
curl $BASE/v1/sessions/$SID/content -H "X-API-Key: $KEY"
curl -X DELETE $BASE/v1/sessions/$SID -H "X-API-Key: $KEY"

Run the full smoke-test suite: npm test — 26 checks covering every endpoint and a real MCP client round-trip.

⚙️ Configuration (env vars)

Variable Default Description
API_KEY (empty = auth off, dev only!) Required key for all non-public endpoints.
PORT 8080 HTTP port.
MAX_SESSIONS 10 Max concurrent stateful sessions (LRU eviction).
SESSION_TTL_MS 600000 Idle session expiry (10 min).
NAV_TIMEOUT_MS 30000 Navigation timeout.
RATE_LIMIT_PER_MIN 120 Requests/min per API key or IP (0 = off).
CORS_ORIGIN * Allowed CORS origin.
ALLOW_PRIVATE_URLS false Allow browsing private/internal addresses (SSRF guard off).

🔒 Security notes

  • Always set API_KEY in production (Render blueprint generates one automatically).
  • Only http/https URLs are allowed; localhost/private/metadata addresses are blocked by default.
  • Run behind HTTPS (Render/Railway give you TLS for free).
  • evaluate runs arbitrary JS inside the sandboxed page — keep your API key secret.
  • Public (no key) endpoints are read-only info: /, /health, /openapi.yaml, /llms.txt, /v1/tools.

📁 Project structure

src/server.js         # Express API: auth, CORS, rate limit, routes
src/actions.js        # Shared high-level actions (used by REST + MCP)
src/browser.js        # Chromium lifecycle, sessions, TTL/LRU, SSRF guard
src/extract.js        # HTML → markdown, CSS extraction, tables, elements
src/search.js         # Multi-engine web search with fallback
src/mcp.js            # MCP server (Streamable HTTP, 22 tools)
src/tools-manifest.js # GET /v1/tools (OpenAI function format)
openapi.yaml          # Full API specification
test/run-tests.sh     # 26-check smoke-test suite (incl. MCP round-trip)
Dockerfile            # Production image (Playwright base, version-pinned)
render.yaml           # One-click Render deploy

License

MIT

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

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

官方
精选
Exa MCP Server

Exa MCP Server

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

官方
精选