playwright-sse-mcp-server

by torohash

7 stars
441 downloads
Not rated
GitHub

About

playwright-sse-mcp-server provides Playwright as an MCP (Model Context Protocol) server, enabling MCP clients to use Playwright’s browser automation features. It runs inside a Docker container and is intended for developers who need browser control from MCP-compatible tools.

Details

Author
torohash
GitHub stars
7
Downloads
441
Categories
Automation

- Playwright browser automation exposed via MCP SSE transport
- Docker‑based deployment with configurable port (default 3002)
- Connects from same Docker network, host, or development containers
- Shell scripts for start/stop/logs with persistent mode and restart policies
- Requires a pre‑existing Docker network named mcp-network

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name playwright-sse-mcp-server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository and run docker compose up --build in the project root. The server starts on port 3002 by default; set the PORT environment variable for a custom port. Connect from other containers on the same Docker network via playwright-sse-mcp-server:<PORT>/sse, or from the host via localhost:<PORT>/sse. For Roo Code, configure the MCP settings with the SSE URL. Helper shell scripts (playwright-mcp-start, playwright-mcp-stop, playwright-mcp-logs) are provided for convenient control.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "playwright-sse-mcp-server": {
            "playwright-sse-mcp-server": {
                "command": "docker",
                "args": [
                    "network",
                    "create",
                    "mcp-network"
                ]
            }
        }
    }
}

McpServers

{
    "playwright-sse-mcp-server": {
        "command": "docker",
        "args": [
            "network",
            "create",
            "mcp-network"
        ]
    }
}

playwright-sse-mcp-server

PlaywrightをMCP(Model Context Protocol)サーバーとして提供するためのサービスです。このサーバーを使用することで、MCPクライアントからPlaywrightの機能を利用することができます。

前提条件

- Dockerがインストールされていること
- docker-composeがインストールされていること
- mcp-networkという名前のDockerネットワークが作成されていること

mcp-networkが存在しない場合は、以下のコマンドで作成できます:

docker network create mcp-network

セットアップと起動方法

1. リポジトリをクローンまたはダウンロードします
2. プロジェクトのルートディレクトリで以下のコマンドを実行します:

docker compose up --build

これにより、デフォルトの3002ポートでサーバーが起動します。起動が完了すると、以下のようなメッセージが表示されます:

playwright-sse-mcp-server  | Server is running on port 3002

カスタムポートの設定

デフォルトポート(3002)以外のポートでサーバーを起動したい場合は、環境変数PORTを設定します:

PORT=4000 docker compose up --build

これにより、指定したポート(この例では4000)でサーバーが起動します:

playwright-sse-mcp-server  | Server is running on port 4000

使用方法

同じmcp-networkに参加しているコンテナからの接続

同じmcp-networkに参加している他のコンテナからは、以下のURLでサーバーに接続できます(PORTはサーバーの起動ポート):

playwright-sse-mcp-server:${PORT}/sse

デフォルトポートを使用している場合:

playwright-sse-mcp-server:3002/sse

これにより、PlaywrightのMCP機能を利用することができます。

ホスト側からの接続

ホストマシンからは、以下のURLでサーバーに接続できます(PORTはサーバーの起動ポート):

localhost:${PORT}/sse

デフォルトポートを使用している場合:

localhost:3002/sse

Roo Codeからの接続

MCP Servers -> MCP設定を編集 -> 以下を記入します(PORTはサーバーの起動ポート):

{
  "mcpServers": {
    "playwright-sse-mcp-server-local": {
      "url": "http://localhost:${PORT}/sse"
    }
  }
}

デフォルトポートを使用している場合:

{
  "mcpServers": {
    "playwright-sse-mcp-server-local": {
      "url": "http://localhost:3002/sse"
    }
  }
}

※2025/03/27現在、ClineはSSEをサポートしていない為使えません。

コンテナ環境でのRoo Codeからの接続

同じDocker Network内で実行されているRoo Codeコンテナからは、以下のようにMCP設定を行います:

{
  "mcpServers": {
    "playwright-sse-mcp-server-local": {
      "url": "http://playwright-sse-mcp-server:3002/sse"
    }
  }
}

docker-compose.yml設定例

services:
  # Roo Code コンテナ
  roo-code:
    # 略

networks:
mcp-network:
external: true

この設定により、Roo Codeコンテナからplaywright-sse-mcp-serverコンテナに接続し、ブラウザ操作機能を利用できます。コンテナ名(playwright-sse-mcp-server)をホスト名として使用することで、Docker Network内での名前解決が可能になります。

開発コンテナ環境でのRoo Codeからの接続(ホスト経由)

開発コンテナ内でRoo Codeを実行し、mcp-network に参加せずにホストマシン経由でこのMCPサーバーに接続する場合、以下のようにMCP設定を行います。

Docker Desktop (Mac/Windows) の場合:

{
  "mcpServers": {
    "playwright-sse-mcp-server-local": {
      "url": "http://host.docker.internal:<PORT>/sse"
    }
  }
}

Linux の場合 (例: ブリッジゲートウェイIPを使用):

{
  "mcpServers": {
    "playwright-sse-mcp-server-local": {
      "url": "http://172.17.0.1:<PORT>/sse"
    }
  }
}

注意:

<PORT> は、MCPサーバーがホスト上で公開しているポート番号(デフォルト: 3002)に置き換えてください。
Linuxの場合は、172.17.0.1 の部分を実際のホストIPアドレスまたはDockerブリッジネットワークのゲートウェイIPアドレスに置き換えてください。詳細は「開発コンテナからの接続(ホスト経由)」セクションを参照してください。

開発コンテナからの接続(ホスト経由)

mcp-network に参加していない開発コンテナからこのMCPサーバーにアクセスする必要がある場合(例:既存プロジェクトとの兼ね合いでネットワーク変更が難しい場合)、ホストマシン経由で接続できます。

この方法では、開発コンテナから見て「ホストマシン」にあたるIPアドレスまたは特別なDNS名と、MCPサーバーがホスト上で公開しているポート(compose.ymlports で設定、デフォルトは3002)を指定します。

接続先URL:

http://<host_ip_or_dns_name>:<PORT>/sse

<PORT> はMCPサーバーが起動しているポート番号に置き換えてください。

<host_ip_or_dns_name> の特定方法:

Docker Desktop (Mac/Windows): 特別なDNS名 host.docker.internal を使用できます。
例: http://host.docker.internal:3002/sse
Linux:
ホストのIPアドレス: ホストマシンのネットワークインターフェースに割り当てられているIPアドレスを使用します(例:ifconfigip addr コマンドで確認)。
例: http://192.168.1.10:3002/sse (IPアドレスは環境によって異なります)
Dockerブリッジネットワークのゲートウェイ: Dockerのデフォルトブリッジネットワーク (bridge) のゲートウェイIPアドレス(通常 172.17.0.1)を使用できます。docker network inspect bridge コマンドで確認できます。
例: http://172.17.0.1:3002/sse

注意点:

ホストのファイアウォール設定によっては、開発コンテナからホストのポートへのアクセスが許可されていない場合があります。

  • 使用するポート番号は、docker compose ps コマンドや compose.yml ファイルで確認してください。


便利な使用方法

毎回プロジェクトディレクトリに移動してdocker composeコマンドを実行するのは面倒です。以下の方法を使用すると、どこからでも簡単にサーバーを起動・停止できます。

シェルスクリプトを使用した方法

このプロジェクトには、サーバーの起動・停止・ログ表示を簡単に行うためのシェルスクリプトが含まれています。

1. プロジェクトをクローンまたはダウンロードします:

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.