LS

lizzard-solutions/browserless-mcp

Browser automation

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

14 stars 9 forks Качество 47 Тренд 20

A Model Context Protocol (MCP) server for Browserless.io browser automation. This server provides a comprehensive interface to Browserless's powerful browser automation capabilities through MCP tools.

Обзор

A Model Context Protocol (MCP) server for Browserless.io browser automation. This server provides a comprehensive interface to Browserless's powerful browser automation capabilities through MCP tools. - : Convert web pages or HTML content to PDF with custom styling - : Capture full-page or element-specific screenshots - : Get rendered HTML content after JavaScript execution - : Execute JavaScript code in browser context - : Handle file downloads and programmatic file creation - : Export web pages with all resources - : Run Lighthouse performance audits - : Bypass bot detection and anti-scraping measures - : Execute GraphQL queries for advanced automation - : Create connections for Puppeteer/Playwright - : Check instance health and get metrics - : Monitor active browser sessions 5. Edit .env with your Browserless configuration: The server provides the following tools: For complete Browserless configuration options, see the Browserless API Reference.

README

Показан фрагмент оригинального README. Открыть оригинал.

Browserless MCP Server

A Model Context Protocol (MCP) server for Browserless.io browser automation. This server provides a comprehensive interface to Browserless’s powerful browser automation capabilities through MCP tools.

Features

  • PDF Generation: Convert web pages or HTML content to PDF with custom styling
  • Screenshots: Capture full-page or element-specific screenshots
  • Content Extraction: Get rendered HTML content after JavaScript execution
  • Custom Functions: Execute JavaScript code in browser context
  • File Downloads: Handle file downloads and programmatic file creation
  • Page Export: Export web pages with all resources
  • Performance Audits: Run Lighthouse performance audits
  • Anti-Detection: Bypass bot detection and anti-scraping measures
  • BrowserQL: Execute GraphQL queries for advanced automation
  • WebSocket Connections: Create connections for Puppeteer/Playwright
  • Health Monitoring: Check instance health and get metrics
  • Session Management: Monitor active browser sessions

Installation

  1. Clone the repository:
git clone https://github.com/Lizzard-Solutions/browserless-mcp.git
cd browserless-mcp
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Copy the example environment file:
cp env.example .env
  1. Edit .env with your Browserless configuration:
BROWSERLESS_HOST=localhost
BROWSERLESS_PORT=3000
BROWSERLESS_TOKEN=your-secure-token-here
BROWSERLESS_PROTOCOL=http
BROWSERLESS_TIMEOUT=30000
BROWSERLESS_CONCURRENT=5

Usage

Starting the MCP Server

npm start

Or for development:

npm run dev

Using with MCP Clients

The server provides the following tools:

1. Initialize Browserless Connection

{
  "name": "initialize_browserless",
  "arguments": {
    "host": "localhost",
    "port": 3000,
    "token": "your-token",
    "protocol": "http",
    "timeout": 30000,
    "concurrent": 5
  }
}

2. Generate PDF

{
  "name": "generate_pdf",
  "arguments": {
    "url": "https://example.com",
    "options": {
      "format": "A4",
      "printBackground": true,
      "displayHeaderFooter": true,
      "margin": {
        "top": "20mm",
        "bottom": "10mm",
        "left": "10mm",
        "right": "10mm"
      }
    }
  }
}

3. Take Screenshot

{
  "name": "take_screenshot",
  "arguments": {
    "url": "https://example.com",
    "options": {
      "type": "png",
      "fullPage": true,
      "quality": 90
    }
  }
}

4. Extract Content

{
  "name": "get_content",
  "arguments": {
    "url": "https://example.com",
    "waitForSelector": {
      "selector": "#content-loaded",
      "timeout": 5000
    }
  }
}

5. Execute Custom Function

{
  "name": "execute_function",
  "arguments": {
Открыть полный README на GitHub

Установка

docker run -p 3000:3000 ghcr.io/browserless/chromium
Новичок в MCP? Начните с руководства на mcpskill.org →