The PlayMCP Browser Automation Server enables comprehensive browser automation for web scraping, testing, and web interaction via Playwright. You can:
- Launch and manage browser instances with headless mode and debugging options
- Navigate to URLs and interact with pages through clicks, typing, and mouse movements
- Extract content including HTML source, text, title, URL, meta tags, links, images, forms, scripts, and stylesheets
- Manipulate pages by scrolling, taking screenshots, and executing custom JavaScript
- Automate form interactions by filling fields and submitting forms
- Close browser sessions after completing tasks
Provides capabilities to extract all CSS stylesheets from web pages through the getStylesheets tool.
Provides browser automation capabilities for Firefox through Playwright, enabling web scraping, testing, and automation tasks.
Fully compatible with VS Code GitHub Copilot, allowing direct use of browser automation tools within VS Code.
Allows execution of arbitrary JavaScript code on web pages and returns results through the executeJavaScript tool.
Runs as a Node.js application, enabling browser automation server functionality through the Node.js runtime.
Enables browser automation for Safari through Playwright, supporting web scraping, testing, and automation workflows.
Built with TypeScript, providing type definitions for the MCP protocol implementation and browser controllers.
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
Basic Usage
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
Tool | Description | Required Parameters |
---|---|---|
openBrowser | Launch browser instance | headless?: boolean, debug?: boolean |
navigate | Navigate to URL | url: string |
click | Click element | selector: string |
type | Type text into element | selector: string, text: string |
moveMouse | Move mouse to coordinates | x: number, y: number |
scroll | Scroll page with feedback | x: number, y: number, smooth?: boolean |
screenshot | Take screenshot | path: string, type?: string, selector?: string |
getPageSource | Get HTML source | None |
getPageText | Get text content | None |
getPageTitle | Get page title | None |
getPageUrl | Get current URL | None |
getScripts | Get JavaScript code | None |
getStylesheets | Get CSS stylesheets | None |
getMetaTags | Get meta tags | None |
getLinks | Get all links | None |
getImages | Get all images | None |
getForms | Get all forms | None |
getElementContent | Get element content | selector: string |
getElementHierarchy | Get DOM hierarchy | selector?: string, maxDepth?: number, includeText?: boolean, includeAttributes?: boolean |
executeJavaScript | Run JavaScript | script: string |
closeBrowser | Close browser | None |
Installation
Complete Installation Steps
- Prerequisites
- Node.js 16+ (download from nodejs.org)
- Git (for cloning the repository)
- Clone and Setup
- Install Playwright BrowsersThis downloads the necessary browser binaries (Chromium, Firefox, Safari).
- Verify InstallationYou should see "Browser Automation MCP Server starting..." if everything is working.
Quick Installation
Usage
As MCP Server
Add to your MCP configuration file:
Standard MCP Configuration:
Alternative Configuration (works with VS Code GitHub Copilot):
For Windows users:
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:
Tool Examples
Basic Web Scraping:
Form Automation:
Page Interaction:
DOM Structure Analysis:
Advanced JavaScript Execution:
Screenshot and Documentation:
Quick Start
- Install and setup:
- Add to your MCP client configuration
- Start automating:
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
- "Browser not initialized" error
- Make sure to call
openBrowser
before other browser operations - Check if Node.js version is 16 or higher
- Make sure to call
- Playwright installation fails
- Permission errors on Linux/macOS
- 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
- 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
- Try running with
Testing Your Installation
You should see a JSON response listing all available tools.
License
MIT License
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A comprehensive MCP server that provides powerful web automation tools using Playwright, enabling web scraping, testing, and browser interaction through natural language commands.
- Features
- Quick Start
- Tool Categories
- Available Tools Reference
- Installation
- Usage
- Quick Start
- Development
- Requirements
- Troubleshooting
- License
Related Resources
Related MCP Servers
- AsecurityFlicenseAqualityPlaywright MCP server enables AI-driven Playwright test generation by allowing interaction with web pages and element inspection. Integrated with IDEs like Cursor, it provides real-time context to enhance test accuracy and efficiency.Last updated -514,66823TypeScript
- AsecurityAlicenseAqualityAn MCP server that retrieves web page content using Playwright headless browser, capable of extracting main content and converting to Markdown format.Last updated -24,017790TypeScriptMIT License
- AsecurityAlicenseAqualityA MCP server that provides browser automation tools, allowing users to navigate websites, take screenshots, click elements, fill forms, and execute JavaScript through Playwright.Last updated -8PythonApache 2.0
- AsecurityFlicenseAqualityPlaywright wrapper for MCP that enables LLM-powered clients to control a browser for automation tasks.Last updated -10Python