browser-devtools-mcp 0.2.2 → 0.2.4
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.
- package/README.md +206 -29
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/runner.js +158 -0
- package/dist/core-B3VLZZCP.js +1 -0
- package/dist/core-IV5QBQ2N.js +13 -0
- package/dist/core-NLBNZBEB.js +1124 -0
- package/dist/daemon-server.js +1 -1
- package/dist/index.js +2 -209
- package/dist/platform/browser/cli/runner.js +2 -0
- package/dist/platform/browser/index.d.ts +2 -0
- package/dist/platform/browser/tools/a11y/index.d.ts +2 -0
- package/dist/platform/browser/tools/content/index.d.ts +2 -0
- package/dist/platform/browser/tools/debug/index.d.ts +2 -0
- package/dist/platform/browser/tools/figma/index.d.ts +2 -0
- package/dist/platform/browser/tools/index.d.ts +5 -0
- package/dist/platform/browser/tools/interaction/index.d.ts +2 -0
- package/dist/platform/browser/tools/navigation/index.d.ts +2 -0
- package/dist/platform/browser/tools/o11y/index.d.ts +2 -0
- package/dist/platform/browser/tools/react/index.d.ts +2 -0
- package/dist/platform/browser/tools/run/index.d.ts +2 -0
- package/dist/platform/browser/tools/stub/index.d.ts +2 -0
- package/dist/platform/browser/tools/sync/index.d.ts +2 -0
- package/dist/platform/index.d.ts +3 -0
- package/dist/platform/node/cli/runner.js +2 -0
- package/dist/platform/node/entry.js +2 -0
- package/dist/platform/node/index.d.ts +11 -0
- package/dist/platform/node/tools/debug/index.d.ts +6 -0
- package/dist/platform/node/tools/index.d.ts +10 -0
- package/dist/platform/node/tools/run/index.d.ts +2 -0
- package/dist/platform/types.d.ts +15 -0
- package/dist/tools/index.d.ts +1 -4
- package/dist/tools/types.d.ts +8 -3
- package/package.json +6 -2
- package/dist/cli.js +0 -179
- package/dist/core.js +0 -764
- package/dist/tools/a11y/index.d.ts +0 -2
- package/dist/tools/content/index.d.ts +0 -2
- package/dist/tools/debug/index.d.ts +0 -2
- package/dist/tools/figma/index.d.ts +0 -2
- package/dist/tools/interaction/index.d.ts +0 -2
- package/dist/tools/navigation/index.d.ts +0 -2
- package/dist/tools/o11y/index.d.ts +0 -2
- package/dist/tools/react/index.d.ts +0 -2
- package/dist/tools/run/index.d.ts +0 -2
- package/dist/tools/stub/index.d.ts +0 -2
- package/dist/tools/sync/index.d.ts +0 -2
- /package/dist/{otel → platform/browser/otel}/otel-initializer.bundle.js +0 -0
- /package/dist/{tools → platform/browser/tools}/figma/compare/index.d.ts +0 -0
- /package/dist/{tools → platform/browser/tools}/figma/compare/types.d.ts +0 -0
- /package/dist/{types.d.ts → platform/browser/types.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -10,14 +10,34 @@
|
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
A powerful <a href="https://modelcontextprotocol.io">Model Context Protocol (MCP)</a> server that provides AI coding assistants with comprehensive
|
|
13
|
+
A powerful <a href="https://modelcontextprotocol.io">Model Context Protocol (MCP)</a> server that provides AI coding assistants with comprehensive automation and debugging capabilities across multiple platforms. This server enables both <strong>execution-level debugging</strong> (logs, network requests) and <strong>visual debugging</strong> (screenshots, accessibility snapshots) to help AI assistants understand and interact with applications effectively.
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
## Overview
|
|
17
17
|
|
|
18
|
-
Browser DevTools MCP
|
|
18
|
+
Browser DevTools MCP is a platform-extensible MCP server designed to give AI agents deep inspection and control over application runtimes. The architecture supports multiple platforms through a unified interface, with each platform providing specialized tools for its environment.
|
|
19
19
|
|
|
20
|
-
###
|
|
20
|
+
### Supported Platforms
|
|
21
|
+
|
|
22
|
+
| Platform | Description | Status |
|
|
23
|
+
|----------|-------------|--------|
|
|
24
|
+
| **Browser** | Playwright-powered browser automation with full DevTools integration | ✅ Available |
|
|
25
|
+
| **Node** | Non-blocking debugging for Node.js backend processes via Inspector Protocol | ✅ Available |
|
|
26
|
+
|
|
27
|
+
The **Browser Platform** exposes a Playwright-powered browser runtime to AI agents, enabling deep, bidirectional debugging and interaction with live web pages. It supports both visual understanding and code-level inspection of browser state, making it ideal for AI-driven exploration, diagnosis, and automation.
|
|
28
|
+
|
|
29
|
+
The **Node Platform** provides non-blocking debugging for Node.js backend processes. It connects to running Node.js processes via the Inspector Protocol (Chrome DevTools Protocol over WebSocket) and offers tracepoints, logpoints, exceptionpoints, watch expressions, and source map support—ideal for debugging APIs, workers, and server-side code.
|
|
30
|
+
|
|
31
|
+
### Platform Selection
|
|
32
|
+
|
|
33
|
+
Choose the platform by running the appropriate MCP server or CLI:
|
|
34
|
+
|
|
35
|
+
| Use Case | MCP Server | CLI |
|
|
36
|
+
|----------|------------|-----|
|
|
37
|
+
| Browser automation & debugging | `browser-devtools-mcp` | `browser-devtools-cli` |
|
|
38
|
+
| Node.js backend debugging | `node-devtools-mcp` | `node-devtools-cli` |
|
|
39
|
+
|
|
40
|
+
### Browser Platform Capabilities
|
|
21
41
|
|
|
22
42
|
- **Visual Inspection**: Screenshots, ARIA snapshots, HTML/text extraction, PDF generation
|
|
23
43
|
- **Design Comparison**: Compare live page UI against Figma designs with similarity scoring
|
|
@@ -29,7 +49,16 @@ Browser DevTools MCP exposes a Playwright-powered browser runtime to AI agents,
|
|
|
29
49
|
- **Session Management**: Long-lived, session-based debugging with automatic cleanup
|
|
30
50
|
- **Multiple Transport Modes**: Supports both stdio and HTTP transports
|
|
31
51
|
|
|
32
|
-
|
|
52
|
+
### Node Platform Capabilities
|
|
53
|
+
|
|
54
|
+
- **Connection**: Connect to Node.js processes by PID, process name, port, WebSocket URL, or Docker container
|
|
55
|
+
- **Non-Blocking Debugging**: Tracepoints, logpoints, exceptionpoints without pausing execution
|
|
56
|
+
- **JavaScript Execution**: Run arbitrary JavaScript in the connected Node process via `run_js-in-node` (CDP Runtime.evaluate)—inspect `process.memoryUsage()`, call `require()` modules, read globals
|
|
57
|
+
- **Source Map Support**: Resolves bundled/minified code to original source locations; `debug_resolve-source-location` translates stack traces and bundle locations to original source
|
|
58
|
+
- **OpenTelemetry Integration**: When the Node process uses `@opentelemetry/api`, tracepoint/logpoint snapshots automatically include `traceContext` (traceId, spanId) for correlating backend traces with browser traces
|
|
59
|
+
- **Docker Support**: Connect to Node.js processes running inside Docker containers (`containerId` / `containerName`)
|
|
60
|
+
|
|
61
|
+
## Browser Platform Features
|
|
33
62
|
|
|
34
63
|
### Content Tools
|
|
35
64
|
- **Screenshots**: Capture full page or specific elements (PNG/JPEG) with image data
|
|
@@ -109,6 +138,7 @@ Non-blocking debugging tools that capture snapshots without pausing execution. I
|
|
|
109
138
|
- `clear-*-snapshots`: Clear captured snapshots
|
|
110
139
|
|
|
111
140
|
**Additional Tools:**
|
|
141
|
+
- **Resolve Source Location**: Resolve a generated/bundle location (URL + line + column) to original source via source maps—useful for translating minified stack traces
|
|
112
142
|
- **Watch Expressions**: Add expressions to evaluate at every tracepoint/exceptionpoint hit
|
|
113
143
|
- **Status**: Get current debugging status (enabled, probe counts, snapshot stats)
|
|
114
144
|
|
|
@@ -117,6 +147,7 @@ Non-blocking debugging tools that capture snapshots without pausing execution. I
|
|
|
117
147
|
- Automatic debugging enablement on first tool use
|
|
118
148
|
- Configurable limits (max snapshots, call stack depth, async segments)
|
|
119
149
|
- Sequence numbers for efficient snapshot polling
|
|
150
|
+
- OpenTelemetry trace context in Node snapshots (traceId, spanId when process uses @opentelemetry/api)
|
|
120
151
|
|
|
121
152
|
## Prerequisites
|
|
122
153
|
|
|
@@ -148,12 +179,29 @@ This installs the CLI skill that enables AI agents to automate browsers for web
|
|
|
148
179
|
|
|
149
180
|
## MCP Client Configuration
|
|
150
181
|
|
|
151
|
-
|
|
182
|
+
To use the **Node platform** (Node.js backend debugging), use `node-devtools-mcp` instead of `browser-devtools-mcp`:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"mcpServers": {
|
|
187
|
+
"node-devtools": {
|
|
188
|
+
"command": "npx",
|
|
189
|
+
"args": ["-y", "-p", "browser-devtools-mcp", "node-devtools-mcp"]
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Alternatively, set `PLATFORM=node` when running `browser-devtools-mcp`.
|
|
196
|
+
|
|
197
|
+
<details>
|
|
198
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
152
199
|
|
|
153
200
|
#### Local Server
|
|
154
201
|
Add the following configuration into the `claude_desktop_config.json` file.
|
|
155
202
|
See the [Claude Desktop MCP docs](https://modelcontextprotocol.io/docs/develop/connect-local-servers) for more info.
|
|
156
203
|
|
|
204
|
+
**Browser platform (default):**
|
|
157
205
|
```json
|
|
158
206
|
{
|
|
159
207
|
"mcpServers": {
|
|
@@ -165,6 +213,18 @@ See the [Claude Desktop MCP docs](https://modelcontextprotocol.io/docs/develop/c
|
|
|
165
213
|
}
|
|
166
214
|
```
|
|
167
215
|
|
|
216
|
+
**Node platform:**
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"mcpServers": {
|
|
220
|
+
"node-devtools": {
|
|
221
|
+
"command": "npx",
|
|
222
|
+
"args": ["-y", "-p", "browser-devtools-mcp", "node-devtools-mcp"]
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
168
228
|
#### Remote Server (HTTP Transport)
|
|
169
229
|
First, start the server with HTTP transport:
|
|
170
230
|
```bash
|
|
@@ -175,7 +235,10 @@ Then, go to `Settings` > `Connectors` > `Add Custom Connector` in Claude Desktop
|
|
|
175
235
|
- Name: `Browser DevTools`
|
|
176
236
|
- Remote MCP server URL: Point to where your server is hosted (e.g., `http://localhost:3000/mcp` if running locally, or `https://your-server.com/mcp` if hosted remotely)
|
|
177
237
|
|
|
178
|
-
|
|
238
|
+
</details>
|
|
239
|
+
|
|
240
|
+
<details>
|
|
241
|
+
<summary><strong>Claude Code</strong></summary>
|
|
179
242
|
|
|
180
243
|
Run the following command.
|
|
181
244
|
See [Claude Code MCP docs](https://docs.anthropic.com/en/docs/claude-code/mcp) for more info.
|
|
@@ -198,7 +261,10 @@ claude mcp add --transport http browser-devtools <SERVER_URL>
|
|
|
198
261
|
|
|
199
262
|
Replace `<SERVER_URL>` with your server URL (e.g., `http://localhost:3000/mcp` if running locally, or `https://your-server.com/mcp` if hosted remotely).
|
|
200
263
|
|
|
201
|
-
|
|
264
|
+
</details>
|
|
265
|
+
|
|
266
|
+
<details>
|
|
267
|
+
<summary><strong>Cursor</strong></summary>
|
|
202
268
|
|
|
203
269
|
Add the following configuration into the `~/.cursor/mcp.json` file (or `.cursor/mcp.json` in your project folder).
|
|
204
270
|
See the [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol) for more info.
|
|
@@ -234,7 +300,10 @@ Then add the configuration:
|
|
|
234
300
|
|
|
235
301
|
Replace `<SERVER_URL>` with your server URL (e.g., `http://localhost:3000/mcp` if running locally, or `https://your-server.com/mcp` if hosted remotely).
|
|
236
302
|
|
|
237
|
-
|
|
303
|
+
</details>
|
|
304
|
+
|
|
305
|
+
<details>
|
|
306
|
+
<summary><strong>VS Code</strong></summary>
|
|
238
307
|
|
|
239
308
|
Add the following configuration into the `.vscode/mcp.json` file.
|
|
240
309
|
See the [VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more info.
|
|
@@ -276,7 +345,10 @@ Then add the configuration:
|
|
|
276
345
|
|
|
277
346
|
Replace `<SERVER_URL>` with your server URL (e.g., `http://localhost:3000/mcp` if running locally, or `https://your-server.com/mcp` if hosted remotely).
|
|
278
347
|
|
|
279
|
-
|
|
348
|
+
</details>
|
|
349
|
+
|
|
350
|
+
<details>
|
|
351
|
+
<summary><strong>Windsurf</strong></summary>
|
|
280
352
|
|
|
281
353
|
Add the following configuration into the `~/.codeium/windsurf/mcp_config.json` file.
|
|
282
354
|
See the [Windsurf MCP docs](https://docs.windsurf.com/windsurf/cascade/mcp) for more info.
|
|
@@ -312,7 +384,10 @@ Then add the configuration:
|
|
|
312
384
|
|
|
313
385
|
Replace `<SERVER_URL>` with your server URL (e.g., `http://localhost:3000/mcp` if running locally, or `https://your-server.com/mcp` if hosted remotely).
|
|
314
386
|
|
|
315
|
-
|
|
387
|
+
</details>
|
|
388
|
+
|
|
389
|
+
<details>
|
|
390
|
+
<summary><strong>Copilot Coding Agent</strong></summary>
|
|
316
391
|
|
|
317
392
|
Add the following configuration to the `mcpServers` section of your Copilot Coding Agent configuration through
|
|
318
393
|
`Repository` > `Settings` > `Copilot` > `Coding agent` > `MCP configuration`.
|
|
@@ -351,7 +426,10 @@ Then add the configuration:
|
|
|
351
426
|
|
|
352
427
|
Replace `<SERVER_URL>` with your server URL (e.g., `http://localhost:3000/mcp` if running locally, or `https://your-server.com/mcp` if hosted remotely).
|
|
353
428
|
|
|
354
|
-
|
|
429
|
+
</details>
|
|
430
|
+
|
|
431
|
+
<details>
|
|
432
|
+
<summary><strong>Gemini CLI</strong></summary>
|
|
355
433
|
|
|
356
434
|
Add the following configuration into the `~/.gemini/settings.json` file.
|
|
357
435
|
See the [Gemini CLI MCP docs](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html) for more info.
|
|
@@ -387,7 +465,10 @@ Then add the configuration:
|
|
|
387
465
|
|
|
388
466
|
Replace `<SERVER_URL>` with your server URL (e.g., `http://localhost:3000/mcp` if running locally, or `https://your-server.com/mcp` if hosted remotely).
|
|
389
467
|
|
|
390
|
-
|
|
468
|
+
</details>
|
|
469
|
+
|
|
470
|
+
<details>
|
|
471
|
+
<summary><strong>Smithery</strong></summary>
|
|
391
472
|
|
|
392
473
|
Run the following command.
|
|
393
474
|
You can find your Smithery API key [here](https://smithery.ai/account/api-keys).
|
|
@@ -397,6 +478,8 @@ See the [Smithery CLI docs](https://smithery.ai/docs/concepts/cli) for more info
|
|
|
397
478
|
npx -y @smithery/cli install serkan-ozal/browser-devtools-mcp --client <SMITHERY-CLIENT-NAME> --key <SMITHERY-API-KEY>
|
|
398
479
|
```
|
|
399
480
|
|
|
481
|
+
</details>
|
|
482
|
+
|
|
400
483
|
## HTTP Transport
|
|
401
484
|
|
|
402
485
|
To use HTTP transport, start the server with:
|
|
@@ -430,9 +513,14 @@ npx -y browser-devtools-mcp --transport=streamable-http --port=3000
|
|
|
430
513
|
npx -y @modelcontextprotocol/inspector http://localhost:3000/mcp --transport http
|
|
431
514
|
```
|
|
432
515
|
|
|
433
|
-
## CLI
|
|
516
|
+
## CLI Tools
|
|
517
|
+
|
|
518
|
+
Browser DevTools MCP includes standalone CLI tools for both platforms:
|
|
519
|
+
|
|
520
|
+
- **`browser-devtools-cli`**: Browser platform—navigation, screenshots, interaction, a11y, debugging, etc.
|
|
521
|
+
- **`node-devtools-cli`**: Node platform—connect to Node.js processes, tracepoints, logpoints, exceptionpoints
|
|
434
522
|
|
|
435
|
-
|
|
523
|
+
This is particularly useful for:
|
|
436
524
|
|
|
437
525
|
- **Scripting and automation**: Use in shell scripts, CI/CD pipelines, or automated workflows
|
|
438
526
|
- **Session-based testing**: Maintain browser state across multiple commands with session IDs
|
|
@@ -440,15 +528,17 @@ Browser DevTools MCP includes a standalone CLI tool (`browser-devtools-cli`) for
|
|
|
440
528
|
|
|
441
529
|
### Installation
|
|
442
530
|
|
|
443
|
-
The
|
|
531
|
+
The CLIs are included with the npm package:
|
|
444
532
|
|
|
445
533
|
```bash
|
|
446
534
|
# Run directly with npx
|
|
447
|
-
npx -y browser-devtools-
|
|
535
|
+
npx -y browser-devtools-cli --help
|
|
536
|
+
npx -y node-devtools-cli --help
|
|
448
537
|
|
|
449
538
|
# Or install globally
|
|
450
539
|
npm install -g browser-devtools-mcp
|
|
451
540
|
browser-devtools-cli --help
|
|
541
|
+
node-devtools-cli --help
|
|
452
542
|
```
|
|
453
543
|
|
|
454
544
|
### Global Options
|
|
@@ -474,9 +564,34 @@ browser-devtools-cli --help
|
|
|
474
564
|
|
|
475
565
|
**Note:** Browser options are applied when the daemon server starts. If the daemon is already running, stop it first (`daemon stop`) then start with new options.
|
|
476
566
|
|
|
477
|
-
### Commands
|
|
567
|
+
### Node CLI Commands
|
|
568
|
+
|
|
569
|
+
`node-devtools-cli` provides Node.js backend debugging:
|
|
570
|
+
|
|
571
|
+
```
|
|
572
|
+
node-devtools-cli
|
|
573
|
+
├── daemon # Manage the daemon server
|
|
574
|
+
├── session # Manage Node.js debugging sessions
|
|
575
|
+
├── tools # List and inspect available tools
|
|
576
|
+
├── config # Show current configuration
|
|
577
|
+
├── completion # Generate shell completion scripts
|
|
578
|
+
├── interactive (repl) # Start interactive REPL mode
|
|
579
|
+
├── update # Check for updates
|
|
580
|
+
├── run # Script execution commands
|
|
581
|
+
│ └── js-in-node # Run JavaScript in the connected Node process
|
|
582
|
+
└── debug # Debug commands
|
|
583
|
+
├── connect # Connect to Node.js process (pid, processName, port, containerId, etc.)
|
|
584
|
+
├── disconnect # Disconnect from current process
|
|
585
|
+
├── status # Show connection status
|
|
586
|
+
├── put-tracepoint # Set a tracepoint
|
|
587
|
+
├── put-logpoint # Set a logpoint
|
|
588
|
+
├── put-exceptionpoint # Configure exception catching
|
|
589
|
+
└── ... # Watch, snapshots, probes management
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
### Browser CLI Commands
|
|
478
593
|
|
|
479
|
-
|
|
594
|
+
`browser-devtools-cli` organizes tools into domain-based subcommands:
|
|
480
595
|
|
|
481
596
|
```
|
|
482
597
|
browser-devtools-cli
|
|
@@ -997,7 +1112,9 @@ For the full list of available skills and documentation, see the [browser-devtoo
|
|
|
997
1112
|
|
|
998
1113
|
## Configuration
|
|
999
1114
|
|
|
1000
|
-
The server can be configured using environment variables
|
|
1115
|
+
The server can be configured using environment variables. Configuration is divided into server-level settings and platform-specific settings.
|
|
1116
|
+
|
|
1117
|
+
### Server Configuration
|
|
1001
1118
|
|
|
1002
1119
|
| Variable | Description | Default |
|
|
1003
1120
|
|----------|-------------|---------|
|
|
@@ -1005,6 +1122,18 @@ The server can be configured using environment variables:
|
|
|
1005
1122
|
| `SESSION_IDLE_SECONDS` | Idle session timeout (seconds) | `300` |
|
|
1006
1123
|
| `SESSION_IDLE_CHECK_SECONDS` | Interval for checking idle sessions (seconds) | `30` |
|
|
1007
1124
|
| `SESSION_CLOSE_ON_SOCKET_CLOSE` | Close session when socket closes | `false` |
|
|
1125
|
+
|
|
1126
|
+
### Node Platform Configuration
|
|
1127
|
+
|
|
1128
|
+
| Variable | Description | Default |
|
|
1129
|
+
|----------|-------------|---------|
|
|
1130
|
+
| `NODE_CONSOLE_MESSAGES_BUFFER_SIZE` | Maximum console messages to buffer from Node.js process | `1000` |
|
|
1131
|
+
| `PLATFORM` | Platform to use: `browser` or `node` | `browser` |
|
|
1132
|
+
|
|
1133
|
+
### Browser Platform Configuration
|
|
1134
|
+
|
|
1135
|
+
| Variable | Description | Default |
|
|
1136
|
+
|----------|-------------|---------|
|
|
1008
1137
|
| `CONSOLE_MESSAGES_BUFFER_SIZE` | Maximum console messages to buffer | `1000` |
|
|
1009
1138
|
| `HTTP_REQUESTS_BUFFER_SIZE` | Maximum HTTP requests to buffer | `1000` |
|
|
1010
1139
|
| `BROWSER_HEADLESS_ENABLE` | Run browser in headless mode | `true` |
|
|
@@ -1023,7 +1152,7 @@ The server can be configured using environment variables:
|
|
|
1023
1152
|
| `FIGMA_ACCESS_TOKEN` | Figma API access token for design comparison | (none) |
|
|
1024
1153
|
| `FIGMA_API_BASE_URL` | Figma API base URL | `https://api.figma.com/v1` |
|
|
1025
1154
|
|
|
1026
|
-
##
|
|
1155
|
+
## Browser Platform Tools
|
|
1027
1156
|
|
|
1028
1157
|
### Content Tools
|
|
1029
1158
|
|
|
@@ -1321,6 +1450,33 @@ The server can be configured using environment variables:
|
|
|
1321
1450
|
- The timeoutMs parameter limits synchronous execution time, but does not automatically time out awaited Promises
|
|
1322
1451
|
</details>
|
|
1323
1452
|
|
|
1453
|
+
<details>
|
|
1454
|
+
<summary><code>run_js-in-node</code> - Runs custom JavaScript INSIDE the connected Node.js process (Node platform only).</summary>
|
|
1455
|
+
|
|
1456
|
+
**Parameters:**
|
|
1457
|
+
- `script` (string, required): JavaScript code to execute in the Node process
|
|
1458
|
+
- `timeoutMs` (number, optional): Max evaluation time in milliseconds (default: 5000, max: 30000)
|
|
1459
|
+
|
|
1460
|
+
**Returns:**
|
|
1461
|
+
- `result` (any): The result of the evaluation. Can be primitives, arrays, or objects. Must be serializable (JSON-compatible).
|
|
1462
|
+
|
|
1463
|
+
**Notes:**
|
|
1464
|
+
- Requires `debug_connect` first—must be connected to a Node.js process
|
|
1465
|
+
- Executes in the NODE PROCESS CONTEXT (real Node.js environment):
|
|
1466
|
+
- Has access to process, require, global, and all loaded modules
|
|
1467
|
+
- Can read/modify process state
|
|
1468
|
+
- Full Node.js APIs (fs, http, etc.)
|
|
1469
|
+
- Execution blocks the Node event loop until the script completes
|
|
1470
|
+
- Long-running scripts will block the process; use short expressions
|
|
1471
|
+
- Return value must be serializable
|
|
1472
|
+
|
|
1473
|
+
**Typical use cases:**
|
|
1474
|
+
- Inspect process state: `process.memoryUsage()`, `process.uptime()`
|
|
1475
|
+
- Call loaded modules: `require('os').loadavg()`
|
|
1476
|
+
- Read globals or cached data
|
|
1477
|
+
- One-off diagnostic commands
|
|
1478
|
+
</details>
|
|
1479
|
+
|
|
1324
1480
|
### Observability (O11Y) Tools
|
|
1325
1481
|
|
|
1326
1482
|
<details>
|
|
@@ -1693,17 +1849,27 @@ The server can be configured using environment variables:
|
|
|
1693
1849
|
|
|
1694
1850
|
## Architecture
|
|
1695
1851
|
|
|
1852
|
+
### Platform Architecture
|
|
1853
|
+
|
|
1854
|
+
Browser DevTools MCP is built on a platform-extensible architecture that allows for supporting multiple runtime environments through a unified MCP interface. Each platform provides:
|
|
1855
|
+
|
|
1856
|
+
- **Platform-specific tools**: Specialized tools optimized for the target environment
|
|
1857
|
+
- **Unified session management**: Consistent session handling across platforms
|
|
1858
|
+
- **Shared infrastructure**: Common transport, configuration, and plugin systems
|
|
1859
|
+
|
|
1860
|
+
The **Browser Platform** is powered by Playwright for comprehensive browser automation and DevTools integration. The **Node Platform** provides non-blocking debugging for Node.js backend processes via the Chrome DevTools Protocol over WebSocket.
|
|
1861
|
+
|
|
1696
1862
|
### Session Management
|
|
1697
1863
|
|
|
1698
|
-
The server uses session-based architecture where each MCP client connection gets its own browser context and page. Sessions are automatically cleaned up when:
|
|
1864
|
+
The server uses session-based architecture where each MCP client connection gets its own isolated runtime context. For the Browser platform, this means each session gets its own browser context and page. Sessions are automatically cleaned up when:
|
|
1699
1865
|
|
|
1700
1866
|
- The client disconnects
|
|
1701
1867
|
- The session becomes idle (configurable timeout)
|
|
1702
1868
|
- The session is explicitly closed
|
|
1703
1869
|
|
|
1704
|
-
### Browser
|
|
1870
|
+
### Browser Platform Details
|
|
1705
1871
|
|
|
1706
|
-
The
|
|
1872
|
+
The Browser platform supports multiple browser engines:
|
|
1707
1873
|
- **Chromium** (default)
|
|
1708
1874
|
- **Firefox**
|
|
1709
1875
|
- **WebKit**
|
|
@@ -1809,9 +1975,18 @@ npm run build
|
|
|
1809
1975
|
|
|
1810
1976
|
## Use Cases
|
|
1811
1977
|
|
|
1812
|
-
###
|
|
1978
|
+
### Node Platform Use Cases
|
|
1979
|
+
|
|
1980
|
+
The Node platform enables AI assistants to:
|
|
1981
|
+
|
|
1982
|
+
1. **Debug Node.js APIs**: Connect to a running server, set tracepoints at API handlers, capture request/response context
|
|
1983
|
+
2. **Inspect Backend State**: Use watch expressions and tracepoints to understand variable values, call stacks
|
|
1984
|
+
3. **Catch Exceptions**: Enable exception breakpoints to capture uncaught errors with full stack traces
|
|
1985
|
+
4. **Docker Debugging**: Connect to Node.js processes running inside Docker containers
|
|
1986
|
+
|
|
1987
|
+
### Browser Platform Use Cases
|
|
1813
1988
|
|
|
1814
|
-
|
|
1989
|
+
The Browser platform enables AI assistants to:
|
|
1815
1990
|
|
|
1816
1991
|
1. **Debug Web Applications**: Capture screenshots, inspect DOM, check console errors
|
|
1817
1992
|
2. **Monitor Network Activity**: Track API calls, analyze request/response patterns
|
|
@@ -1842,13 +2017,13 @@ Browser DevTools MCP is available as a plugin for various AI coding assistants.
|
|
|
1842
2017
|
|
|
1843
2018
|
### Claude Code
|
|
1844
2019
|
|
|
1845
|
-
A dedicated Claude Code plugin is available with slash commands, skills, and agents for browser automation and testing.
|
|
2020
|
+
A dedicated Claude Code plugin is available with slash commands, skills, and agents for browser automation and testing. The plugin lives in a [separate repository](https://github.com/serkan-ozal/browser-devtools-claude).
|
|
1846
2021
|
|
|
1847
2022
|
#### Installation
|
|
1848
2023
|
|
|
1849
2024
|
```bash
|
|
1850
2025
|
# Add the marketplace
|
|
1851
|
-
/plugin marketplace add https://github.com/serkan-ozal/browser-devtools-
|
|
2026
|
+
/plugin marketplace add https://github.com/serkan-ozal/browser-devtools-claude
|
|
1852
2027
|
|
|
1853
2028
|
# Install the plugin
|
|
1854
2029
|
/plugin install browser-devtools-mcp@browser-devtools
|
|
@@ -1867,9 +2042,10 @@ A dedicated Claude Code plugin is available with slash commands, skills, and age
|
|
|
1867
2042
|
- Design: `/figma`
|
|
1868
2043
|
- Execution: `/run-js`, `/sandbox`
|
|
1869
2044
|
|
|
1870
|
-
**Skills (
|
|
2045
|
+
**Skills (6 skills):**
|
|
1871
2046
|
- `browser-testing` - General browser test capabilities
|
|
1872
2047
|
- `web-debugging` - Console, network, JS debugging
|
|
2048
|
+
- `node-debugging` - Node.js backend debugging (tracepoints, logpoints, run_js-in-node)
|
|
1873
2049
|
- `performance-audit` - Web Vitals and performance analysis
|
|
1874
2050
|
- `visual-testing` - Visual testing and responsive design
|
|
1875
2051
|
- `observability` - Distributed tracing and monitoring
|
|
@@ -1883,7 +2059,7 @@ A dedicated Claude Code plugin is available with slash commands, skills, and age
|
|
|
1883
2059
|
|
|
1884
2060
|
#### Configuration
|
|
1885
2061
|
|
|
1886
|
-
The plugin can be configured via environment variables. See [CONFIG.md](
|
|
2062
|
+
The plugin can be configured via environment variables. See [CONFIG.md](https://github.com/serkan-ozal/browser-devtools-claude/blob/master/CONFIG.md) for all available options.
|
|
1887
2063
|
|
|
1888
2064
|
Example configuration in `~/.claude/settings.json`:
|
|
1889
2065
|
|
|
@@ -1894,6 +2070,7 @@ Example configuration in `~/.claude/settings.json`:
|
|
|
1894
2070
|
"command": "npx",
|
|
1895
2071
|
"args": ["-y", "browser-devtools-mcp@latest"],
|
|
1896
2072
|
"env": {
|
|
2073
|
+
"PLATFORM": "browser",
|
|
1897
2074
|
"BROWSER_HEADLESS_ENABLE": "false"
|
|
1898
2075
|
}
|
|
1899
2076
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './provider';
|