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.
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
- Fork/push this repo to GitHub.
- Go to render.com โ New โ Blueprint โ pick this repo (
render.yamlauto-detected). - Copy the generated
API_KEYfrom the service's Environment tab. - 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_KEYin production (Render blueprint generates one automatically). - Only
http/httpsURLs are allowed; localhost/private/metadata addresses are blocked by default. - Run behind HTTPS (Render/Railway give you TLS for free).
evaluateruns 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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.