mcp-server-playwright

mcp-server-playwright

3.3

mcp-server-playwright is an experimental project designed to manipulate a browser using MCP and Playwright, enabling browser control through AI.

The mcp-server-playwright project is an innovative initiative that leverages the Model Context Protocol (MCP) in conjunction with Playwright to control web browsers programmatically. This project aims to provide a seamless interface for AI-driven browser manipulation, allowing users to open, navigate, and close browser tabs through a set of defined MCP commands. By integrating Playwright, a powerful browser automation library, the project ensures robust and efficient browser interactions. This experimental setup is particularly useful for developers and researchers looking to explore AI-driven web automation and testing.

Features

  • Open a browser with a specified URL using the open-browser command.
  • Close a designated page in the current browser with close-page.
  • Navigate to a specified URL using navigate-to-page.
  • Open a new tab with a specified URL using open-new-page.
  • Retrieve the readability content of the current page with get-page-content.

MCP Tools

  • {'open-browser': 'Open a browser with the specified URL(option).'}
  • {'close-page': 'Close a designated page in the current browser.'}
  • {'close-browser': 'Close the browser.'}
  • {'navigate-to-page': 'Navigate to the specified URL.'}
  • {'open-new-page': 'Open a page in a new tab.'}
  • {'get-page-content': 'Get the readability content of the current page.'}

Usage with Different Platforms

install_dependencies

bash
pnpm install

mcp_configuration


{
  "mcpServers": {
    "mcp-server-playwright": {
      "command": "bun",
      "args": ["yourpath/mcp-server-playwright/src/index.ts"],
      "env": {
        "CHROME_PATH": "your_chrome_path",
        "MUSER_DATA_DIR": "your_chrome_user_data_path"
      }
    }
  }
}