PlayMCP Browser Automation Serverのロゴ

PlayMCP Browser Automation Server

コミュニティ
jomon003

MCP server for Playwright MCP Unofficial.

公開者jomon003
リポジトリPlayMCP
言語TypeScript
フォーク
3
スター
15
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    PlayMCP Browser Automation Serverは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには15件のスターと3件のフォークがあります。

PlayMCP Browser Automation Server

A comprehensive MCP (Model Context Protocol) server for browser automation using Playwright. This server provides 38 powerful tools for web scraping, testing, and automation.

Features

🚀 Core Browser Automation (21 tools)

  • Navigation: navigate, goForward, goBack (via scroll)
  • Interaction: click, type, hover, dragAndDrop, selectOption
  • Mouse Control: moveMouse, mouseMove, mouseClick, mouseDrag
  • Keyboard: pressKey
  • Waiting: waitForText, waitForSelector
  • Screenshots: screenshot, takeScreenshot (enhanced)
  • Page Info: getPageSource, getPageText, getPageTitle, getPageUrl
  • Element Analysis: getElementContent, getElementHierarchy
  • Scripts & Styles: getScripts, getStylesheets, getMetaTags

🔍 Advanced Data Extraction (7 tools)

  • Links & Images: getLinks, getImages
  • Forms: getForms
  • Console Monitoring: getConsoleMessages
  • Network Monitoring: getNetworkRequests
  • JavaScript Execution: executeJavaScript, evaluateWithReturn

📁 File Operations (2 tools)

  • File Upload: uploadFiles
  • Dialog Handling: handleDialog

⚙️ Browser Management (8 tools)

  • Browser Control: openBrowser, closeBrowser
  • Viewport Management: resize
  • Page Manipulation: scroll (enhanced with feedback)
  • Element Hierarchy: Deep DOM analysis with configurable depth
  • Enhanced Screenshots: Full page, element-specific, custom paths
  • Mouse Coordinates: Pixel-perfect mouse control
  • Wait Conditions: Smart waiting for elements and text

Quick Start

Installation

bash
# Clone the repository
git clone https://github.com/jomon003/PlayMCP.git
cd PlayMCP

# Install dependencies
npm install

# Build the project
npm run build

# Test the server
npm test

Basic Usage

javascript
// Start the server
node ./dist/server.js

// Send MCP commands via JSON-RPC
{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}

Tool Categories

🎯 Navigation & Interaction

  • navigate: Go to any URL
  • goForward: Navigate forward in browser history
  • click: Click elements with smart selector resolution
  • type: Type text with realistic keyboard simulation
  • hover: Hover over elements for tooltips and interactions
  • dragAndDrop: Drag elements between locations
  • selectOption: Choose options from dropdowns and multi-selects
  • pressKey: Send specific keyboard keys (Enter, Escape, etc.)

⏱️ Smart Waiting

  • waitForText: Wait for specific text to appear
  • waitForSelector: Wait for elements to load
  • Built-in timeouts and error handling

🖱️ Precise Mouse Control

  • mouseMove: Move to exact coordinates
  • mouseClick: Click at specific pixels
  • mouseDrag: Drag between coordinate points
  • moveMouse: Enhanced mouse positioning

📊 Data Extraction

  • getElementHierarchy: Deep DOM structure analysis
  • getConsoleMessages: Monitor browser console output
  • getNetworkRequests: Track HTTP requests and responses
  • getLinks: Extract all page links with metadata
  • getImages: Get all images with attributes
  • getForms: Analyze form structures and fields

🎬 Visual & Media

  • screenshot: Basic screenshot capture
  • takeScreenshot: Advanced screenshots (full page, elements, custom paths)
  • resize: Control viewport dimensions

📁 File & Dialog Operations

  • uploadFiles: Handle file input uploads
  • handleDialog: Manage alerts, confirms, and prompts

⚙️ JavaScript Execution

  • executeJavaScript: Run JavaScript code
  • evaluateWithReturn: Execute JS with return values

Core Browser Controls

  • openBrowser - Launch a new browser instance with optional headless mode
  • navigate - Navigate to any URL
  • click - Click elements using CSS selectors
  • type - Type text into input fields
  • moveMouse - Move mouse to specific coordinates
  • scroll - Scroll the page by specified amounts with enhanced feedback and smooth scrolling support
  • screenshot - Take screenshots of the page, viewport, or specific elements
  • closeBrowser - Close the browser instance

Page Content Extraction

  • getPageSource - Get the complete HTML source code
  • getPageText - Get the text content (stripped of HTML)
  • getPageTitle - Get the page title
  • getPageUrl - Get the current URL
  • getScripts - Extract all JavaScript code from the page
  • getStylesheets - Extract all CSS stylesheets
  • getMetaTags - Get all meta tags with their attributes
  • getLinks - Get all links with href, text, and title
  • getImages - Get all images with src, alt, and dimensions
  • getForms - Get all forms with their fields and attributes
  • getElementContent - Get HTML and text content of specific elements
  • getElementHierarchy - Get the hierarchical DOM structure with parent-child relationships

Advanced Capabilities

  • executeJavaScript - Execute arbitrary JavaScript code on the page and return results

Available Tools Reference

ToolDescriptionRequired Parameters
openBrowserLaunch browser instanceheadless?: boolean, debug?: boolean
navigateNavigate to URLurl: string
clickClick elementselector: string
typeType text into elementselector: string, text: string
moveMouseMove mouse to coordinatesx: number, y: number
scrollScroll page with feedbackx: number, y: number, smooth?: boolean
screenshotTake screenshotpath: string, type?: string, selector?: string
getPageSourceGet HTML sourceNone
getPageTextGet text contentNone
getPageTitleGet page titleNone
getPageUrlGet current URLNone
getScriptsGet JavaScript codeNone
getStylesheetsGet CSS stylesheetsNone
getMetaTagsGet meta tagsNone
getLinksGet all linksNone
getImagesGet all imagesNone
getFormsGet all formsNone
getElementContentGet element contentselector: string
getElementHierarchyGet DOM hierarchyselector?: string, maxDepth?: number, includeText?: boolean, includeAttributes?: boolean
executeJavaScriptRun JavaScriptscript: string
closeBrowserClose browserNone

Installation

Complete Installation Steps

  1. Prerequisites

    • Node.js 16+ (download from nodejs.org)
    • Git (for cloning the repository)
  2. Clone and Setup

    bash
    git clone <repository-url>
    cd PlayMCP
    npm install
    npm run build
  3. Install Playwright Browsers

    bash
    npx playwright install

    This downloads the necessary browser binaries (Chromium, Firefox, Safari).

  4. Verify Installation

    bash
    npm run start

    You should see "Browser Automation MCP Server starting..." if everything is working.

Quick Installation

bash
git clone <repository-url>
cd PlayMCP
npm install && npm run build && npx playwright install

Usage

As MCP Server

Add to your MCP configuration file:

Standard MCP Configuration:

json
{
  "servers": {
    "playmcp-browser": {
      "type": "stdio",
      "command": "node",
      "args": ["./dist/server.js"],
      "cwd": "/path/to/PlayMCP",
      "description": "Browser automation server using Playwright"
    }
  }
}

Alternative Configuration (works with VS Code GitHub Copilot):

json
{
  "servers": {
    "playmcp-browser": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/PlayMCP/dist/server.js"]
    }
  }
}

For Windows users:

json
{
  "servers": {
    "playmcp-browser": {
      "type": "stdio",
      "command": "node",
      "args": ["C:\\path\\to\\PlayMCP\\dist\\server.js"]
    }
  }
}

VS Code GitHub Copilot Integration

This MCP server is fully compatible with VS Code GitHub Copilot. After adding the configuration above to your MCP settings, you can use all browser automation tools directly within VS Code.

Configuration Examples

Claude Desktop (config.json location):

  • Windows: %APPDATA%\Claude\config.json
  • macOS: ~/Library/Application Support/Claude/config.json
  • Linux: ~/.config/Claude/config.json

VS Code MCP Extension: Add to your VS Code settings.json or MCP configuration file.

Example Full Configuration:

json
{
  "mcpServers": {
    "playmcp-browser": {
      "type": "stdio",
      "command": "node",
      "args": ["/Users/username/PlayMCP/dist/server.js"],
      "description": "Browser automation with Playwright"
    }
  }
}

Tool Examples

Basic Web Scraping:

javascript
// Open browser and navigate
await openBrowser({ headless: false, debug: true })
await navigate({ url: "https://example.com" })

// Extract content
const title = await getPageTitle()
const links = await getLinks()
const forms = await getForms()

Form Automation:

javascript
// Fill out a form
await click({ selector: "#login-button" })
await type({ selector: "#username", text: "user@example.com" })
await type({ selector: "#password", text: "password123" })
await click({ selector: "#submit" })

Page Interaction:

javascript
// Enhanced scrolling with feedback
await scroll({ x: 0, y: 500, smooth: false })
// Returns: { before: {x: 0, y: 0}, after: {x: 0, y: 500}, scrolled: {x: 0, y: 500} }

// Smooth scrolling
await scroll({ x: 0, y: 300, smooth: true })

// Mouse interaction
await moveMouse({ x: 100, y: 200 })
await click({ selector: ".dropdown-menu" })

DOM Structure Analysis:

javascript
// Get page hierarchy (3 levels deep)
await getElementHierarchy({ maxDepth: 3 })

// Get detailed hierarchy with text and attributes
await getElementHierarchy({ 
  selector: "#main-content", 
  maxDepth: -1, 
  includeText: true, 
  includeAttributes: true 
})

// Get basic structure of a specific section
await getElementHierarchy({ selector: ".sidebar", maxDepth: 2 })

Advanced JavaScript Execution:

javascript
// Run custom JavaScript
await executeJavaScript({ 
  script: "document.querySelectorAll('h1').length" 
})

// Modify page content
await executeJavaScript({ 
  script: "document.body.style.backgroundColor = 'lightblue'" 
})

// Extract complex data
await executeJavaScript({ 
  script: `
    Array.from(document.querySelectorAll('article')).map(article => ({
      title: article.querySelector('h2')?.textContent,
      summary: article.querySelector('p')?.textContent
    }))
  `
})

Screenshot and Documentation:

javascript
// Take screenshots
await screenshot({ path: "./full-page.png", type: "page" })
await screenshot({ path: "./element.png", type: "element", selector: "#main-content" })

Quick Start

  1. Install and setup:

    bash
    git clone <repo-url> && cd PlayMCP
    npm install && npm run build && npx playwright install
  2. Add to your MCP client configuration

  3. Start automating:

    javascript
    await openBrowser({ debug: true })
    await navigate({ url: "https://news.ycombinator.com" })
    const links = await getLinks()
    console.log(`Found ${links.length} links`)
    
    // Analyze page structure
    const hierarchy = await getElementHierarchy({ maxDepth: 2 })
    console.log('Page structure:', hierarchy)

Development

  • src/server.ts - Main MCP server implementation
  • src/controllers/playwright.ts - Playwright browser controller
  • src/mcp/ - MCP protocol implementation
  • src/types/ - TypeScript type definitions

Requirements

System Requirements

  • Node.js 16+ (LTS version recommended)
  • Operating System: Windows, macOS, or Linux
  • Memory: At least 2GB RAM (4GB+ recommended for heavy usage)
  • Disk Space: ~500MB for browser binaries and dependencies

Dependencies

  • Playwright: Handles browser automation (automatically installed)
  • TypeScript: For compilation (dev dependency)
  • Browser Binaries: Downloaded via npx playwright install

Troubleshooting

Common Issues

  1. "Browser not initialized" error

    • Make sure to call openBrowser before other browser operations
    • Check if Node.js version is 16 or higher
  2. Playwright installation fails

    bash
    # Try manual browser installation
    npx playwright install chromium
    # Or install all browsers
    npx playwright install
  3. Permission errors on Linux/macOS

    bash
    # Make sure the script is executable
    chmod +x dist/server.js
  4. Path issues in MCP configuration

    • Use absolute paths in the configuration
    • On Windows, use double backslashes: C:\\path\\to\\PlayMCP\\dist\\server.js
    • Verify the path exists: node /path/to/PlayMCP/dist/server.js
  5. Browser crashes or timeouts

    • Try running with headless: false for debugging
    • Increase system memory if running multiple browser instances
    • Check if antivirus software is blocking browser processes

Testing Your Installation

bash
# Test the server directly
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node ./dist/server.js

You should see a JSON response listing all available tools.

License

MIT License

インストール

TypingMind
{
  "mcpServers": {
    "playmcp": {
      "command": "node",
      "args": [
        "./dist/server.js"
      ]
    }
  }
}

PlayMCP Browser Automation ServerのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度PlayMCP Browser Automation Serverに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

PlayMCP Browser Automation Serverをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. PlayMCP Browser Automation ServerのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "playmcp": {
      "command": "npx",
      "args": [
        "-y",
        "playmcp"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてPlayMCP Browser Automation ServerのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. PlayMCP Browser Automation ServerのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
PlayMCP Browser Automation Serverを使ってこのタスクを手伝ってもらえますか?
PlayMCP Browser Automation Server
はい、読みました。
PlayMCP Browser Automation Serverで調べた結果をお伝えします。

よくある質問

PlayMCP Browser Automation Server MCPサーバーは何に使いますか?

PlayMCP Browser Automation Serverは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでPlayMCP Browser Automation Server MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでPlayMCP Browser Automation Serverを利用できます。

TypingMindでPlayMCP Browser Automation Server MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。PlayMCP Browser Automation Serverを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

PlayMCP Browser Automation Server MCPをTypingMindに接続するにはどうすればよいですか?

PlayMCP Browser Automation ServerはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでPlayMCP Browser Automation Server MCPのどのようなツールを利用できますか?

PlayMCP Browser Automation ServerはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

PlayMCP Browser Automation Server MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。PlayMCP Browser Automation Serverで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇