WebControl
Headless browser automation for LLM agents via REST API or MCP tools. Enables navigating pages, reading structured content, clicking elements, filling forms, and executing JavaScript.
README
WebControl
Headless browser automation service for LLM agents. Navigate pages, read structured content, click elements, fill forms — all through a REST API or MCP (Model Context Protocol) tools.
How It Works
┌──────────────────────────┐
│ LLM Agent │
│ (Claude, custom, etc.) │
└────────────┬─────────────┘
│ 1. navigate("https://example.com")
│ 2. receives PageContent with element refs (e1, e2, e3...)
│ 3. fill("e3", "user@example.com")
│ 4. click("e7")
│ 5. receives updated PageContent
▼
┌──────────────────────────┐
│ WebControl │
│ REST API + MCP Server │
│ (single process/port) │
└────────────┬─────────────┘
│
▼
┌──────────────────────────┐
│ Playwright (headless) │
│ Chromium browser │
└──────────────────────────┘
The LLM reads a compact structured representation of the page (interactive elements, forms, links — not raw HTML), decides what to do, and sends an action. WebControl executes it and returns the new page state.
Quick Start
Local
# Install
python3 -m venv .venv && source .venv/bin/activate
pip install ".[dev]"
playwright install chromium
# Run
webcontrol serve
Server starts at http://localhost:8080. Try the health check:
curl http://localhost:8080/health
Docker
docker compose up --build
Usage
REST API
# Create a session
curl -X POST http://localhost:8080/api/v1/sessions \
-H "Content-Type: application/json" \
-d '{"name": "my-task"}'
# Returns: {"id": "abc-123", "name": "my-task", ...}
# Navigate
curl -X POST http://localhost:8080/api/v1/sessions/abc-123/navigate \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
# Returns: {"success": true, "page_content": {"elements": [...], "forms": [...], ...}}
# Fill a form field (using ref from page_content)
curl -X POST http://localhost:8080/api/v1/sessions/abc-123/fill \
-H "Content-Type: application/json" \
-d '{"ref": "e3", "value": "hello@example.com"}'
# Click an element
curl -X POST http://localhost:8080/api/v1/sessions/abc-123/click \
-H "Content-Type: application/json" \
-d '{"ref": "e7"}'
# Close session when done
curl -X DELETE http://localhost:8080/api/v1/sessions/abc-123
MCP (Model Context Protocol)
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"webcontrol": {
"command": "webcontrol",
"args": ["mcp-stdio"]
}
}
}
For Cursor, add to .cursor/mcp.json in your project. See mcp-configs/ for more examples.
Once configured, the LLM gets these tools: create_session, navigate, get_page_content, click, fill, select, submit, screenshot, execute_js, close_session.
Configuration
All settings via environment variables prefixed WC_:
| Variable | Default | Description |
|---|---|---|
WC_PORT |
8080 |
Server port |
WC_HOST |
0.0.0.0 |
Bind address |
WC_HEADLESS |
true |
Run browser headless |
WC_BROWSER_TYPE |
chromium |
Browser engine (chromium, firefox, webkit) |
WC_MAX_SESSIONS |
10 |
Maximum concurrent browser sessions |
WC_DEFAULT_SESSION_TTL_SECONDS |
1800 |
Session idle timeout (30 min) |
WC_VIEWPORT_WIDTH |
1280 |
Default viewport width |
WC_VIEWPORT_HEIGHT |
720 |
Default viewport height |
WC_NAVIGATION_TIMEOUT_MS |
30000 |
Navigation timeout |
WC_ACTION_TIMEOUT_MS |
10000 |
Action timeout (click, fill, etc.) |
WC_API_KEY |
(empty) | API key for REST auth; empty = no auth |
WC_PROXY_SERVER |
(empty) | HTTP proxy (e.g., http://proxy:8080) |
WC_PROXY_USERNAME |
(empty) | Proxy auth username |
WC_PROXY_PASSWORD |
(empty) | Proxy auth password |
WC_NAVIGATION_RETRIES |
2 |
Retry attempts for navigation |
WC_ACTION_RETRIES |
1 |
Retry attempts for actions |
WC_RETRY_DELAY_MS |
500 |
Delay between retries |
WC_LOG_LEVEL |
INFO |
Log level |
WC_LOG_JSON |
false |
Output structured JSON logs |
Authentication
Set WC_API_KEY to enable API key authentication on REST endpoints:
export WC_API_KEY="your-secret-key"
webcontrol serve
Clients must include the key in requests:
curl -H "x-api-key: your-secret-key" http://localhost:8080/api/v1/sessions
The /health endpoint is always unauthenticated.
MCP stdio mode does not use HTTP auth (it runs as a local subprocess).
Development
# Run tests
pytest tests/ -v
# Run a single test
pytest tests/test_api/test_routes.py::test_navigate_and_get_content -v
# Lint
ruff check src/ tests/
# Format
ruff format src/ tests/
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 模型以安全和受控的方式获取实时的网络信息。