Patchright Lite MCP Server

Patchright Lite MCP Server

A streamlined Model Context Protocol server that enables AI models to perform stealth browser automation using Patchright, avoiding detection by anti-bot systems while providing essential web interaction capabilities.

Category
Visit Server

README

Patchright Lite MCP Server

A streamlined Model Context Protocol (MCP) server that wraps the Patchright Node.js SDK to provide stealth browser automation capabilities to AI models. This lightweight server focuses on essential functionality to make it easier for simpler AI models to use.

What is Patchright?

Patchright is an undetected version of the Playwright testing and automation framework. It's designed as a drop-in replacement for Playwright, but with advanced stealth capabilities to avoid detection by anti-bot systems. Patchright patches various detection techniques including:

  • Runtime.enable leak
  • Console.enable leak
  • Command flags leaks
  • General detection points
  • Closed Shadow Root interactions

This MCP server wraps the Node.js version of Patchright to make its capabilities available to AI models through a simple, standardized protocol.

Features

  • Simple Interface: Focused on core functionality with just 4 essential tools
  • Stealth Automation: Uses Patchright's stealth mode to avoid detection
  • MCP Standard: Implements the Model Context Protocol for easy AI integration
  • Stdio Transport: Uses standard input/output for seamless integration

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/patchright-lite-mcp-server.git
    cd patchright-lite-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Build the TypeScript code:

    npm run build
    

Usage

Run the server with:

npm start

This will start the server with stdio transport, making it ready to integrate with AI tools that support MCP.

Integrating with AI Models

Claude Desktop

Add this to your claude-desktop-config.json file:

{
  "mcpServers": {
    "patchright": {
      "command": "node",
      "args": ["path/to/patchright-lite-mcp-server/dist/index.js"]
    }
  }
}

VS Code with GitHub Copilot

Use the VS Code CLI to add the MCP server:

code --add-mcp '{"name":"patchright","command":"node","args":["path/to/patchright-lite-mcp-server/dist/index.js"]}'

Available Tools

The server provides just 4 essential tools:

1. browse

Launches a browser, navigates to a URL, and extracts content.

Tool: browse
Parameters: {
  "url": "https://example.com",
  "headless": true,
  "waitFor": 1000
}

Returns:

  • Page title
  • Visible text preview
  • Browser ID (for subsequent operations)
  • Page ID (for subsequent operations)
  • Screenshot path

2. interact

Performs a simple interaction on a page.

Tool: interact
Parameters: {
  "browserId": "browser-id-from-browse",
  "pageId": "page-id-from-browse",
  "action": "click", // can be "click", "fill", or "select"
  "selector": "#submit-button",
  "value": "Hello World" // only needed for fill and select
}

Returns:

  • Action result
  • Current URL
  • Screenshot path

3. extract

Extracts specific content from the current page.

Tool: extract
Parameters: {
  "browserId": "browser-id-from-browse",
  "pageId": "page-id-from-browse",
  "type": "text" // can be "text", "html", or "screenshot"
}

Returns:

  • Extracted content based on the requested type

4. close

Closes a browser to free resources.

Tool: close
Parameters: {
  "browserId": "browser-id-from-browse"
}

Example Usage Flow

  1. Launch a browser and navigate to a site:

    Tool: browse
    Parameters: {
      "url": "https://example.com/login",
      "headless": false
    }
    
  2. Fill in a login form:

    Tool: interact
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "action": "fill",
      "selector": "#username",
      "value": "user@example.com"
    }
    
  3. Fill in password:

    Tool: interact
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "action": "fill",
      "selector": "#password",
      "value": "password123"
    }
    
  4. Click the login button:

    Tool: interact
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "action": "click",
      "selector": "#login-button"
    }
    
  5. Extract text to verify login:

    Tool: extract
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "type": "text"
    }
    
  6. Close the browser:

    Tool: close
    Parameters: {
      "browserId": "browser-id-from-step-1"
    }
    

Security Considerations

  • This server provides powerful automation capabilities. Use it responsibly and ethically.
  • Avoid automating actions that would violate websites' terms of service.
  • Be mindful of rate limits and don't overload websites with requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Patchright-nodejs by Kaliiiiiiiiii-Vinyzu
  • Model Context Protocol by modelcontextprotocol

Docker Usage

You can run this server using Docker:

docker run -it --rm dylangroos/patchright-mcp

Building the Docker Image Locally

Build the Docker image:

docker build -t patchright-mcp .

Run the container:

docker run -it --rm patchright-mcp

Docker Hub

The image is automatically published to Docker Hub when changes are merged to the main branch. You can find the latest image at: dylangroos/patchright-mcp

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
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured