Skip to content

Commit b724b02

Browse files
Added first cut of MCP-Playwright codebase
1 parent 855ceeb commit b724b02

File tree

8 files changed

+632
-2
lines changed

8 files changed

+632
-2
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock.json linguist-generated=true

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry="https://registry.npmjs.org/"
2+
@modelcontextprotocol:registry="https://registry.npmjs.org/"

README.md

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,92 @@
1-
# mcp-playwright
2-
Repository contains Model Context Protocol support of Playwright for Claude
1+
# Playwright
2+
3+
A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
4+
5+
6+
## Here is how you need to build the code in your local machine
7+
8+
**Clone the repository**
9+
```bash
10+
git clone https://github.com/executeautomation/mcp-playwright.git
11+
```
12+
13+
**Build the code**
14+
```bash
15+
npm run build
16+
npm link
17+
```
18+
19+
## Configuration to use Playwright Server
20+
Here's the Claude Desktop configuration to use the Playwright server:
21+
22+
```json
23+
{
24+
"mcpServers": {
25+
"playwright": {
26+
"command": "npx",
27+
"args": ["-y", "@modelcontextprotocol/server-playwright"]
28+
}
29+
}
30+
}
31+
```
32+
33+
34+
## Components
35+
36+
### Tools
37+
38+
- **playwright_navigate**
39+
- Navigate to any URL in the browser
40+
- Input: `url` (string)
41+
42+
- **playwright_screenshot**
43+
- Capture screenshots of the entire page or specific elements
44+
- Inputs:
45+
- `name` (string, required): Name for the screenshot
46+
- `selector` (string, optional): CSS selector for element to screenshot
47+
- `width` (number, optional, default: 800): Screenshot width
48+
- `height` (number, optional, default: 600): Screenshot height
49+
50+
- **playwright_click**
51+
- Click elements on the page
52+
- Input: `selector` (string): CSS selector for element to click
53+
54+
- **playwright_hover**
55+
- Hover elements on the page
56+
- Input: `selector` (string): CSS selector for element to hover
57+
58+
- **playwright_fill**
59+
- Fill out input fields
60+
- Inputs:
61+
- `selector` (string): CSS selector for input field
62+
- `value` (string): Value to fill
63+
64+
- **playwright_select**
65+
- Select an element with SELECT tag
66+
- Inputs:
67+
- `selector` (string): CSS selector for element to select
68+
- `value` (string): Value to select
69+
70+
- **playwright_evaluate**
71+
- Execute JavaScript in the browser console
72+
- Input: `script` (string): JavaScript code to execute
73+
74+
### Resources
75+
76+
The server provides access to two types of resources:
77+
78+
1. **Console Logs** (`console://logs`)
79+
- Browser console output in text format
80+
- Includes all console messages from the browser
81+
82+
2. **Screenshots** (`screenshot://<name>`)
83+
- PNG images of captured screenshots
84+
- Accessible via the screenshot name specified during capture
85+
86+
## Key Features
87+
88+
- Browser automation
89+
- Console log monitoring
90+
- Screenshot capabilities
91+
- JavaScript execution
92+
- Basic web interaction (navigation, clicking, form filling)

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@modelcontextprotocol/servers",
3+
"private": true,
4+
"version": "0.5.1",
5+
"description": "Model Context Protocol servers for Playwright",
6+
"license": "MIT",
7+
"author": "ExecuteAutomation, Ltd (https://executeautomation.com)",
8+
"homepage": "https://github.com/executeautomation/mcp-playwright",
9+
"bugs": "https://github.com/executeautomation/mcp-playwright/issues",
10+
"type": "module",
11+
"workspaces": [
12+
"src/*"
13+
],
14+
"files": [],
15+
"scripts": {
16+
"build": "npm run build --workspaces",
17+
"watch": "npm run watch --workspaces",
18+
"publish-all": "npm publish --workspaces --access public",
19+
"link-all": "npm link --workspaces"
20+
},
21+
"dependencies": {
22+
"@modelcontextprotocol/server-playwright": "*"
23+
}
24+
}

0 commit comments

Comments
 (0)