
PlayMCP Browser Automation Server
A comprehensive MCP server that provides powerful web automation tools using Playwright, enabling web scraping, testing, and browser interaction through natural language commands.
Tools
openBrowser
Launch a new browser instance
navigate
Navigate to a URL
click
Click an element
moveMouse
Move mouse to coordinates
scroll
Scroll the page by specified amounts
type
Type text into an element
screenshot
Take a screenshot
getPageSource
Get the HTML source code of the current page
getPageText
Get the text content of the current page
getPageTitle
Get the title of the current page
getPageUrl
Get the URL of the current page
getScripts
Get all JavaScript code from the current page
getStylesheets
Get all CSS stylesheets from the current page
getMetaTags
Get all meta tags from the current page
getLinks
Get all links from the current page
getImages
Get all images from the current page
getForms
Get all forms from the current page
getElementContent
Get the HTML and text content of a specific element
executeJavaScript
Execute arbitrary JavaScript code on the current page and return the result
closeBrowser
Close the browser
README
PlayMCP Browser Automation Server
A comprehensive MCP (Model Context Protocol) server for browser automation using Playwright. This server provides powerful tools for web scraping, testing, and automation.
Features
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
- 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
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 | x: number, y: number |
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 |
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
git clone <repository-url> cd PlayMCP npm install npm run build
-
Install Playwright Browsers
npx playwright install
This downloads the necessary browser binaries (Chromium, Firefox, Safari).
-
Verify Installation
npm run start
You should see "Browser Automation MCP Server starting..." if everything is working.
Quick Installation
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:
{
"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):
{
"servers": {
"playmcp-browser": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/PlayMCP/dist/server.js"]
}
}
}
For Windows users:
{
"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:
{
"mcpServers": {
"playmcp-browser": {
"type": "stdio",
"command": "node",
"args": ["/Users/username/PlayMCP/dist/server.js"],
"description": "Browser automation with Playwright"
}
}
}
Tool Examples
Basic Web Scraping:
// 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:
// 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:
// Scroll and interact
await scroll({ x: 0, y: 500 })
await moveMouse({ x: 100, y: 200 })
await click({ selector: ".dropdown-menu" })
Advanced JavaScript Execution:
// 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:
// Take screenshots
await screenshot({ path: "./full-page.png", type: "page" })
await screenshot({ path: "./element.png", type: "element", selector: "#main-content" })
Quick Start
-
Install and setup:
git clone <repo-url> && cd PlayMCP npm install && npm run build && npx playwright install
-
Add to your MCP client configuration
-
Start automating:
await openBrowser({ debug: true }) await navigate({ url: "https://news.ycombinator.com" }) const links = await getLinks() console.log(`Found ${links.length} links`)
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
# Try manual browser installation npx playwright install chromium # Or install all browsers npx playwright install
-
Permission errors on Linux/macOS
# Make sure the script is executable chmod +x dist/server.js
-
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
# 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
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。