agentic-browser-mcp
Enables MCP clients to automate a real Chrome browser via Playwright, supporting session sharing and tools for navigation, clicking, typing, and more.
README
agentic-browser-mcp
A standalone MCP server that gives any MCP client (Codex, Claude, etc.) browser automation via Playwright. Drive a real, already-logged-in Chrome through the Chrome DevTools Protocol — share cookies and sessions across agents.
Originally extracted from the pi coding agent's browser extension, now a standalone server so Codex / pi / any MCP client can all use the same browser.
Features
- 11 tools:
browser_session,browser_navigate,browser_snapshot,browser_click,browser_type,browser_eval,browser_storage,browser_console,browser_wait_human,browser_screenshot,browser_close - Two session modes:
real—connectOverCDPto an existing Chrome on port9222(reuse your logged-in profile: cookies, sessions, 2FA)isolated—launchPersistentContextwith an independent profile (headed/headless)
- Auto-launch Chrome: if port 9222 is down, the server spawns your Chrome starter script and waits for it — no manual browser launch needed.
- Stable element targeting:
snapshotreturns an ARIA accessibility tree (YAML);click/typetarget byrole+name— no fragile ref/snapshot layers. - Transports:
stdio(default, for Codex-style spawn) andhttp(stateless streamable,--transport http --port 9223).
Requirements
- Node.js ≥ 18
- Playwright-compatible Chrome/Chromium installed (
google-chrome-stableworks) - For
realmode: a Chrome instance running with--remote-debugging-port=9222and a dedicateduser-data-dir(see Start Chrome with CDP)
Install
git clone https://github.com/q35888/agentic-browser-mcp.git
cd agentic-browser-mcp
npm install
Configure your MCP client
Codex (~/.codex/config.toml)
[mcp_servers.agentic-browser]
type = "stdio"
command = "/usr/bin/node"
args = [ "/path/to/agentic-browser-mcp/index.mjs" ]
Any MCP client (stdio)
Spawn node /path/to/agentic-browser-mcp/index.mjs over stdio — standard MCP initialize → tools/list → tools/call.
HTTP mode (long-running single instance)
node index.mjs --transport http --port 9223
# POST MCP requests to http://127.0.0.1:9223/mcp
Start Chrome with CDP (for real mode)
Chrome 150+ requires a non-default user-data-dir for remote debugging. Example starter script:
#!/usr/bin/env bash
PROFILE="$HOME/.agentic-browser-chrome-profile"
mkdir -p "$PROFILE"
# Fill in graphics session env if spawning from a non-graphical context
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-0}"
exec google-chrome-stable \
--remote-debugging-port=9222 \
--user-data-dir="$PROFILE" \
--ozone-platform=wayland \
"$@"
--ozone-platform=waylandis important when Chrome is spawned from a background process: otherwise Chrome's platform heuristic picks X11 and fails withMissing X server / Authorization required. Adjust for your display server (X11 users: drop the flag and ensureDISPLAY/XAUTHORITYare set).
If you don't start Chrome manually, the server will try to launch $HOME/.pi/agent/start-agent-chrome.sh automatically (override CHROME_STARTER in index.mjs to point at your own script).
Tools
| Tool | Description |
|---|---|
browser_session |
Start/switch a session (real / isolated, headless, incognito). No args = ensure default real. |
browser_navigate |
Open a URL. |
browser_snapshot |
Return the page's ARIA tree (YAML). Use role+name for click/type. |
browser_click |
Click an element by role (+name). |
browser_type |
Fill an input by role (+name). |
browser_eval |
Run a JS expression in the page (read DOM/storage/fire requests). |
browser_storage |
Read cookies / localStorage / sessionStorage. |
browser_console |
Read buffered console logs (optional level filter). |
browser_wait_human |
For CAPTCHAs/manual steps — returns a prompt; the calling agent pauses and waits for the user. |
browser_screenshot |
Save a PNG to disk. |
browser_close |
Close the current session (real only disconnects CDP, never kills your Chrome). |
Notes
browser_wait_human: this server has no GUI/TUI. It returns a text prompt; the client agent is expected to surface it and wait for the user to reply.- Session sharing: multiple MCP clients connecting to the same server share one Playwright session (and thus one Chrome). Tool calls are serialized to prevent races.
- Resource cleanup: on
stdinEOF, transport close, orSIGINT/SIGTERM, the server disposes the session (with a 3s timeout fallback) —isolatedbrowsers won't be orphaned.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。