Browser Automation · MODEL CONTEXT PROTOCOL
MCP Browser Automation Server
MCP server for browser automation with screenshot and console logging capabilities
连接能力
MCP Browser Automation Server 为 AI Agent 提供什么
来源目录未提供结构化功能列表,请在使用前阅读源仓库文档。
安全
MCP 收录不等于安全审核
MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。
README
仓库文档
A simple but powerful browser automation server that allows you to control browsers, take screenshots, and monitor console logs through a REST API.
- Create browser sessions
- Navigate to URLs
- Take screenshots (full page or specific elements)
- Click elements
- Fill form inputs
- Monitor console logs in real-time through WebSocket
- Close sessions
- Clone this repository:
git clone https://github.com/weir1/mcp-browser-automation.git
cd mcp-browser-automation- Create a virtual environment and activate it:
python -m venv venv
.\venv\Scripts\Activate- Install dependencies:
pip install -r requirements.txt- Install Playwright browsers:
playwright install- Start the server:
python server.pyThe server will start on http://localhost:8000
POST /session/create
Response: { "session_id": "..." }
POST /session/{session_id}/navigate?url=https://example.com
POST /session/{session_id}/screenshot?name=screenshot1&selector=.my-element
If selector is not provided, takes a full page screenshot.
POST /session/{session_id}/click?selector=.my-button
POST /session/{session_id}/fill?selector=input[name="username"]&value=myuser
WebSocket /session/{session_id}/console
POST /session/{session_id}/close
import requests
import websockets
import asyncio
import json
# Create a session
response = requests.post("http://localhost:8000/session/create")
session_id = response.json()["session_id"]
# Navigate to a URL
requests.post(f"http://localhost:8000/session/{session_id}/navigate?url=https://example.com")
# Take a screenshot
response = requests.post(f"http://localhost:8000/session/{session_id}/screenshot?name=example")
with open("screenshot.png", "wb") as f:
f.write(response.content)
# Monitor console logs
async def monitor_console():
async with websockets.connect(f"ws://localhost:8000/session/{session_id}/console") as ws:
while True:
message = await ws.recv()
print(json.loads(message))
asyncio.get_event_loop().run_until_complete(monitor_console())MIT
社区
收藏、评分与讨论
正在载入社区数据…