Cover image
MCP-Browser-Automierung
Public

MCP-Browser-Automierung

Try Now
2025-03-09

MCP -Server für die Browserautomatisierung mit Screenshot- und Konsolenprotokollierungsfunktionen

3 years

Works with Finder

1

Github Watches

1

Github Forks

0

Github Stars

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

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • apappascs
  • Entdecken Sie die umfassendste und aktuellste Sammlung von MCP-Servern auf dem Markt. Dieses Repository dient als zentraler Hub und bietet einen umfangreichen Katalog von Open-Source- und Proprietary MCP-Servern mit Funktionen, Dokumentationslinks und Mitwirkenden.

  • OffchainLabs
  • GO -Umsetzung des Ethereum -Beweises des Anteils

  • huahuayu
  • Ein einheitliches API-Gateway zur Integration mehrerer Ethercan-ähnlicher Blockchain-Explorer-APIs mit Modellkontextprotokoll (MCP) für AI-Assistenten.

  • deemkeen
  • Steuern Sie Ihren MBOT2 mit einer Power Combo: MQTT+MCP+LLM

    Reviews

    3 (1)
    Avatar
    user_pGTXhQKP
    2025-04-15

    Sample Model Context Protocol Demos is an invaluable resource for anyone wanting to understand server-side MCP applications better. Authored by aws-samples, this collection of demos explores various protocols efficiently, offering clear examples and practical usage scenarios. Highly recommended for developers!