Browser Automation · MODEL CONTEXT PROTOCOL
MCP Browser Automation Server
MCP server for browser automation with screenshot and console logging capabilities
WHAT IT CONNECTS
What MCP Browser Automation Server gives an AI Agent
The source catalog does not include a structured feature list. Review the repository documentation before use.
SECURITY
An MCP listing is not a security review
An MCP server may receive model context, credentials, local files, or permission to call external systems. Review its code, requested environment variables, network behavior, package provenance, and maintenance status before connecting it to an agent.
README
Repository documentation
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
COMMUNITY