playwright plus python mcp
The server provides tools for web automation using Playwright, allowing navigation, interaction, and JavaScript execution on web pages, and supports note storage with summarization capabilities.
The server provides tools for web automation using Playwright, allowing navigation, interaction, and JavaScript execution on web pages, and supports note storage with summarization capabilities.
A MCP server with playwright tools
The server implements a simple note storage system with: - Custom note:// URI scheme for accessing individual notes - Each note resource has a name, description and text/plain mimetype
The server provides a single prompt: - summarize-notes: Creates summaries of all stored notes - Optional "style" argument to control detail level (brief/detailed) - Generates prompt combining all current notes with style preference
The server implements the following tools:
- playwright_navigate
: Navigates to a specified URL. This operation will automatically create a new session if there is no active session.
- Requires a url
argument (string).
- playwright_screenshot
: Takes a screenshot of the current page or a specific element.
- Requires a name
argument (string) for the screenshot file name.
- Optional selector
argument (string) to specify a CSS selector for the element to screenshot. If no selector is provided, a full-page screenshot is taken.
- playwright_click
: Clicks an element on the page using a CSS selector.
- Requires a selector
argument (string) to specify the CSS selector for the element to click.
- playwright_fill
: Fills out an input field.
- Requires a selector
argument (string) to specify the CSS selector for the input field.
- Requires a value
argument (string) to specify the value to fill.
- playwright_evaluate
: Executes JavaScript code in the browser console.
- Requires a script
argument (string) to specify the JavaScript code to execute.
- playwright_click_text
: Clicks an element on the page by its text content.
- Requires a text
argument (string) to specify the text content of the element to click.
- playwright_get_text_content
: Get the text content of all visiable elements.
- playwright_get_html_content
: Get the HTML content of the page.
- Requires a selector
argument (string) to specify the CSS selector for the element.
[TODO: Add configuration details specific to your implementation]
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
"mcpServers": {
"playwright-server": {
"command": "uv",
"args": [
"--directory",
"C:UsersxxxxxDocumentsprojectpythonmcpplaywright-server",
"run",
"playwright-server"
]
}
}
"mcpServers": {
"playwright-server": {
"command": "uvx",
"args": [
"playwright-server"
]
}
}
To prepare the package for distribution:
Sync dependencies and update lockfile:
uv sync
Build package distributions:
uv build
This will create source and wheel distributions in the dist/
directory.
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token: --token
or UV_PUBLISH_TOKEN
- Or username/password: --username
/UV_PUBLISH_USERNAME
and --password
/UV_PUBLISH_PASSWORD
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm
with this command:
npx @modelcontextprotocol/inspector uv --directory C:UsersYUNYINGDocumentsprojectpythonmcpplaywright-server run playwright-server
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
[
{
"description": "Navigate to a URL,thip op will auto create a session",
"inputSchema": {
"properties": {
"url": {
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
},
"name": "playwright_navigate"
},
{
"description": "Take a screenshot of the current page or a specific element",
"inputSchema": {
"properties": {
"name": {
"type": "string"
},
"selector": {
"description": "CSS selector for element to screenshot,null is full page",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"name": "playwright_screenshot"
},
{
"description": "Click an element on the page using CSS selector",
"inputSchema": {
"properties": {
"selector": {
"description": "CSS selector for element to click",
"type": "string"
}
},
"required": [
"selector"
],
"type": "object"
},
"name": "playwright_click"
},
{
"description": "Fill out an input field",
"inputSchema": {
"properties": {
"selector": {
"description": "CSS selector for input field",
"type": "string"
},
"value": {
"description": "Value to fill",
"type": "string"
}
},
"required": [
"selector",
"value"
],
"type": "object"
},
"name": "playwright_fill"
},
{
"description": "Execute JavaScript in the browser console",
"inputSchema": {
"properties": {
"script": {
"description": "JavaScript code to execute",
"type": "string"
}
},
"required": [
"script"
],
"type": "object"
},
"name": "playwright_evaluate"
},
{
"description": "Click an element on the page by its text content",
"inputSchema": {
"properties": {
"text": {
"description": "Text content of the element to click",
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
},
"name": "playwright_click_text"
},
{
"description": "Get the text content of all elements",
"inputSchema": {
"properties": {},
"type": "object"
},
"name": "playwright_get_text_content"
},
{
"description": "Get the HTML content of the page",
"inputSchema": {
"properties": {
"selector": {
"description": "CSS selector for the element",
"type": "string"
}
},
"required": [
"selector"
],
"type": "object"
},
"name": "playwright_get_html_content"
}
]