Skip to main content
Glama
Patchright Lite MCP Server

Patchright Lite MCP Server

by dylangroos

Patchright Lite MCP サーバー

Patchright Node.js SDKをラップし、AIモデルにステルスブラウザ自動化機能を提供する、合理化されたモデルコンテキストプロトコル(MCP)サーバーです。この軽量サーバーは、よりシンプルなAIモデルを容易に利用できるよう、必須機能に特化しています。

Patchright とは何ですか?

Patchrightは、Playwrightテストおよび自動化フレームワークの検出されないバージョンです。Playwrightの代替として設計されていますが、アンチボットシステムによる検出を回避するための高度なステルス機能を備えています。Patchrightは、以下を含む様々な検出手法にパッチを適用します。

  • Runtime.enable リーク

  • Console.enable リーク

  • コマンドフラグの漏洩

  • 一般的な検出ポイント

  • クローズドシャドウルートインタラクション

この MCP サーバーは、Patchright の Node.js バージョンをラップし、シンプルで標準化されたプロトコルを通じて AI モデルでその機能を利用できるようにします。

Related MCP server: Puppeteer-Extra MCP Server

特徴

  • シンプルなインターフェース: 4つの必須ツールのみでコア機能に焦点を合わせています

  • ステルス自動化: Patchrightのステルスモードを使用して検出を回避します

  • MCP 標準: AI 統合を容易にするモデル コンテキスト プロトコルを実装

  • Stdioトランスポート: シームレスな統合のために標準入出力を使用します

前提条件

  • Node.js 18歳以上

  • npmまたはyarn

インストール

  1. このリポジトリをクローンします:

    git clone https://github.com/yourusername/patchright-lite-mcp-server.git
    cd patchright-lite-mcp-server
  2. 依存関係をインストールします:

    npm install
  3. TypeScript コードをビルドします。

    npm run build

使用法

次のコマンドでサーバーを実行します。

npm start

これにより、stdio トランスポートを使用してサーバーが起動し、MCP をサポートする AI ツールと統合できるようになります。

AIモデルとの統合

クロードデスクトップ

claude-desktop-config.jsonファイルに以下を追加します。

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

GitHub Copilot を使用した VS Code

VS Code CLI を使用して MCP サーバーを追加します。

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

利用可能なツール

サーバーは 4 つの必須ツールのみを提供します。

1. 閲覧

ブラウザを起動し、URL に移動してコンテンツを抽出します。

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

戻り値:

  • ページタイトル

  • 表示されるテキストのプレビュー

  • ブラウザID(後続の操作用)

  • ページID(後続の操作用)

  • スクリーンショットのパス

2. 交流する

ページ上で簡単な操作を実行します。

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
}

戻り値:

  • アクション結果

  • 現在のURL

  • スクリーンショットのパス

3. 抽出

現在のページから特定のコンテンツを抽出します。

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

戻り値:

  • 要求されたタイプに基づいて抽出されたコンテンツ

4. 閉じる

ブラウザを閉じてリソースを解放します。

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

使用フローの例

  1. ブラウザを起動してサイトに移動します。

    Tool: browse
    Parameters: {
      "url": "https://example.com/login",
      "headless": false
    }
  2. ログインフォームに記入してください:

    Tool: interact
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "action": "fill",
      "selector": "#username",
      "value": "user@example.com"
    }
  3. パスワードを入力してください:

    Tool: interact
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "action": "fill",
      "selector": "#password",
      "value": "password123"
    }
  4. ログインボタンをクリックします:

    Tool: interact
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "action": "click",
      "selector": "#login-button"
    }
  5. ログインを確認するためのテキストを抽出します:

    Tool: extract
    Parameters: {
      "browserId": "browser-id-from-step-1",
      "pageId": "page-id-from-step-1",
      "type": "text"
    }
  6. ブラウザを閉じます:

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

セキュリティに関する考慮事項

  • このサーバーは強力な自動化機能を提供します。責任を持って倫理的にご利用ください。

  • ウェブサイトの利用規約に違反するアクションの自動化は避けてください。

  • レート制限に留意し、リクエストでウェブサイトに過負荷をかけないようにしてください。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

謝辞

  • Kaliiiiiiiiii-Vinyzu による Patchright-nodejs

  • modelcontextprotocol によるモデルコンテキストプロトコル

Dockerの使用

このサーバーは Docker を使用して実行できます。

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

ローカルでDockerイメージを構築する

Docker イメージをビルドします。

docker build -t patchright-mcp .

コンテナを実行します。

docker run -it --rm patchright-mcp

Dockerハブ

変更がメインブランチにマージされると、イメージは自動的にDocker Hubに公開されます。最新のイメージはdylangroos/patchright-mcpで入手できます。

Available Tools

4 tools
browseB

Browse to a URL and return the page title and visible text

Inputs: url (required), headless, waitFor.

closeC

Close browser to free resources

Inputs: browserId (required).

extractC

Extract information from the current page as text, html, or screenshot

Inputs: browserId (required), pageId (required), type (required).

interactC

Perform simple interactions on a page

Inputs: browserId (required), pageId (required), action (required), selector (required), +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 4 tools

    Disambiguation4/5

    The tools have mostly distinct purposes with clear boundaries: browse for navigation, extract for content retrieval, interact for actions, and close for cleanup. However, 'extract' and 'interact' could potentially overlap in some use cases (e.g., extracting after an interaction), but their descriptions help differentiate them.

    Naming Consistency5/5

    All tool names follow a consistent, simple verb-based pattern (browse, close, extract, interact) without any mixing of conventions. This makes the set predictable and easy to understand at a glance.

    Tool Count5/5

    With 4 tools, this server is well-scoped for its apparent purpose of web browsing and interaction. Each tool serves a clear, essential function, and there are no extraneous or redundant tools, making the count appropriate for the domain.

    Completeness4/5

    The toolset covers the core web browsing lifecycle: navigate (browse), retrieve content (extract), perform actions (interact), and clean up (close). A minor gap is the lack of explicit tools for handling multiple tabs or sessions, but agents can likely work around this with the provided tools.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      D
      quality
      D
      maintenance
      AI-driven browser automation server that implements the Model Context Protocol to enable natural language control of web browsers for tasks like navigation, form filling, and visual interaction.
      1
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that provides enhanced browser automation capabilities using Puppeteer-Extra with Stealth Plugin, enabling LLMs to interact with web pages in a way that better emulates human behavior and avoids detection as automation.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI assistants to interact with web pages through browser automation, supporting web scraping, form filling, navigation, and other browser-based tasks using Playwright.
      1
      MIT