webclaw-mcp
MCP browser agent that runs as a Chrome extension. Control your real Chrome browser with 17 MCP tools — uses accessibility tree with @ref labels for low token usage. Supports WebMCP native tools.
README
WebClaw
A WebMCP-native browser agent that runs inside your real Chrome — control it from Claude, Cursor, and any MCP client.
<p align="center"> <img src="docs/images/demo.gif" alt="WebClaw demo" width="860"> </p>
Why WebClaw?
| WebClaw | browser-use | Playwright MCP | |
|---|---|---|---|
| Runs in real Chrome | Yes (extension) | No (CDP) | No (Playwright) |
| User's logged-in sessions | Yes | No | No |
| Bot detection | Resistant | Vulnerable | Vulnerable |
| WebMCP native tools | Yes | No | No |
| Page understanding | @ref a11y tree |
Screenshots | DOM / Screenshots |
WebClaw runs as a Chrome extension, so it sees exactly what you see — cookies, logins, extensions, and all. No headless browser, no CDP injection, no bot flags.
Quick Start
1. Configure your MCP client
<details open> <summary><b>Claude Desktop</b></summary>
Add to claude_desktop_config.json:
{
"mcpServers": {
"webclaw": {
"command": "npx",
"args": ["-y", "webclaw-mcp"]
}
}
}
Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
</details>
<details> <summary><b>Claude Code</b></summary>
claude mcp add webclaw -- npx -y webclaw-mcp
</details>
<details> <summary><b>Cursor</b></summary>
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"webclaw": {
"command": "npx",
"args": ["-y", "webclaw-mcp"]
}
}
}
</details>
<details> <summary><b>VS Code (Copilot)</b></summary>
Add to .vscode/mcp.json in your project root:
{
"servers": {
"webclaw": {
"type": "stdio",
"command": "npx",
"args": ["-y", "webclaw-mcp"]
}
}
}
</details>
<details> <summary><b>Windsurf</b></summary>
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"webclaw": {
"command": "npx",
"args": ["-y", "webclaw-mcp"]
}
}
}
</details>
2. Load the Chrome extension
- Download
webclaw-extension-v0.7.2.zipand unzip - Open
chrome://extensions/→ enable Developer mode - Click Load unpacked → select the
dist/folder
<details> <summary>Or build from source</summary>
git clone https://github.com/kuroko1t/webclaw.git && cd webclaw && pnpm install && pnpm build
Then load packages/extension/dist/ as above.
</details>
3. Try it
Restart your MCP client and ask:
"Go to wikipedia.org and search for Model Context Protocol"
Chrome launches automatically on the first tool call. The Side Panel shows all activity in real-time.
How It Works
flowchart LR
LLM["AI Assistant"]
MCP["MCP Server"]
EXT["Chrome Extension"]
CS["Content Script"]
LLM -- "stdio" --> MCP -- "WebSocket" --> EXT --> CS
style LLM fill:#7b2d8b,stroke:#333,color:#fff
style MCP fill:#1a5276,stroke:#333,color:#fff
style EXT fill:#1e8449,stroke:#333,color:#fff
style CS fill:#b7950b,stroke:#333,color:#fff
- The AI calls MCP tools (
navigate_to,page_snapshot,click, ...) - The MCP server forwards requests to the Chrome extension via WebSocket
- The content script reads the page as a compact accessibility tree with
@reflabels - The AI picks the right
@refand acts — no pixel coordinates, no CSS selectors
page_snapshot output
[page "Wikipedia, the free encyclopedia"]
[search]
[form]
[@e3 searchbox "Search Wikipedia"] ← AI targets this
[@e4 button "Search"] ← and clicks this
[main]
[heading[1] "Welcome to Wikipedia"]
[group]
[heading[2] "From today's featured article"]
...
Every interactive element gets a stable @ref label. The AI reads the tree, picks the right @ref, and calls click / type_text / select_option.
MCP Tools (19)
<details> <summary><b>Page Interaction</b> — navigate, snapshot, click, hover, type, select, drop files, screenshot</summary>
| Tool | Parameters | Description |
|---|---|---|
navigate_to |
url, tabId? |
Navigate to a URL |
page_snapshot |
maxTokens?, tabId? |
Get a compact accessibility tree with @ref labels |
click |
ref, snapshotId, tabId? |
Click an element by its @ref label |
hover |
ref, snapshotId, tabId? |
Hover over an element to reveal hidden UI (dropdowns, tooltips) |
type_text |
ref, text, snapshotId, tabId? |
Type text into an input/textarea by @ref |
select_option |
ref, value, snapshotId, tabId? |
Select a dropdown option by @ref |
drop_files |
ref, snapshotId, files, tabId? |
Drop files onto an element (e.g., upload images to GitHub issues) |
screenshot |
tabId? |
Capture the visible area of the active tab |
</details>
<details> <summary><b>Tab Management</b> — new, list, switch, close</summary>
| Tool | Parameters | Description |
|---|---|---|
new_tab |
url? |
Open a new tab (optionally with a URL) |
list_tabs |
List all open tabs with tabId, URL, title, and active state | |
switch_tab |
tabId |
Switch to a specific tab |
close_tab |
tabId |
Close a specific tab |
</details>
<details> <summary><b>Navigation</b> — back, forward, reload, wait, scroll</summary>
| Tool | Parameters | Description |
|---|---|---|
go_back |
tabId? |
Go back to the previous page |
go_forward |
tabId? |
Go forward to the next page |
reload |
tabId?, bypassCache? |
Reload the current page |
wait_for_navigation |
tabId?, timeoutMs? |
Wait for the page to finish loading |
scroll_page |
direction?, amount?, ref?, snapshotId?, tabId? |
Scroll the page or scroll to a specific element |
</details>
<details> <summary><b>WebMCP</b> — discover and invoke page-declared tools</summary>
| Tool | Parameters | Description |
|---|---|---|
list_webmcp_tools |
tabId? |
Discover tools on the page (native WebMCP + auto-synthesized from buttons/forms) |
invoke_webmcp_tool |
toolName, args?, tabId? |
Invoke a discovered tool (native or synthesized) |
</details>
Development
git clone https://github.com/kuroko1t/webclaw.git
cd webclaw
pnpm install
pnpm build # Build all packages
pnpm test # Run all tests
pnpm dev # Watch mode
Project Structure
packages/
shared/ Type definitions, Zod schemas, utilities
mcp-server/ MCP server with 19 tools, WebSocket bridge
extension/ Chrome MV3 extension (service worker, content scripts, side panel)
examples/
webmcp-demo-site/ WebMCP-enabled Todo app for testing native tool discovery
Multi-Session Support
WebClaw automatically scans ports 18080–18089, so you can run up to 10 MCP server instances simultaneously (e.g., multiple Claude Code sessions). Each instance binds to the first available port, and the Chrome extension connects to all of them.
Environment Variables
| Variable | Default | Description |
|---|---|---|
WEBCLAW_PORT |
18080 |
WebSocket port for MCP server ↔ extension communication. When set, disables auto-scanning and uses only this port. |
<details> <summary><b>Troubleshooting</b></summary>
Chrome extension not connected
- Chrome is auto-launched when a tool is called. If it fails, start Chrome manually with the extension loaded
- Check the Service Worker console (
chrome://extensions/→ Details → Service Worker) forConnected to MCP server - Verify the MCP server is running (look for
WebSocket server listening on 127.0.0.1:<port>in stderr)
MCP client cannot connect
- Ensure
npx webclaw-mcpruns successfully from your terminal - Check for port conflicts: WebClaw auto-scans 18080–18089. If all are in use, set
WEBCLAW_PORTto a custom port - Restart your MCP client after updating the config
Content script not injecting
- Content scripts only inject into
http://andhttps://pages (notchrome://,file://, etc.) - Try refreshing the page after loading the extension
WebMCP tools not discovered
- Native WebMCP requires Chrome 146+ with the
navigator.modelContextAPI - Verify the page declares tools via
navigator.modelContext.addTool()or<link rel="webmcp-manifest">
</details>
Contributing
Contributions are welcome! Please open an issue to discuss your idea before submitting a pull request.
License
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。