# krishnaharshap/playwright-python-mcp architecture

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

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

## Overview

This is a small Python demonstration client for browser automation through the Playwright MCP server. The main workflow runs from the manual entry point through the smoke-flow adapter, which connects over stdio, navigates to the configured demo URL, and evaluates the page title. A separate direct Playwright helper offers a non-MCP browser path. The graph includes README-documented server/browser behavior; unsampled integration details are not inferred.

Main entry points: [`playwright_mcp/mcp_adapter.py`](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/mcp_adapter.py) (Smoke adapter), [`playwright_mcp/mcp_client.py`](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/mcp_client.py) (MCP client), [`playwright_mcp/config.py`](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/config.py) (Smoke config), [`playwright_mcp/browser.py`](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/browser.py) (Direct browser helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flow["MCP smoke flow"]
  node_runner["Manual runner<br/>[main.py]"]
  node_adapter["Smoke adapter<br/>[mcp_adapter.py]"]
  node_client["MCP client<br/>[mcp_client.py]"]
end

subgraph group_browser["Browser access"]
  node_server["Playwright MCP"]
  node_automation["Browser automation"]
  node_direct_helper["Direct browser helper<br/>[browser.py]"]
  node_playwright["Playwright runtime"]
end

subgraph group_settings["Configuration"]
  node_config["Smoke config<br/>[config.py]"]
end

node_operator(("User / operator"))
node_demo["TodoMVC demo"]

node_operator -->|"runs"| node_runner
node_runner -->|"invokes"| node_adapter
node_adapter -->|"creates"| node_client
node_adapter -->|"defaults to"| node_config
node_client -->|"uses default"| node_config
node_client -->|"connects via stdio"| node_server
node_server -->|"drives"| node_automation
node_automation -->|"navigates to"| node_demo
node_direct_helper -->|"defaults to"| node_config
node_direct_helper -->|"launches browser"| node_playwright

click node_runner "https://github.com/krishnaharshap/playwright-python-mcp/blob/main/main.py"
click node_adapter "https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/mcp_adapter.py"
click node_client "https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/mcp_client.py"
click node_direct_helper "https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/browser.py"
click node_config "https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/config.py"

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_runner,node_adapter,node_client,node_operator toneBlue
class node_server,node_automation,node_direct_helper,node_playwright toneAmber
class node_config toneMint
class node_demo toneIndigo
```

## Components

### MCP smoke flow

- [Manual runner](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/main.py): `main.py`
- [Smoke adapter](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/mcp_adapter.py): `playwright_mcp/mcp_adapter.py`
- [MCP client](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/mcp_client.py): `playwright_mcp/mcp_client.py`

### Browser access

- **Playwright MCP**
- **Browser automation**
- [Direct browser helper](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/browser.py): `playwright_mcp/browser.py`
- **Playwright runtime**

### Configuration

- [Smoke config](https://github.com/krishnaharshap/playwright-python-mcp/blob/main/playwright_mcp/config.py): `playwright_mcp/config.py`

### Other components

- **User / operator**
- **TodoMVC demo**

## Connections

- User / operator → Manual runner: runs (evidence: `README.md`)
- Manual runner → Smoke adapter: invokes (evidence: `main.py`)
- Smoke adapter → MCP client: creates (evidence: `playwright_mcp/mcp_adapter.py`)
- Smoke adapter → Smoke config: defaults to (evidence: `playwright_mcp/mcp_adapter.py`)
- MCP client → Smoke config: uses default (evidence: `playwright_mcp/mcp_client.py`)
- MCP client → Playwright MCP: connects via stdio (evidence: `playwright_mcp/mcp_client.py`)
- Playwright MCP → Browser automation: drives (evidence: `README.md`)
- Browser automation → TodoMVC demo: navigates to (evidence: `README.md`)
- Direct browser helper → Smoke config: defaults to (evidence: `playwright_mcp/browser.py`)
- Direct browser helper → Playwright runtime: launches browser (evidence: `playwright_mcp/browser.py`)
