MCP Browser Automation Server
About
MCP server for browser automation with screenshot and console logging capabilities
Details
- Author
- weir1
- Downloads
- 399
- Categories
- Automation, Web Scraping
Jump to
- Create browser sessions.
- Navigate to URLs.
- Take screenshots (full page or specific element).
- Click elements and fill form inputs.
- Monitor console logs in real-time via WebSocket.
- Close sessions.
Clone the repository, create a virtual environment, install the Python dependencies from requirements.txt, install Playwright browsers with playwright install, then start the server with python server.py. Interact with it via the documented REST endpoints and WebSocket channel.
MCP Browser Automation Server
A simple but powerful browser automation server that allows you to control browsers, take screenshots, and monitor console logs through a REST API.
Features
- 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
Installation
1. Clone this repository:
git clone https://github.com/weir1/mcp-browser-automation.git
cd mcp-browser-automation
2. Create a virtual environment and activate it:
python -m venv venv
.\venv\Scripts\Activate
3. Install dependencies:
pip install -r requirements.txt
4. Install Playwright browsers:
playwright install
Usage
1. Start the server:
python server.py
The server will start on http://localhost:8000
API Endpoints
Create a new session
POST /session/create
Response: { "session_id": "..." }
Navigate to a URL
POST /session/{session_id}/navigate?url=https://example.com
Take a screenshot
POST /session/{session_id}/screenshot?name=screenshot1&selector=.my-element
If selector is not provided, takes a full page screenshot.
Click an element
POST /session/{session_id}/click?selector=.my-button
Fill an input
POST /session/{session_id}/fill?selector=input[name="username"]&value=myuser
Monitor console logs
WebSocket /session/{session_id}/console
Close a session
POST /session/{session_id}/close
Example Usage with Python
```python
import requests
import websockets
import asyncio
import json
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.


