Playwright MCP Server
Provides tools for automating Firefox browser, enabling AI agents to navigate, click, type, and inspect pages programmatically.
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 MCP Servernavigate to the login page and log in with test credentials"
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 MCP Server — POC with 100+ Test Cases
VentureDive QA Engineering Prepared by: Raheel Imran Date: May 2026
Overview
This Proof of Concept (POC) demonstrates the Playwright MCP Server (@playwright/mcp) used as the browser automation engine for a complete test suite. It includes:
A fully functional demo web application — TaskMaster Pro
166 Playwright test cases across 8 feature areas using reusable MCP-style commands
A
cmdfixture that maps directly to@playwright/mcptool namesA live MCP server demo that connects via
@modelcontextprotocol/sdkand drives the browser using real MCP protocol — no external API callsMCP server configuration for Claude Desktop and Claude Code
An interactive HTML test report
Related MCP server: mcp-browser-use
Architecture
┌──────────────────────────────────────────────────────────────┐
│ Playwright MCP POC │
│ │
│ ┌───────────────────┐ MCP Protocol ┌────────────────┐ │
│ │ MCP Client │◄─────────────────►│ @playwright/mcp│ │
│ │ (run-demo.ts) │ stdio transport │ Server │ │
│ └───────────────────┘ └───────┬────────┘ │
│ │ │
│ Playwright Browser │
│ │ │
│ ┌────────▼─────────┐ │
│ │ TaskMaster Pro │ │
│ │ localhost:3000 │ │
│ └──────────────────┘ │
│ │
│ Playwright Test Runner (166 tests) │
│ └── tests/fixtures/browser-commands.ts ← reusable cmd │
│ ├── auth.spec.ts (25 tests) │
│ ├── navigation.spec.ts (20 tests) │
│ ├── dashboard.spec.ts (12 tests) │
│ ├── tasks.spec.ts (45 tests) │
│ ├── categories.spec.ts (14 tests) │
│ ├── profile.spec.ts (17 tests) │
│ ├── settings.spec.ts (17 tests) │
│ └── ui-components.spec.ts (16 tests) │
└──────────────────────────────────────────────────────────────┘Quick Start
1. Install dependencies
npm install
npx playwright install chromium2. Start the demo app
npm run dev
# → http://localhost:30003. Run all tests and generate HTML report
npm test
npm run test:report # opens playwright-report/index.html4. Run the MCP server demo (browser driven via MCP protocol)
npm run demo
# Starts @playwright/mcp server, connects as MCP client, runs 10 scenarios5. Interactive test runner
npm run test:uinpm Scripts
Script | Description |
| Start the TaskMaster Pro demo app on port 3000 |
| Run all 100+ tests (Chromium + Firefox) |
| Open Playwright interactive UI mode |
| Open generated HTML report |
| Run tests in headed browser |
| Run tests with Playwright debugger |
| Run the MCP server demo (real MCP protocol) |
| Start |
Reusable Browser Commands
All tests import from tests/fixtures/browser-commands.ts instead of @playwright/test directly.
Command names match @playwright/mcp tool names exactly, making the test code portable to any MCP client.
import { test, expect } from './fixtures/browser-commands';
test('example', async ({ cmd }) => {
await cmd.browser_navigate('/login.html');
await cmd.browser_type('email-input', 'testuser@test.com');
await cmd.browser_type('password-input', 'Test@123');
await cmd.browser_click('login-btn');
await cmd.browser_expect_url(/dashboard/);
await cmd.browser_take_screenshot('login-success.png');
});Full command reference
Command | MCP Tool | Description |
|
| Navigate to URL |
|
| Go back in history |
|
| Click element by data-testid |
|
| Fill input field |
|
| Clear then fill |
|
| Select dropdown option |
|
| Check a checkbox |
|
| Uncheck a checkbox |
|
| Capture screenshot |
| — | Get current URL |
| — | Get element text |
| — | Get input value |
|
| Returns boolean |
|
| Returns boolean |
|
| Count elements |
|
| Wait for element |
| — | Wait for URL |
| — (fixture-only) | Set localStorage via page.evaluate |
| — (fixture-only) | Run JS via page.evaluate |
| — | Assert current URL |
| — | Assert visible |
| — | Assert hidden |
| — | Assert text content |
| — | Assert element count |
| — | Assert input value |
| — | Assert checkbox state |
| — | Assert disabled |
| — | Assert attribute |
Demo App — TaskMaster Pro
A fully self-contained web app using localStorage for all data persistence.
Page | URL | Features |
Login |
| Form validation, password toggle, remember-me |
Register |
| Password strength, validation |
Dashboard |
| Stats, recent tasks, quick-add |
Tasks |
| CRUD, filter, search, sort, bulk actions |
Categories |
| Create, edit, delete categories |
Profile |
| Edit name, avatar, change password |
Settings |
| Theme, notifications, language, export |
404 |
| Error page |
Default test credentials:
Password | Role | |
|
| Test User |
|
| Admin User |
Pre-seeded data: 5 tasks (3 active, 2 completed) and 4 categories.
MCP Tools provided by @playwright/mcp
See the full categorized reference in MCP Server Setup → Available MCP tools below. Key tools used in this demo app:
Tool | Description |
| Navigate to a URL |
| Get accessibility tree — returns ARIA refs for click/type targets |
| Click an element by ARIA ref |
| Type text into a focused field |
| Fill multiple form fields in one call |
| Select a dropdown value |
| Capture the current page as an image |
| Write a localStorage key (used for fast auth seeding) |
| Evaluate JavaScript on the page |
| Wait for an element or condition |
| Inspect captured network traffic |
| Mock API responses for isolated testing |
| List, open, close, or switch tabs |
| Close the browser |
MCP Server Setup
@playwright/mcp exposes browser automation as MCP tools so any MCP-compatible client (Claude Code, Claude Desktop, VS Code, Cursor, Windsurf) can drive a real browser with no screenshots or vision models — just accessibility snapshots.
Claude Code (project-level)
A .mcp.json file is included at the project root. Claude Code picks it up automatically when you open this directory:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}Or install it manually via the CLI:
claude mcp add playwright npx @playwright/mcp@latestClaude Desktop
Add the following to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}VS Code
One-liner via the VS Code CLI:
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'Or use the included .vscode/mcp.json — VS Code with the Copilot extension picks it up automatically:
{
"servers": {
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}Cursor / Windsurf
Add the same block under mcpServers in their respective settings files.
Configuration options
Append flags to the args array to customise the server:
Flag | Effect |
| Run browser without a visible window (default: headed) |
| Browser to use: |
| Keep browser profile in memory; do not persist to disk |
| Expose the server over HTTP/SSE instead of stdio |
| Host to bind to (default: |
| Use screenshots instead of accessibility snapshots (requires vision model) |
| Comma-separated capability subset: |
| Emulate a device, e.g. |
| Set viewport, e.g. |
| Override the browser user-agent string |
| Load saved auth state (cookies/localStorage) from a JSON file |
| Save a Playwright Trace of the session to |
| Directory for screenshots, PDFs, and traces |
| Route traffic through a proxy, e.g. |
| Disable the browser sandbox (useful in some CI environments) |
| Connect to an existing browser tab instead of launching a new browser |
| Load advanced settings from a JSON config file |
Example — headless Firefox in isolated mode:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--headless", "--browser=firefox", "--isolated"]
}
}
}Standalone server (HTTP transport)
For headless/CI environments where stdio is not suitable:
npx @playwright/mcp@latest --port 8931Then point your MCP client at http://localhost:8931/mcp using the url form:
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/mcp"
}
}
}Available MCP tools
Navigation
Tool | Description |
| Navigate to a URL |
| Browser history navigation |
| Reload the current page |
Interaction
Tool | Description |
| Click an element by ARIA ref |
| Check or uncheck a checkbox |
| Type text into a focused field |
| Type text one character at a time (for masked fields) |
| Fill multiple form fields by their labels in one call |
| Select a dropdown value |
| Hover over an element |
| Drag-and-drop between elements |
| Keyboard key events |
| Accept or dismiss browser dialogs |
| Upload a file to a file input |
| Pixel-precise mouse control |
| Low-level mouse events |
Inspection & Assertions
Tool | Description |
| Get the page accessibility tree — primary way to read elements and obtain ARIA refs |
| Capture the current page as an image |
| Capture a screenshot with annotated highlights |
| Visually highlight an element on the page |
| Generate a Playwright locator for a given element |
| Assert an element is visible |
| Assert specific text is visible on the page |
| Assert a list of items is visible |
| Assert an element's value |
| Wait for an element or network condition |
Storage
Tool | Description |
| Evaluate a JavaScript expression on the page |
| Read/write localStorage |
| Remove localStorage items |
| sessionStorage CRUD |
| Remove sessionStorage items |
| Read/write cookies |
| Remove cookies |
| Export current cookies and storage to a file |
| Import previously saved storage state |
Network
Tool | Description |
| List all captured network requests |
| Get details for a single network request |
| Clear the captured request log |
| Simulate online/offline/throttled network conditions |
| Mock requests matching a URL pattern with a custom response |
| List active route mocks |
| Remove a route mock |
Tabs
Tool | Description |
| List, create ( |
Console
Tool | Description |
| Get browser console output |
| Clear the console message log |
Recording & Tracing
Tool | Description |
| Record a Playwright Trace |
| Record session video |
| Save the current page as a PDF |
Misc
Tool | Description |
| Resize the browser window |
| Get the current server configuration |
| Execute an arbitrary Playwright script (RCE-equivalent; trusted clients only) |
| Close the browser |
How accessibility snapshots work: Instead of returning a screenshot,
browser_snapshotreturns a structured text tree of all visible elements with their roles, labels, and unique[ref=…]identifiers. LLMs reference these ids when callingbrowser_clickorbrowser_type— no vision model required.
Verify the server is working
# Start the demo app first
npm run dev
# Then run the MCP demo (connects via stdio and runs 10 browser scenarios)
npm run demoMCP Demo (demo/)
demo/run-demo.ts connects to @playwright/mcp via real MCP stdio protocol using @modelcontextprotocol/sdk. It runs 10 browser scenarios with no external API dependencies.
npm run demo╔══════════════════════════════════════════════════════════╗
║ Playwright MCP Server — Direct MCP Protocol Demo ║
╚══════════════════════════════════════════════════════════╝
Target: http://localhost:3000
Transport: stdio (@playwright/mcp subprocess)
Connecting to @playwright/mcp server…
Connected.
Available MCP tools (14):
• browser_navigate
• browser_snapshot
• browser_click
…
S01 ✓ PASS Login page loads via MCP browser_navigate
S02 ✓ PASS Fill login form using browser_type
S03 ✓ PASS Capture login page screenshot
…Test Coverage
Area | Tests | TC Range |
Authentication | 25 | TC001–TC025 |
Navigation | 20 | TC026–TC045 |
Dashboard | 12 | TC046–TC057 |
Task Management | 45 | TC058–TC102 |
Categories | 14 | TC103–TC116 |
Profile | 17 | TC117–TC133 |
Settings | 17 | TC134–TC150 |
UI Components | 16 | TC151–TC166 |
Total | 166 |
Project Structure
.
├── demo-app/
│ ├── server.js Express static file server (port 3000)
│ └── public/
│ ├── index.html Entry point (redirect)
│ ├── login.html
│ ├── register.html
│ ├── dashboard.html
│ ├── tasks.html Tasks + Categories
│ ├── profile.html
│ ├── settings.html
│ ├── 404.html
│ ├── css/styles.css
│ └── js/utils.js Shared helpers + seed data
├── tests/
│ ├── fixtures/
│ │ └── browser-commands.ts Reusable MCP-style command fixture
│ ├── helpers/
│ │ └── auth.helper.ts Fast localStorage-based auth setup
│ ├── auth.spec.ts TC001–TC025
│ ├── navigation.spec.ts TC026–TC045
│ ├── dashboard.spec.ts TC046–TC057
│ ├── tasks.spec.ts TC058–TC102
│ ├── categories.spec.ts TC103–TC116
│ ├── profile.spec.ts TC117–TC133
│ ├── settings.spec.ts TC134–TC150
│ └── ui-components.spec.ts TC151–TC166
├── demo/
│ ├── scenarios.ts 10 MCP test scenario definitions
│ └── run-demo.ts MCP client demo (real MCP protocol)
├── playwright-report/ Generated HTML report (after npm test)
├── playwright.config.ts
├── package.json
└── tsconfig.jsonKey Design Decisions
Decision | Rationale |
| Tests don't break when CSS or text changes |
Reusable | Command names match |
| Sets session via |
Sequential workers ( | Prevents |
| Handles transient timing issues without masking real failures |
No external API dependencies | MCP demo uses |
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.
Latest Blog Posts
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/muhammadraheel-vd/Playwright_mcp_server_poc_with_plus_100_tc'
If you have feedback or need assistance with the MCP directory API, please join our Discord server