mcp-playwright

mcp-playwright

A Model Context Protocol server for browser automation using Playwright.

4,707
Stars
408
Forks
4,707
Watchers
48
Issues
Playwright MCP Server provides browser automation capabilities through the Model Context Protocol, enabling large language models to interact with web pages programmatically. It supports features such as taking screenshots, generating test code, web scraping, and executing JavaScript in real browser sessions. The server can be installed via npm, Smithery, or mcp-get, and comes with tooling for integration into editors like VS Code and client environments like Claude Desktop. It offers robust testing with Jest and evaluation via mcp-eval, allowing seamless collaboration with LLM agents in automated workflows.

Key Features

Model Context Protocol compliant server
Browser automation with Playwright
LLM-driven web interaction and scraping
Screenshot capture and web page analysis
Automated test code generation
JavaScript execution within live browser sessions
Easy installation via npm, Smithery, mcp-get
VS Code and Claude Desktop integration
Jest-powered test suite with coverage reporting
Support for evals and MCP client workflows

Use Cases

Automating browser tasks for LLM agents
Generating and running browser-based tests programmatically
Web page scraping and data extraction using AI
Executing JavaScript code on demand through AI workflows
Capturing screenshots for analysis, reporting, or documentation
Integrating browser automation into developer IDEs like VS Code
Evaluating AI agent capabilities in real browser environments
Creating custom tools for AI-assisted web interaction
Augmenting LLM workflows with full browser context access
Rapid prototyping of new automated web-based scenarios for AI

README

Playwright MCP Server 🎭

smithery badge

A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, generate test code, web scraps the page and execute JavaScript in a real browser environment.

Screenshot

Playwright + Claude

Documentation | API reference

Installation

You can install the package using either npm, mcp-get, or Smithery:

Using npm:

bash
npm install -g @executeautomation/playwright-mcp-server

Using mcp-get:

bash
npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-server

Using Smithery

To install Playwright MCP for Claude Desktop automatically via Smithery:

bash
npx @smithery/cli install @executeautomation/playwright-mcp-server --client claude

Installation in VS Code

Install the Playwright MCP server in VS Code using one of these buttons:

Alternatively, you can install the Playwright MCP server using the VS Code CLI:

bash
# For VS Code
code --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'
bash
# For VS Code Insiders
code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'

After installation, the ExecuteAutomation Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.

Configuration to use Playwright Server

Here's the Claude Desktop configuration to use the Playwright server:

json
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["-y", "@executeautomation/playwright-mcp-server"]
    }
  }
}

Testing

This project uses Jest for testing. The tests are located in the src/__tests__ directory.

Running Tests

You can run the tests using one of the following commands:

bash
# Run tests using the custom script (with coverage)
node run-tests.cjs

# Run tests using npm scripts
npm test           # Run tests without coverage
npm run test:coverage  # Run tests with coverage
npm run test:custom    # Run tests with custom script (same as node run-tests.cjs)

The test coverage report will be generated in the coverage directory.

Running evals

The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found here.

bash
OPENAI_API_KEY=your-key  npx mcp-eval src/evals/evals.ts src/tools/codegen/index.ts

Contributing

When adding new tools, please be mindful of the tool name length. Some clients, like Cursor, have a 60-character limit for the combined server and tool name (server_name:tool_name).

Our server name is playwright-mcp. Please ensure your tool names are short enough to not exceed this limit.

Star History

Star History Chart

Star History

Star History Chart

Repository Owner

Repository Details

Language TypeScript
Default Branch main
Size 25,789 KB
Contributors 23
License MIT License
MCP Verified Sep 5, 2025

Programming Languages

TypeScript
97.93%
JavaScript
1.55%
Dockerfile
0.53%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

Didn't find tool you were looking for?

Be as detailed as possible for better results