# microsoft/playwright-mcp architecture

> Architecture diagram of the GitHub repository microsoft/playwright-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/playwright-mcp
- Repository: https://github.com/microsoft/playwright-mcp

## Overview

Playwright MCP exposes browser automation to MCP clients through a server/CLI interface, returning structured accessibility snapshots and tool results. The README identifies major capability areas, while the sampled implementation mainly shows the CLI and library entry point delegating to Playwright’s bundled tools. The src tree is present but its contents were not supplied, so capability internals are represented at the directory level and their internal wiring is omitted.

Main entry points: [`cli.js`](https://github.com/microsoft/playwright-mcp/blob/main/cli.js) (MCP CLI), [`index.js`](https://github.com/microsoft/playwright-mcp/blob/main/index.js) (Connection API), [`src`](https://github.com/microsoft/playwright-mcp/tree/main/src) (Navigation and tabs), [`config.d.ts`](https://github.com/microsoft/playwright-mcp/blob/main/config.d.ts) (Server configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Client entry points"]
  node_cli["MCP CLI<br/>[cli.js]"]
  node_api["Connection API<br/>[index.js]"]
end

subgraph group_runtime["Browser automation"]
  node_playwright_tools["Playwright tools"]
  node_browser(("Web browser"))
end

subgraph group_capabilities["Tool capabilities"]
  node_navigation["Navigation and tabs"]
  node_input["Page interaction"]
  node_snapshots["Accessibility snapshots"]
  node_network["Network controls"]
  node_storage["Storage tools"]
  node_devtools["DevTools"]
  node_vision["Coordinate interaction"]
  node_pdf["PDF tools"]
  node_testing["Test assertions"]
  node_configuration["Server configuration<br/>[config.d.ts]"]
end

node_client(("MCP client"))

node_client -->|"connects through"| node_cli
node_cli -->|"registers MCP command"| node_playwright_tools
node_client -->|"uses connection API"| node_api
node_api -->|"exports connection factory"| node_playwright_tools
node_playwright_tools -->|"automates"| node_browser
node_playwright_tools -->|"provides"| node_navigation
node_playwright_tools -->|"provides"| node_input
node_playwright_tools -->|"returns snapshots"| node_snapshots
node_playwright_tools -->|"provides"| node_network
node_playwright_tools -->|"provides"| node_storage
node_playwright_tools -->|"provides"| node_devtools
node_playwright_tools -->|"provides"| node_vision
node_playwright_tools -->|"provides"| node_pdf
node_playwright_tools -->|"provides"| node_testing
node_playwright_tools -->|"accepts options"| node_configuration

click node_cli "https://github.com/microsoft/playwright-mcp/blob/main/cli.js"
click node_api "https://github.com/microsoft/playwright-mcp/blob/main/index.js"
click node_navigation "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_input "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_snapshots "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_network "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_storage "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_devtools "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_vision "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_pdf "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_testing "https://github.com/microsoft/playwright-mcp/tree/main/src"
click node_configuration "https://github.com/microsoft/playwright-mcp/blob/main/config.d.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_api,node_client toneBlue
class node_playwright_tools,node_browser toneAmber
class node_navigation,node_input,node_snapshots,node_network,node_storage,node_devtools,node_vision,node_pdf,node_testing,node_configuration toneMint
```

## Components

### Client entry points

- [MCP CLI](https://github.com/microsoft/playwright-mcp/blob/main/cli.js): `cli.js`
- [Connection API](https://github.com/microsoft/playwright-mcp/blob/main/index.js): `index.js`

### Browser automation

- **Playwright tools**
- **Web browser**

### Tool capabilities

- [Navigation and tabs](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [Page interaction](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [Accessibility snapshots](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [Network controls](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [Storage tools](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [DevTools](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [Coordinate interaction](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [PDF tools](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [Test assertions](https://github.com/microsoft/playwright-mcp/tree/main/src): `src`
- [Server configuration](https://github.com/microsoft/playwright-mcp/blob/main/config.d.ts): `config.d.ts`

### Other components

- **MCP client**

## Connections

- MCP client → MCP CLI: connects through (evidence: `README.md`)
- MCP CLI → Playwright tools: registers MCP command (evidence: `cli.js`)
- MCP client → Connection API: uses connection API
- Connection API → Playwright tools: exports connection factory (evidence: `index.js`)
- Playwright tools → Web browser: automates (evidence: `README.md`)
- Playwright tools → Navigation and tabs: provides (evidence: `README.md`)
- Playwright tools → Page interaction: provides (evidence: `README.md`)
- Playwright tools → Accessibility snapshots: returns snapshots (evidence: `README.md`)
- Playwright tools → Network controls: provides
- Playwright tools → Storage tools: provides
- Playwright tools → DevTools: provides
- Playwright tools → Coordinate interaction: provides
- Playwright tools → PDF tools: provides
- Playwright tools → Test assertions: provides
- Playwright tools → Server configuration: accepts options
