playwright-generate-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@playwright-generate-mcpGenerate a Playwright login spec with page objects, then run it and score quality."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
playwright-generate-mcp
An enterprise-grade Model Context Protocol (MCP) server that empowers AI coding assistants (Cursor, Claude Desktop, Antigravity, Roo Code, etc.) to generate, score, run, and auto-heal robust, maintainable, and flake-resistant Playwright E2E tests.
It enforces a Domain-Driven Page Object Model (POM) architecture, provides cross-file quality scoring, extracts rich single-turn failure diagnostics, and adheres to strict web-first anti-flakiness rules.
⨠Key Features
šļø Domain-Driven POM Architecture: Enforces separation of concerns between Declarative Specs, Page Objects, Custom Fixtures, and Dynamic Data Factories.
š Cross-File POM Quality Scoring:
score_test_qualityandrun_playwright_testautomatically traverse import dependencies (.spec.ts$\rightarrow$.fixture.ts$\rightarrow$*.page.ts/*.component.ts), scoring locators and anti-patterns across all related files.ā” Single-Turn Rich Diagnostics: When a test fails,
run_playwright_testimmediately returns the exact file & line location, error category, the last 3ā5 action steps before failure, browser console logs, failed HTTP requests (4xx/5xx), and screenshot paths in a single turn.š”ļø Strict Anti-Flakiness Rules: Detects and discourages arbitrary sleeps (
waitForTimeout,setTimeout), un-awaited actions,networkidledependencies, and manual text extractions in favor of web-first auto-retrying assertions.š§ Stateless Root Auto-Discovery: Automatically traverses parent directories to discover
playwright.config.{ts,js,mjs,cjs,mts,cts}without requiring manual path configuration.š¬ Adaptive Interactive Confirmations: Supports interactive UI modals (
ask_question,vscode_askQuestions) or formatted numbered lists before applying test heals.
Related MCP server: Limetest MCP Server
š Architecture Standard
This MCP guides AI agents to structure tests under a clean Domain-Driven hierarchy:
tests/e2e/
āāā domain/ # Grouped by business features
ā āāā {feature}/
ā āāā pages/ # Page Objects / Component Objects
ā ā āāā {step}.page.ts
ā āāā {feature}.fixture.ts # Custom Fixture injecting Page Objects & Data
āāā factory/ # Dynamic test data builders
ā āāā {entity}.factory.ts # Unique data per run (timestamp / Faker)
āāā specs/ # Declarative, readable test specs
āāā {feature}.spec.tsCore Design Rules
Strict Separation: No raw locators or direct DOM manipulations inside
*.spec.tsfiles. All UI interactions live inside Page/Component Objects.Custom Fixtures: Inject Page Objects and test data using
test.extend<Fixtures>()instead of manualnew Page()instantiations in specs.Dynamic Data Factories: Generate unique test data per run to prevent database unique-constraint collisions on test re-runs.
Semantic Locators: Prioritize
getByRole>getByLabel/getByPlaceholder>getByText>getByTestId. Deep nested CSS (div > div > span) is strictly forbidden.Tagging Conventions:
@smoke: Critical happy paths.@regression: Comprehensive user flows.@ui: Pure UI/frontend tests usingpage.route()to stub API responses.@integration: Tests validating against real backend APIs.
š ļø MCP Tools
Tool | Description |
| Runs a Playwright spec file in the target project. Returns pass/fail status, comprehensive multi-file |
| Scores a spec file and its imported Page Objects on measurable quality signals: |
| Deep diagnostic inspector to re-inspect specific test failure details from a previous run report. |
| Audits |
| Runtime fallback to manually set the target project root if auto-detection is not applicable. |
š MCP Prompts
playwright_e2e_workflow: Complete end-to-end prompt instructing AI agents on the Domain-Driven POM architecture, code generation sequences (Step A to Step E), strict anti-flakiness writing rules, single-turn diagnostics, and safe healing workflows.
š Installation & Setup
1. Build from Source
git clone https://github.com/your-username/playwright-generate-mcp.git
cd playwright-generate-mcp
npm install
npm run build2. Configure MCP Client
Add the server to your MCP configuration file (e.g. claude_desktop_config.json, Cursor Settings, or Antigravity MCP settings):
{
"mcpServers": {
"playwright-generate": {
"command": "node",
"args": ["/absolute/path/to/playwright-generate-mcp/dist/index.js"]
}
}
}Or when published to NPM:
{
"mcpServers": {
"playwright-generate": {
"command": "npx",
"args": ["-y", "playwright-generate-mcp"]
}
}
}š§āš» Development
npm run dev # tsx watch mode
npm run build # Compile TypeScript to dist/
npm start # Run compiled MCP serverš License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceGenerates intelligent Playwright locators with reliability rankings, creates Page Object Models, and runs test automation scripts directly from your IDE or AI assistant.5151MIT
- AlicenseNot gradedqualityCmaintenanceEnables automated end-to-end testing powered by Playwright where test cases are defined in natural language and executed by AI. Uses lightweight snapshot analysis with vision mode fallback for sophisticated testing scenarios.3Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to execute browser automation, perform QA tasks, and generate test code through natural language commands using Playwright.5
- AlicenseNot gradedqualityDmaintenanceAutomates repository analysis, test planning, and generation of end-to-end tests with Playwright, acting as an intelligent quality assistant.16MIT
Related MCP Connectors
AI QA that runs your app in a browser on every pull request: projects, test targets, test cases.
AI QA tester ā real browsers scan sites for bugs, SEO, perf, and accessibility issues via chat.
Playwright selector risk checks with healing suggestions and receipts.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/baramubarok/playwright-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server