Connected Playwright Mcp
Battle-tested mcp for model, context, protocol, server. Includes structured workflows, validation checks, and reusable patterns for browser_automation.
Connected Playwright Mcp
Official Playwright MCP server that enables browser automation through structured accessibility snapshots, eliminating the need for screenshots or vision models.
When to Use This MCP Server
Connect this server when you need to:
- Automate browser interactions using accessibility tree snapshots instead of expensive vision model calls
- Build reliable browser automation that works with screen readers and follows accessibility-first principles
- Integrate the official Microsoft Playwright MCP package for production-grade browser automation in Claude Code
Consider alternatives when:
- Your target pages have poor accessibility markup and require visual element identification instead
- You need cloud-hosted browser infrastructure rather than local browser management
Quick Start
Configuration
name: connected-playwright-mcp type: mcp category: browser_automation
Example Connection
claude mcp add connected-playwright-mcp -- npx @playwright/mcp@latest
Available Tools
browser_navigate: Navigate to a URL and return the accessibility snapshot
browser_click: Click an element identified by accessibility reference
browser_type: Type text into a focused or specified input element
browser_snapshot: Capture the current page accessibility tree structure
browser_screenshot: Take a visual screenshot of the current viewport
browser_evaluate: Execute JavaScript and return the result
Core Concepts
Accessibility-First Automation Overview
| Aspect | Details |
|---|---|
| Protocol | MCP over stdio transport |
| Element Targeting | Accessibility tree references instead of CSS selectors |
| Vision Independence | No screenshot-based models needed for interaction |
| Official Package | Maintained by the Playwright team at Microsoft |
| Browser Support | Chromium, Firefox, and WebKit via Playwright |
| Page Representation | Structured accessibility snapshots as tool responses |
Accessibility Snapshot Architecture
βββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββ
β Claude Code ββββββΆβ Playwright MCP ββββββΆβ Browser β
β (Client) βββββββ (@playwright/) βββββββ Engine β
βββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββ
β
ββββββββ΄βββββββ
β Accessibilityβ
β Tree API β
βββββββββββββββ
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
browser | string | chromium | Browser engine to launch: chromium, firefox, or webkit |
headless | boolean | true | Run without a visible browser window |
viewport | string | 1280x720 | Browser viewport dimensions as widthxheight |
device | string | none | Emulate a specific device profile for mobile testing |
timeout | integer | 30000 | Default timeout in milliseconds for navigation and actions |
Best Practices
-
Rely on Accessibility Snapshots - The primary advantage of this server is its accessibility-first approach. Use
browser_snapshotto understand page structure rather than taking screenshots, which saves tokens and avoids vision model costs. -
Target Elements by Accessible Name - Reference elements using their accessible names from the snapshot tree. This produces more resilient automation than fragile CSS selectors or XPath expressions that break on minor UI changes.
-
Combine with Visual Screenshots Selectively - While accessibility snapshots handle most interactions, take visual screenshots only when you need to verify layout or styling. This hybrid approach balances efficiency with completeness.
-
Use Device Emulation for Responsive Testing - Leverage the
deviceparameter to emulate phones and tablets. The accessibility tree changes with responsive layouts, so test across viewports to catch mobile-specific issues. -
Keep the Browser Focused - Accessibility snapshots capture the entire page tree, which can be large. Navigate to specific sections or close unnecessary tabs to reduce snapshot size and improve response times.
Common Issues
-
Large Accessibility Trees - Complex pages produce massive accessibility snapshots that may exceed token limits. Use targeted navigation to specific page sections or filter the snapshot output to relevant subtrees.
-
Dynamic Content Missing from Snapshot - Content loaded asynchronously may not appear in the initial snapshot. Wait for network idle or use
browser_evaluateto check loading state before capturing the snapshot. -
Accessibility Attributes Not Present - Some poorly-built websites lack proper ARIA labels and semantic HTML. In these cases, fall back to
browser_screenshotwith visual inspection or usebrowser_evaluateto query the DOM directly.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Database MCP Integration
MCP server configuration for connecting Claude Code to PostgreSQL, MySQL, and MongoDB databases. Enables schema inspection, query building, and migration generation.
Elevenlabs Server
Streamline your workflow with this official, elevenlabs, text, speech. Includes structured workflows, validation checks, and reusable patterns for audio.
Browser Use Portal
Powerful mcp for server, enables, agents, control. Includes structured workflows, validation checks, and reusable patterns for browser_automation.