# Playwright MCP 服务器 — 确定性浏览器可访问性快照 (`playwright-mcp`)

> 官方 Microsoft Playwright MCP 服务器通过结构化 ARIA 可访问性树而不是脆弱的像素屏幕截图来驱动无头或有头 Chromium/Firefox/WebKit。

- **Canonical URL:** https://syndipath.com/zh/mcp/playwright-mcp
- **Runtime:** `npm` | **Transport:** STDIO | **License:** Apache-2.0 | **Package:** `@playwright/mcp`
- **Upvotes:** 1284 | **GitHub Stars:** 15420 | **Weekly Installs:** 128500
- **Security Note:** HTTP-200 在 NPM 注册中心（@playwright/mcp）上验证；通过 npx 在工作区范围的 STDIO 会话中运行。

## Quick CLI Setup
```bash
# Run directly via Node npx
npx -y @playwright/mcp

# Add to Claude Code CLI
claude mcp add playwright-mcp -- npx -y @playwright/mcp
```

## MCP Manifest (`mcp.json`)
```json
{
  "mcpServers": {
    "playwright-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@playwright/mcp"
      ]
    }
  }
}
```

## Exposed MCP Tools
- `playwright_mcp_extract(url_or_query: string, max_chars?: number)`: Official Microsoft Playwright MCP server driving headless or headed Chromium/Firefox/WebKit via structured ARIA accessibility trees ins.
- `playwright_mcp_metadata(target: string)`: Returns structured page headings, canonical links, and HTTP response diagnostics.
