playwright-repl 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,30 @@
1
- # Releases
1
+ # Changelog
2
+
3
+ ## v0.2.0 — MCP Server
4
+
5
+ **2026-02-16**
6
+
7
+ ### Features
8
+
9
+ - **MCP Server**: Ships a stdio MCP server (`playwright-mcp-server`) that exposes Playwright's full browser automation toolkit to AI agents (Claude, Cursor, etc.)
10
+ - Supports `--headed` flag for visible browser mode
11
+
12
+ ### Configuration
13
+
14
+ VS Code / Cursor — add to `.vscode/mcp.json`:
15
+
16
+ ```json
17
+ {
18
+ "servers": {
19
+ "playwright": {
20
+ "command": "npx",
21
+ "args": ["-p", "playwright-repl", "playwright-mcp-server", "--headed"]
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ ---
2
28
 
3
29
  ## v0.1.1 — Bug Fixes
4
30
 
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # playwright-repl
2
2
 
3
+ ![playwright-repl](cover-image.png)
4
+
3
5
  Interactive REPL for Playwright browser automation — keyword-driven testing from your terminal.
4
6
 
5
7
  Inspired by [playwright-cli](https://github.com/anthropics/playwright-cli), reusing its command vocabulary and Playwright MCP daemon. Where playwright-cli is designed for AI agents (one command per process), playwright-repl is designed for **humans** — a persistent session with recording, replay, and instant feedback.
@@ -128,6 +130,52 @@ playwright-repl --session checkout-flow --headed
128
130
  | `-q, --silent` | Suppress banner and status messages |
129
131
  | `-h, --help` | Show help |
130
132
 
133
+ ## MCP Server
134
+
135
+ `playwright-repl` also ships an MCP server that exposes Playwright's full browser automation toolkit to AI agents (Claude, Cursor, etc.) over stdio.
136
+
137
+ ```bash
138
+ # Run directly
139
+ npx -p playwright-repl playwright-mcp-server
140
+
141
+ # With visible browser
142
+ npx -p playwright-repl playwright-mcp-server --headed
143
+ ```
144
+
145
+ ### VS Code / Cursor Configuration
146
+
147
+ Add to `.vscode/mcp.json` in your project:
148
+
149
+ ```json
150
+ {
151
+ "servers": {
152
+ "playwright": {
153
+ "command": "npx",
154
+ "args": ["-p", "playwright-repl", "playwright-mcp-server"]
155
+ }
156
+ }
157
+ }
158
+ ```
159
+
160
+ Or with a visible browser:
161
+
162
+ ```json
163
+ {
164
+ "servers": {
165
+ "playwright": {
166
+ "command": "npx",
167
+ "args": ["-p", "playwright-repl", "playwright-mcp-server", "--headed"]
168
+ }
169
+ }
170
+ }
171
+ ```
172
+
173
+ ### MCP Server Options
174
+
175
+ | Option | Description |
176
+ |--------|-------------|
177
+ | `--headed` | Run browser in headed (visible) mode |
178
+
131
179
  ## Commands
132
180
 
133
181
  ### Navigation
@@ -336,13 +384,7 @@ playwright-repl --replay examples/05-ci-pipe.pw --silent
336
384
 
337
385
  ## Architecture
338
386
 
339
- ```
340
- ┌──────────────┐ Unix Socket ┌──────────────────┐ CDP ┌─────────┐
341
- │ playwright- │◄──── JSON/newline ───►│ Daemon Process │◄────────────►│ Browser │
342
- │ repl │ │ (Playwright │ │(Chrome/ │
343
- │ │ │ MCP backend) │ │ FF/WK) │
344
- └──────────────┘ └──────────────────┘ └─────────┘
345
- ```
387
+ ![Architecture](architecture-diagram.png)
346
388
 
347
389
  The REPL replaces only the **client half** of playwright-cli. The daemon, browser, and all tool handlers are unchanged — both CLI and REPL produce identical wire messages.
348
390
 
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Thin MCP server entrypoint — uses Playwright's built-in MCP infrastructure.
5
+ * Starts a stdio MCP server with all browser tools available.
6
+ *
7
+ * Uses only publicly exported paths:
8
+ * - playwright/lib/mcp/index → createConnection()
9
+ * - playwright-core/lib/mcpBundle → StdioServerTransport
10
+ */
11
+
12
+ const { createConnection } = require('playwright/lib/mcp/index');
13
+ const { StdioServerTransport } = require('playwright-core/lib/mcpBundle');
14
+
15
+ // ─── Parse CLI args ───
16
+
17
+ const args = process.argv.slice(2);
18
+ const headed = args.includes('--headed');
19
+
20
+ (async () => {
21
+ const server = await createConnection({
22
+ browser: {
23
+ launchOptions: { headless: !headed },
24
+ },
25
+ });
26
+
27
+ const transport = new StdioServerTransport();
28
+ await server.connect(transport);
29
+ })().catch(e => {
30
+ console.error(e.message);
31
+ process.exit(1);
32
+ });
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "playwright-repl",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Interactive REPL for Playwright browser automation — keyword-driven testing from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
7
- "playwright-repl": "./bin/playwright-repl.mjs"
7
+ "playwright-repl": "./bin/playwright-repl.mjs",
8
+ "playwright-mcp-server": "./bin/mcp-server.cjs"
8
9
  },
9
10
  "main": "./src/index.mjs",
10
11
  "exports": {
@@ -36,7 +37,7 @@
36
37
  "examples/",
37
38
  "LICENSE",
38
39
  "README.md",
39
- "RELEASES.md"
40
+ "CHANGELOG.md"
40
41
  ],
41
42
  "engines": {
42
43
  "node": ">=18.0.0"