MCP Browser Automation Server

MCP Browser Automation Server

MCP server for browser automation with screenshot and console logging capabilities

weir1

Browser Automation
Visit Server

README

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
  1. Create a virtual environment and activate it:
python -m venv venv
.\venv\Scripts\Activate
  1. Install dependencies:
pip install -r requirements.txt
  1. 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

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())

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
@kazuph/mcp-fetch

@kazuph/mcp-fetch

Model Context Protocol server for fetching web content and processing images. This allows Claude Desktop (or any MCP client) to fetch web content and handle images appropriately.

Featured
Local
JavaScript
DuckDuckGo MCP Server

DuckDuckGo MCP Server

A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.

Featured
Python
YouTube Transcript MCP Server

YouTube Transcript MCP Server

This server retrieves transcripts for given YouTube video URLs, enabling integration with Goose CLI or Goose Desktop for transcript extraction and processing.

Featured
Python
serper-search-scrape-mcp-server

serper-search-scrape-mcp-server

This Serper MCP Server supports search and webpage scraping, and all the most recent parameters introduced by the Serper API, like location.

Featured
TypeScript
The Verge News MCP Server

The Verge News MCP Server

Provides tools to fetch and search news from The Verge's RSS feed, allowing users to get today's news, retrieve random articles from the past week, and search for specific keywords in recent Verge content.

Featured
TypeScript
Tavily MCP Server

Tavily MCP Server

Provides AI-powered web search capabilities using Tavily's search API, enabling LLMs to perform sophisticated web searches, get direct answers to questions, and search recent news articles.

Featured
Python
mcp-pinterest

mcp-pinterest

A Pinterest Model Context Protocol (MCP) server for image search and information retrieval

Featured
TypeScript
Crawlab MCP Server

Crawlab MCP Server

Official
Python