browser-devtools-mcp 0.0.3 → 0.1.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.
- package/README.md +507 -59
- package/dist/browser.js +6 -0
- package/dist/browser.js.map +1 -1
- package/dist/config.js +60 -24
- package/dist/config.js.map +1 -1
- package/dist/context.js +28 -0
- package/dist/context.js.map +1 -1
- package/dist/otel/otel-controller.js +4 -0
- package/dist/otel/otel-controller.js.map +1 -1
- package/dist/server-info.js +133 -18
- package/dist/server-info.js.map +1 -1
- package/dist/tools/content/take-screenshot.js +183 -1
- package/dist/tools/content/take-screenshot.js.map +1 -1
- package/dist/tools/figma/compare/compare-image-embedding.js +159 -0
- package/dist/tools/figma/compare/compare-image-embedding.js.map +1 -0
- package/dist/tools/figma/compare/compare-mssim.js +98 -0
- package/dist/tools/figma/compare/compare-mssim.js.map +1 -0
- package/dist/tools/figma/compare/compare-text-embedding.js +291 -0
- package/dist/tools/figma/compare/compare-text-embedding.js.map +1 -0
- package/dist/tools/figma/compare/index.js +139 -0
- package/dist/tools/figma/compare/index.js.map +1 -0
- package/dist/tools/figma/compare/types.js +3 -0
- package/dist/tools/figma/compare/types.js.map +1 -0
- package/dist/tools/figma/compare/vector.js +46 -0
- package/dist/tools/figma/compare/vector.js.map +1 -0
- package/dist/tools/figma/compare-page-with-design.js +240 -0
- package/dist/tools/figma/compare-page-with-design.js.map +1 -0
- package/dist/tools/figma/figma-service.js +134 -0
- package/dist/tools/figma/figma-service.js.map +1 -0
- package/dist/tools/figma/index.js +6 -0
- package/dist/tools/figma/index.js.map +1 -0
- package/dist/tools/index.js +12 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/interaction/index.js +6 -2
- package/dist/tools/interaction/index.js.map +1 -1
- package/dist/tools/interaction/resize-viewport.js +110 -0
- package/dist/tools/interaction/resize-viewport.js.map +1 -0
- package/dist/tools/interaction/resize-window.js +261 -0
- package/dist/tools/interaction/resize-window.js.map +1 -0
- package/dist/tools/interaction/scroll.js +304 -0
- package/dist/tools/interaction/scroll.js.map +1 -0
- package/dist/tools/{monitoring → o11y}/get-console-messages.js +1 -1
- package/dist/tools/o11y/get-console-messages.js.map +1 -0
- package/dist/tools/{monitoring → o11y}/get-http-requests.js +1 -1
- package/dist/tools/o11y/get-http-requests.js.map +1 -0
- package/dist/tools/{monitoring → o11y}/get-trace-id.js +1 -1
- package/dist/tools/o11y/get-trace-id.js.map +1 -0
- package/dist/tools/o11y/get-web-vitals.js +595 -0
- package/dist/tools/o11y/get-web-vitals.js.map +1 -0
- package/dist/tools/{monitoring → o11y}/index.js +2 -0
- package/dist/tools/o11y/index.js.map +1 -0
- package/dist/tools/{monitoring → o11y}/new-trace-id.js +1 -1
- package/dist/tools/o11y/new-trace-id.js.map +1 -0
- package/dist/tools/{monitoring → o11y}/set-trace-id.js +1 -1
- package/dist/tools/o11y/set-trace-id.js.map +1 -0
- package/dist/tools/react/get-component-for-element.js +941 -0
- package/dist/tools/react/get-component-for-element.js.map +1 -0
- package/dist/tools/react/get-element-for-component.js +1190 -0
- package/dist/tools/react/get-element-for-component.js.map +1 -0
- package/dist/tools/react/index.js +10 -0
- package/dist/tools/react/index.js.map +1 -0
- package/dist/tools/run/index.js +7 -0
- package/dist/tools/run/index.js.map +1 -0
- package/dist/tools/{interaction/evaluate.js → run/js-in-browser.js} +24 -6
- package/dist/tools/run/js-in-browser.js.map +1 -0
- package/dist/tools/run/js-in-sandbox.js +175 -0
- package/dist/tools/run/js-in-sandbox.js.map +1 -0
- package/dist/tools/stub/clear.js +41 -0
- package/dist/tools/stub/clear.js.map +1 -0
- package/dist/tools/stub/index.js +14 -0
- package/dist/tools/stub/index.js.map +1 -0
- package/dist/tools/stub/intercept-http-request.js +112 -0
- package/dist/tools/stub/intercept-http-request.js.map +1 -0
- package/dist/tools/stub/list.js +75 -0
- package/dist/tools/stub/list.js.map +1 -0
- package/dist/tools/stub/mock-http-response.js +152 -0
- package/dist/tools/stub/mock-http-response.js.map +1 -0
- package/dist/tools/stub/stub-controller.js +284 -0
- package/dist/tools/stub/stub-controller.js.map +1 -0
- package/dist/tools/sync/index.js +6 -0
- package/dist/tools/sync/index.js.map +1 -0
- package/dist/tools/sync/wait-for-network-idle.js +152 -0
- package/dist/tools/sync/wait-for-network-idle.js.map +1 -0
- package/package.json +11 -2
- package/dist/tools/interaction/evaluate.js.map +0 -1
- package/dist/tools/monitoring/get-console-messages.js.map +0 -1
- package/dist/tools/monitoring/get-http-requests.js.map +0 -1
- package/dist/tools/monitoring/get-trace-id.js.map +0 -1
- package/dist/tools/monitoring/index.js.map +0 -1
- package/dist/tools/monitoring/new-trace-id.js.map +0 -1
- package/dist/tools/monitoring/set-trace-id.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,11 +13,12 @@ Browser DevTools MCP exposes a Playwright-powered browser runtime to AI agents,
|
|
|
13
13
|
### Key Capabilities
|
|
14
14
|
|
|
15
15
|
- **Visual Inspection**: Screenshots, ARIA snapshots, HTML/text extraction, PDF generation
|
|
16
|
+
- **Design Comparison**: Compare live page UI against Figma designs with similarity scoring
|
|
16
17
|
- **DOM & Code-Level Debugging**: Element inspection, computed styles, accessibility data
|
|
17
18
|
- **Browser Automation**: Navigation, input, clicking, scrolling, viewport control
|
|
18
19
|
- **Execution Monitoring**: Console message capture, HTTP request/response tracking
|
|
19
20
|
- **OpenTelemetry Integration**: Automatic trace injection into web pages, UI trace collection, and backend trace correlation via trace context propagation
|
|
20
|
-
- **JavaScript
|
|
21
|
+
- **JavaScript Execution**: Execute code in browser page context or in Node.js VM sandbox on the server
|
|
21
22
|
- **Session Management**: Long-lived, session-based debugging with automatic cleanup
|
|
22
23
|
- **Multiple Transport Modes**: Supports both stdio and HTTP transports
|
|
23
24
|
|
|
@@ -35,23 +36,53 @@ Browser DevTools MCP exposes a Playwright-powered browser runtime to AI agents,
|
|
|
35
36
|
- **Press Key**: Simulate keyboard input
|
|
36
37
|
- **Select**: Select dropdown options
|
|
37
38
|
- **Drag**: Drag and drop operations
|
|
38
|
-
- **
|
|
39
|
+
- **Scroll**: Scroll the page viewport or specific scrollable elements with multiple modes (by, to, top, bottom, left, right)
|
|
40
|
+
- **Resize Viewport**: Resize the page viewport using Playwright viewport emulation
|
|
41
|
+
- **Resize Window**: Resize the real browser window (OS-level) using Chrome DevTools Protocol
|
|
39
42
|
|
|
40
43
|
### Navigation Tools
|
|
41
44
|
- **Go To**: Navigate to URLs with configurable wait strategies
|
|
42
45
|
- **Go Back**: Navigate backward in history
|
|
43
46
|
- **Go Forward**: Navigate forward in history
|
|
44
47
|
|
|
45
|
-
###
|
|
48
|
+
### Run Tools
|
|
49
|
+
- **JS in Browser**: Execute JavaScript code inside the active browser page (page context with access to window, document, DOM, and Web APIs)
|
|
50
|
+
- **JS in Sandbox**: Execute JavaScript code in a Node.js VM sandbox on the MCP server (with access to Playwright Page, console logging, and safe built-ins)
|
|
51
|
+
|
|
52
|
+
### Observability (O11Y) Tools
|
|
46
53
|
- **Console Messages**: Capture and filter browser console logs with advanced filtering (level, search, timestamp, sequence number)
|
|
47
54
|
- **HTTP Requests**: Monitor network traffic with detailed request/response data, filtering by resource type, status code, and more
|
|
55
|
+
- **Web Vitals**: Collect Core Web Vitals (LCP, INP, CLS) and supporting metrics (TTFB, FCP) with ratings and recommendations based on Google's thresholds
|
|
48
56
|
- **OpenTelemetry Tracing**: Automatic trace injection into web pages, UI trace collection (document load, fetch, XMLHttpRequest, user interactions), and trace context propagation for backend correlation
|
|
49
57
|
- **Trace ID Management**: Get, set, and generate OpenTelemetry compatible trace IDs for distributed tracing across API calls
|
|
50
58
|
|
|
59
|
+
### Synchronization Tools
|
|
60
|
+
- **Wait for Network Idle**: Wait until the page reaches a network-idle condition based on in-flight request count, useful for SPA pages and before taking screenshots
|
|
61
|
+
|
|
51
62
|
### Accessibility (A11Y) Tools
|
|
52
63
|
- **ARIA Snapshots**: Capture semantic structure and accessibility roles in YAML format
|
|
53
64
|
- **AX Tree Snapshots**: Combine Chromium's Accessibility tree with runtime visual diagnostics (bounding boxes, visibility, occlusion detection, computed styles)
|
|
54
65
|
|
|
66
|
+
### Stub Tools
|
|
67
|
+
- **Intercept HTTP Request**: Intercept and modify outgoing HTTP requests (headers, body, method) using glob patterns
|
|
68
|
+
- **Mock HTTP Response**: Mock HTTP responses (fulfill with custom status/headers/body or abort) with configurable delay, times limit, and probability (flaky testing)
|
|
69
|
+
- **List Stubs**: List all currently installed stubs for the active browser context
|
|
70
|
+
- **Clear Stubs**: Remove one or all installed stubs
|
|
71
|
+
|
|
72
|
+
### Figma Tools
|
|
73
|
+
- **Compare Page with Design**: Compare the current page UI against a Figma design snapshot and return a combined similarity score using multiple signals (MSSIM, image embedding, text embedding)
|
|
74
|
+
|
|
75
|
+
### React Tools
|
|
76
|
+
- **Get Component for Element**: Find React component(s) associated with a DOM element using React Fiber (best-effort)
|
|
77
|
+
- **Get Element for Component**: Map a React component instance to the DOM elements it renders by traversing the React Fiber graph
|
|
78
|
+
|
|
79
|
+
**Important Requirements for React Tools:**
|
|
80
|
+
- **Persistent Browser Context**: React tools work best with persistent browser context enabled (`BROWSER_PERSISTENT_ENABLE=true`)
|
|
81
|
+
- **React DevTools Extension**: For optimal reliability, manually install the "React Developer Tools" Chrome extension in the browser profile. The MCP server does NOT automatically install the extension.
|
|
82
|
+
- Chrome Web Store: https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
|
|
83
|
+
- The extension enables reliable root discovery and component search via `__REACT_DEVTOOLS_GLOBAL_HOOK__`
|
|
84
|
+
- Without the extension, tools fall back to scanning DOM for `__reactFiber$` pointers (best-effort, less reliable)
|
|
85
|
+
|
|
55
86
|
## Prerequisites
|
|
56
87
|
|
|
57
88
|
- Node.js 18+
|
|
@@ -367,7 +398,7 @@ The server can be configured using environment variables:
|
|
|
367
398
|
| `CONSOLE_MESSAGES_BUFFER_SIZE` | Maximum console messages to buffer | `1000` |
|
|
368
399
|
| `HTTP_REQUESTS_BUFFER_SIZE` | Maximum HTTP requests to buffer | `1000` |
|
|
369
400
|
| `BROWSER_HEADLESS_ENABLE` | Run browser in headless mode | `true` |
|
|
370
|
-
| `BROWSER_PERSISTENT_ENABLE` | Use persistent browser context (preserves cookies, localStorage, etc.) | `false` |
|
|
401
|
+
| `BROWSER_PERSISTENT_ENABLE` | Use persistent browser context (preserves cookies, localStorage, etc.). **Required for React tools to work optimally.** | `false` |
|
|
371
402
|
| `BROWSER_PERSISTENT_USER_DATA_DIR` | Directory for persistent browser context user data | `./browser-devtools-mcp` |
|
|
372
403
|
| `BROWSER_USE_INSTALLED_ON_SYSTEM` | Use system-installed Chrome browser instead of Playwright's bundled browser | `false` |
|
|
373
404
|
| `BROWSER_EXECUTABLE_PATH` | Custom browser executable path | (uses Playwright default) |
|
|
@@ -379,13 +410,15 @@ The server can be configured using environment variables:
|
|
|
379
410
|
| `OTEL_EXPORTER_HTTP_URL` | OpenTelemetry collector base URL (e.g., "http://localhost:4318") | (none) |
|
|
380
411
|
| `OTEL_EXPORTER_HTTP_HEADERS` | OpenTelemetry exporter HTTP headers (comma-separated key=value pairs) | (none) |
|
|
381
412
|
| `OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS` | User interaction events to instrument (comma-separated, e.g., "click,submit") | `click` |
|
|
413
|
+
| `FIGMA_ACCESS_TOKEN` | Figma API access token for design comparison | (none) |
|
|
414
|
+
| `FIGMA_API_BASE_URL` | Figma API base URL | `https://api.figma.com/v1` |
|
|
382
415
|
|
|
383
416
|
## Available Tools
|
|
384
417
|
|
|
385
418
|
### Content Tools
|
|
386
419
|
|
|
387
|
-
|
|
388
|
-
Takes a screenshot of the current page or a specific element
|
|
420
|
+
<details>
|
|
421
|
+
<summary><code>content_take-screenshot</code> - Takes a screenshot of the current page or a specific element.</summary>
|
|
389
422
|
|
|
390
423
|
**Parameters:**
|
|
391
424
|
- `outputPath` (string, optional): Directory path where screenshot will be saved (default: OS temp directory)
|
|
@@ -393,13 +426,20 @@ Takes a screenshot of the current page or a specific element.
|
|
|
393
426
|
- `selector` (string, optional): CSS selector for element to capture
|
|
394
427
|
- `fullPage` (boolean, optional): Capture full scrollable page (default: false)
|
|
395
428
|
- `type` (enum, optional): Image format - "png" or "jpeg" (default: "png")
|
|
429
|
+
- `quality` (number, optional): The quality of the image, between 0-100. Not applicable to PNG images, only used for JPEG format (default: 100)
|
|
396
430
|
|
|
397
431
|
**Returns:**
|
|
398
432
|
- `filePath` (string): Full path of the saved screenshot file
|
|
399
433
|
- `image` (object): Screenshot image data with mimeType
|
|
400
434
|
|
|
401
|
-
|
|
402
|
-
|
|
435
|
+
**Notes:**
|
|
436
|
+
- The `quality` parameter only applies to JPEG images. PNG images are always saved at full quality
|
|
437
|
+
- Lower quality values (e.g., 50-70) result in smaller file sizes but reduced image quality
|
|
438
|
+
- Quality value of 100 provides maximum quality but larger file sizes
|
|
439
|
+
</details>
|
|
440
|
+
|
|
441
|
+
<details>
|
|
442
|
+
<summary><code>content_get-as-html</code> - Retrieves the HTML content of the current page or a specific element.</summary>
|
|
403
443
|
|
|
404
444
|
**Parameters:**
|
|
405
445
|
- `selector` (string, optional): CSS selector to limit the HTML content to a specific container
|
|
@@ -413,9 +453,10 @@ Retrieves the HTML content of the current page or a specific element.
|
|
|
413
453
|
|
|
414
454
|
**Returns:**
|
|
415
455
|
- `output` (string): The requested HTML content of the page
|
|
456
|
+
</details>
|
|
416
457
|
|
|
417
|
-
|
|
418
|
-
Retrieves the visible text content of the current page or a specific element
|
|
458
|
+
<details>
|
|
459
|
+
<summary><code>content_get-as-text</code> - Retrieves the visible text content of the current page or a specific element.</summary>
|
|
419
460
|
|
|
420
461
|
**Parameters:**
|
|
421
462
|
- `selector` (string, optional): CSS selector to limit the text content to a specific container
|
|
@@ -423,9 +464,10 @@ Retrieves the visible text content of the current page or a specific element.
|
|
|
423
464
|
|
|
424
465
|
**Returns:**
|
|
425
466
|
- `output` (string): The requested text content of the page
|
|
467
|
+
</details>
|
|
426
468
|
|
|
427
|
-
|
|
428
|
-
Saves the current page as a PDF document
|
|
469
|
+
<details>
|
|
470
|
+
<summary><code>content_save-as-pdf</code> - Saves the current page as a PDF document.</summary>
|
|
429
471
|
|
|
430
472
|
**Parameters:**
|
|
431
473
|
- `outputPath` (string, optional): Directory path where PDF will be saved (default: OS temp directory)
|
|
@@ -436,61 +478,135 @@ Saves the current page as a PDF document.
|
|
|
436
478
|
|
|
437
479
|
**Returns:**
|
|
438
480
|
- `filePath` (string): Full path of the saved PDF file
|
|
481
|
+
</details>
|
|
439
482
|
|
|
440
483
|
### Interaction Tools
|
|
441
484
|
|
|
442
|
-
|
|
443
|
-
Clicks an element on the page
|
|
485
|
+
<details>
|
|
486
|
+
<summary><code>interaction_click</code> - Clicks an element on the page.</summary>
|
|
444
487
|
|
|
445
488
|
**Parameters:**
|
|
446
489
|
- `selector` (string, required): CSS selector for the element to click
|
|
490
|
+
</details>
|
|
447
491
|
|
|
448
|
-
|
|
449
|
-
Fills a form input field
|
|
492
|
+
<details>
|
|
493
|
+
<summary><code>interaction_fill</code> - Fills a form input field.</summary>
|
|
450
494
|
|
|
451
495
|
**Parameters:**
|
|
452
496
|
- `selector` (string, required): CSS selector for the input field
|
|
453
497
|
- `value` (string, required): Value to fill
|
|
498
|
+
</details>
|
|
454
499
|
|
|
455
|
-
|
|
456
|
-
Hovers over an element
|
|
500
|
+
<details>
|
|
501
|
+
<summary><code>interaction_hover</code> - Hovers over an element.</summary>
|
|
457
502
|
|
|
458
503
|
**Parameters:**
|
|
459
504
|
- `selector` (string, required): CSS selector for the element to hover
|
|
505
|
+
</details>
|
|
460
506
|
|
|
461
|
-
|
|
462
|
-
Simulates keyboard input
|
|
507
|
+
<details>
|
|
508
|
+
<summary><code>interaction_press-key</code> - Simulates keyboard input.</summary>
|
|
463
509
|
|
|
464
510
|
**Parameters:**
|
|
465
511
|
- `key` (string, required): Key to press (e.g., "Enter", "Escape", "Tab")
|
|
512
|
+
</details>
|
|
466
513
|
|
|
467
|
-
|
|
468
|
-
Selects an option from a dropdown
|
|
514
|
+
<details>
|
|
515
|
+
<summary><code>interaction_select</code> - Selects an option from a dropdown.</summary>
|
|
469
516
|
|
|
470
517
|
**Parameters:**
|
|
471
518
|
- `selector` (string, required): CSS selector for the select element
|
|
472
519
|
- `value` (string, required): Value to select
|
|
520
|
+
</details>
|
|
473
521
|
|
|
474
|
-
|
|
475
|
-
Performs drag and drop operation
|
|
522
|
+
<details>
|
|
523
|
+
<summary><code>interaction_drag</code> - Performs drag and drop operation.</summary>
|
|
476
524
|
|
|
477
525
|
**Parameters:**
|
|
478
526
|
- `sourceSelector` (string, required): CSS selector for the source element
|
|
479
527
|
- `targetSelector` (string, required): CSS selector for the target element
|
|
528
|
+
</details>
|
|
480
529
|
|
|
481
|
-
|
|
482
|
-
|
|
530
|
+
<details>
|
|
531
|
+
<summary><code>interaction_scroll</code> - Scrolls the page viewport or a specific scrollable element.</summary>
|
|
483
532
|
|
|
484
533
|
**Parameters:**
|
|
485
|
-
- `
|
|
534
|
+
- `mode` (enum, optional): Scroll mode - "by" (relative delta), "to" (absolute position), "top", "bottom", "left", "right" (default: "by")
|
|
535
|
+
- `selector` (string, optional): CSS selector for a scrollable container. If omitted, scrolls the document viewport
|
|
536
|
+
- `dx` (number, optional): Horizontal scroll delta in pixels (used when mode="by", default: 0)
|
|
537
|
+
- `dy` (number, optional): Vertical scroll delta in pixels (used when mode="by", default: 0)
|
|
538
|
+
- `x` (number, optional): Absolute horizontal scroll position in pixels (used when mode="to")
|
|
539
|
+
- `y` (number, optional): Absolute vertical scroll position in pixels (used when mode="to")
|
|
540
|
+
- `behavior` (enum, optional): Native scroll behavior - "auto" or "smooth" (default: "auto")
|
|
541
|
+
|
|
542
|
+
**Returns:**
|
|
543
|
+
- `mode` (string): The scroll mode used
|
|
544
|
+
- `selector` (string | null): The selector of the scroll container if provided; otherwise null (document viewport)
|
|
545
|
+
- `behavior` (string): The scroll behavior used
|
|
546
|
+
- `before` (object): Scroll metrics before the scroll action (x, y, scrollWidth, scrollHeight, clientWidth, clientHeight)
|
|
547
|
+
- `after` (object): Scroll metrics after the scroll action (x, y, scrollWidth, scrollHeight, clientWidth, clientHeight)
|
|
548
|
+
- `canScrollX` (boolean): Whether horizontal scrolling is possible
|
|
549
|
+
- `canScrollY` (boolean): Whether vertical scrolling is possible
|
|
550
|
+
- `maxScrollX` (number): Maximum horizontal scrollLeft
|
|
551
|
+
- `maxScrollY` (number): Maximum vertical scrollTop
|
|
552
|
+
- `isAtLeft` (boolean): Whether the scroll position is at the far left
|
|
553
|
+
- `isAtRight` (boolean): Whether the scroll position is at the far right
|
|
554
|
+
- `isAtTop` (boolean): Whether the scroll position is at the very top
|
|
555
|
+
- `isAtBottom` (boolean): Whether the scroll position is at the very bottom
|
|
556
|
+
|
|
557
|
+
**Usage:**
|
|
558
|
+
- Reveal content below the fold
|
|
559
|
+
- Jump to the top/bottom without knowing exact positions
|
|
560
|
+
- Bring elements into view before clicking
|
|
561
|
+
- Inspect lazy-loaded content that appears on scroll
|
|
562
|
+
</details>
|
|
563
|
+
|
|
564
|
+
<details>
|
|
565
|
+
<summary><code>interaction_resize-viewport</code> - Resizes the page viewport using Playwright viewport emulation.</summary>
|
|
566
|
+
|
|
567
|
+
**Parameters:**
|
|
568
|
+
- `width` (number, required): Target viewport width in CSS pixels (minimum: 200)
|
|
569
|
+
- `height` (number, required): Target viewport height in CSS pixels (minimum: 200)
|
|
486
570
|
|
|
487
571
|
**Returns:**
|
|
488
|
-
- `
|
|
572
|
+
- `requested` (object): Requested viewport configuration (width, height)
|
|
573
|
+
- `viewport` (object): Viewport metrics observed inside the page after resizing:
|
|
574
|
+
- `innerWidth`, `innerHeight`: window.innerWidth/innerHeight
|
|
575
|
+
- `outerWidth`, `outerHeight`: window.outerWidth/outerHeight
|
|
576
|
+
- `devicePixelRatio`: window.devicePixelRatio
|
|
577
|
+
|
|
578
|
+
**Notes:**
|
|
579
|
+
- This affects `window.innerWidth/innerHeight`, CSS media queries, layout, rendering, and screenshots
|
|
580
|
+
- This does NOT resize the OS-level browser window
|
|
581
|
+
- Runtime switching to viewport=null (binding to real window size) is not supported by Playwright
|
|
582
|
+
- If you need real window-driven responsive behavior, start the BrowserContext with viewport: null and use the window resize tool instead
|
|
583
|
+
</details>
|
|
584
|
+
|
|
585
|
+
<details>
|
|
586
|
+
<summary><code>interaction_resize-window</code> - Resizes the real browser window (OS-level window) for the current page using Chrome DevTools Protocol (CDP).</summary>
|
|
587
|
+
|
|
588
|
+
**Parameters:**
|
|
589
|
+
- `width` (number, optional): Target window width in pixels (required when state="normal", minimum: 200)
|
|
590
|
+
- `height` (number, optional): Target window height in pixels (required when state="normal", minimum: 200)
|
|
591
|
+
- `state` (enum, optional): Target window state - "normal", "maximized", "minimized", or "fullscreen" (default: "normal")
|
|
592
|
+
|
|
593
|
+
**Returns:**
|
|
594
|
+
- `requested` (object): Requested window change parameters (width, height, state)
|
|
595
|
+
- `before` (object): Window bounds before resizing (windowId, state, left, top, width, height)
|
|
596
|
+
- `after` (object): Window bounds after resizing (windowId, state, left, top, width, height)
|
|
597
|
+
- `viewport` (object): Page viewport metrics after resizing (innerWidth, innerHeight, outerWidth, outerHeight, devicePixelRatio)
|
|
598
|
+
|
|
599
|
+
**Notes:**
|
|
600
|
+
- Works best on Chromium-based browsers (Chromium/Chrome/Edge)
|
|
601
|
+
- Especially useful in headful sessions when running with viewport emulation disabled (viewport: null)
|
|
602
|
+
- If Playwright viewport emulation is enabled (viewport is NOT null), resizing the OS window may not change page layout
|
|
603
|
+
- On non-Chromium browsers (Firefox/WebKit), CDP is not available and this tool will fail
|
|
604
|
+
</details>
|
|
489
605
|
|
|
490
606
|
### Navigation Tools
|
|
491
607
|
|
|
492
|
-
|
|
493
|
-
Navigates to a URL
|
|
608
|
+
<details>
|
|
609
|
+
<summary><code>navigation_go-to</code> - Navigates to a URL.</summary>
|
|
494
610
|
|
|
495
611
|
**Parameters:**
|
|
496
612
|
- `url` (string, required): URL to navigate to (must include scheme)
|
|
@@ -502,17 +618,82 @@ Navigates to a URL.
|
|
|
502
618
|
- `status` (number): HTTP status code
|
|
503
619
|
- `statusText` (string): HTTP status text
|
|
504
620
|
- `ok` (boolean): Whether navigation was successful (2xx status)
|
|
621
|
+
</details>
|
|
505
622
|
|
|
506
|
-
|
|
507
|
-
Navigates backward in browser history
|
|
623
|
+
<details>
|
|
624
|
+
<summary><code>navigation_go-back</code> - Navigates backward in browser history.</summary>
|
|
625
|
+
</details>
|
|
508
626
|
|
|
509
|
-
|
|
510
|
-
Navigates forward in browser history
|
|
627
|
+
<details>
|
|
628
|
+
<summary><code>navigation_go-forward</code> - Navigates forward in browser history.</summary>
|
|
629
|
+
</details>
|
|
511
630
|
|
|
512
|
-
###
|
|
631
|
+
### Run Tools
|
|
513
632
|
|
|
514
|
-
|
|
515
|
-
|
|
633
|
+
<details>
|
|
634
|
+
<summary><code>run_js-in-browser</code> - Runs custom JavaScript INSIDE the active browser page using Playwright's "page.evaluate()".</summary>
|
|
635
|
+
|
|
636
|
+
**Parameters:**
|
|
637
|
+
- `script` (string, required): JavaScript code to execute
|
|
638
|
+
|
|
639
|
+
**Returns:**
|
|
640
|
+
- `result` (any): Result of the evaluation. This value can be of any type, including primitives, arrays, or objects. It represents the direct return value of the JavaScript expression executed in the page context.
|
|
641
|
+
|
|
642
|
+
**Notes:**
|
|
643
|
+
- The code executes in the PAGE CONTEXT (real browser environment):
|
|
644
|
+
- Has access to window, document, DOM, Web APIs
|
|
645
|
+
- Can read/modify the page state
|
|
646
|
+
- Runs with the same permissions as the loaded web page
|
|
647
|
+
- The code runs in an isolated execution context, but within the page
|
|
648
|
+
- No direct access to Node.js APIs
|
|
649
|
+
- Return value must be serializable
|
|
650
|
+
|
|
651
|
+
**Typical use cases:**
|
|
652
|
+
- Inspect or mutate DOM state
|
|
653
|
+
- Read client-side variables or framework internals
|
|
654
|
+
- Trigger browser-side logic
|
|
655
|
+
- Extract computed values directly from the page
|
|
656
|
+
</details>
|
|
657
|
+
|
|
658
|
+
<details>
|
|
659
|
+
<summary><code>run_js-in-sandbox</code> - Runs custom JavaScript inside a Node.js VM sandbox on the MCP server (NOT in the browser).</summary>
|
|
660
|
+
|
|
661
|
+
**Parameters:**
|
|
662
|
+
- `code` (string, required): JavaScript code to run on the MCP server in a VM sandbox. The code is wrapped in an async IIFE, so `await` is allowed. Use `return ...` to return a value
|
|
663
|
+
- `timeoutMs` (number, optional): Max VM CPU time for synchronous execution in milliseconds (default: 5000, max: 30000)
|
|
664
|
+
|
|
665
|
+
**Returns:**
|
|
666
|
+
- `result` (any): Return value of the sandboxed code (best-effort JSON-safe). If user returns undefined but logs exist, returns `{ logs }`. If error occurs, returns `{ error, logs }`
|
|
667
|
+
|
|
668
|
+
**Available bindings:**
|
|
669
|
+
- `page`: Playwright Page (main interaction surface)
|
|
670
|
+
- `console`: captured logs (log/warn/error)
|
|
671
|
+
- `sleep(ms)`: async helper
|
|
672
|
+
|
|
673
|
+
**Safe built-ins:**
|
|
674
|
+
- Math, JSON, Number, String, Boolean, Array, Object, Date, RegExp
|
|
675
|
+
- isFinite, isNaN, parseInt, parseFloat
|
|
676
|
+
- URL, URLSearchParams
|
|
677
|
+
- TextEncoder, TextDecoder
|
|
678
|
+
- structuredClone
|
|
679
|
+
- crypto.randomUUID()
|
|
680
|
+
- AbortController
|
|
681
|
+
- setTimeout / clearTimeout
|
|
682
|
+
|
|
683
|
+
**NOT available:**
|
|
684
|
+
- require, process, fs, Buffer
|
|
685
|
+
- globalThis
|
|
686
|
+
|
|
687
|
+
**Notes:**
|
|
688
|
+
- This runs on the MCP SERVER (not in the browser)
|
|
689
|
+
- This is NOT a security boundary. Intended for trusted automation logic
|
|
690
|
+
- The timeoutMs parameter limits synchronous execution time, but does not automatically time out awaited Promises
|
|
691
|
+
</details>
|
|
692
|
+
|
|
693
|
+
### Observability (O11Y) Tools
|
|
694
|
+
|
|
695
|
+
<details>
|
|
696
|
+
<summary><code>o11y_get-console-messages</code> - Retrieves console messages/logs from the browser with advanced filtering.</summary>
|
|
516
697
|
|
|
517
698
|
**Parameters:**
|
|
518
699
|
- `type` (enum, optional): Filter by message level - "ERROR", "WARNING", "INFO", "DEBUG"
|
|
@@ -525,9 +706,10 @@ Retrieves console messages/logs from the browser with advanced filtering.
|
|
|
525
706
|
|
|
526
707
|
**Returns:**
|
|
527
708
|
- `messages` (array): Array of console messages with type, text, location, timestamp, and sequence number
|
|
709
|
+
</details>
|
|
528
710
|
|
|
529
|
-
|
|
530
|
-
Retrieves HTTP requests from the browser with detailed filtering
|
|
711
|
+
<details>
|
|
712
|
+
<summary><code>o11y_get-http-requests</code> - Retrieves HTTP requests from the browser with detailed filtering.</summary>
|
|
531
713
|
|
|
532
714
|
**Parameters:**
|
|
533
715
|
- `resourceType` (enum, optional): Filter by resource type (e.g., "document", "script", "stylesheet")
|
|
@@ -543,9 +725,60 @@ Retrieves HTTP requests from the browser with detailed filtering.
|
|
|
543
725
|
|
|
544
726
|
**Returns:**
|
|
545
727
|
- `requests` (array): Array of HTTP requests with URL, method, headers, body, response, timing, and metadata
|
|
728
|
+
</details>
|
|
546
729
|
|
|
547
|
-
|
|
548
|
-
|
|
730
|
+
<details>
|
|
731
|
+
<summary><code>o11y-get-web-vitals</code> - Collects Web Vitals-style performance metrics and provides recommendations based on Google's thresholds.</summary>
|
|
732
|
+
|
|
733
|
+
**Parameters:**
|
|
734
|
+
- `waitMs` (number, optional): Optional wait duration in milliseconds before reading metrics (default: 0, max: 30000). Useful to allow LCP/INP/CLS to settle after interactions
|
|
735
|
+
- `includeDebug` (boolean, optional): If true, returns additional debug details such as entry counts and LCP element hint (default: false)
|
|
736
|
+
|
|
737
|
+
**Returns:**
|
|
738
|
+
- `url` (string): Current page URL
|
|
739
|
+
- `title` (string): Current page title
|
|
740
|
+
- `timestampMs` (number): Unix epoch timestamp (ms) when the metrics were captured
|
|
741
|
+
- `metrics` (object): Raw metric values (null if unavailable):
|
|
742
|
+
- `lcpMs` (number | null): Largest Contentful Paint in milliseconds
|
|
743
|
+
- `inpMs` (number | null): Interaction to Next Paint in milliseconds (best-effort approximation)
|
|
744
|
+
- `cls` (number | null): Cumulative Layout Shift score
|
|
745
|
+
- `ttfbMs` (number | null): Time to First Byte in milliseconds
|
|
746
|
+
- `fcpMs` (number | null): First Contentful Paint in milliseconds
|
|
747
|
+
- `ratings` (object): Ratings computed from Google thresholds for each metric:
|
|
748
|
+
- `lcp`, `inp`, `cls`, `ttfb`, `fcp`: Each contains:
|
|
749
|
+
- `rating` (enum): "good", "needs_improvement", "poor", or "not_available"
|
|
750
|
+
- `value` (number | null): Metric value
|
|
751
|
+
- `unit` (enum): "ms" or "score"
|
|
752
|
+
- `thresholds` (object): Thresholds used for rating (good, poor)
|
|
753
|
+
- `recommendations` (object): Recommendations based on measured values:
|
|
754
|
+
- `coreWebVitalsPassed` (boolean): True if all Core Web Vitals are rated "good"
|
|
755
|
+
- `summary` (array): High-level summary and prioritization guidance
|
|
756
|
+
- `lcp`, `inp`, `cls`, `ttfb`, `fcp` (array): Specific recommendations for each metric
|
|
757
|
+
- `general` (array): General measurement and debugging notes
|
|
758
|
+
- `notes` (array): Notes about metric availability, browser limitations, and interpretation
|
|
759
|
+
- `debug` (object, optional): Optional debug details (when includeDebug=true):
|
|
760
|
+
- `waitMs` (number): Actual wait duration used
|
|
761
|
+
- `entries` (object): Counts of PerformanceEntry types used to compute metrics
|
|
762
|
+
- `lastLcpSelectorHint` (string | null): Best-effort selector hint for the last LCP element
|
|
763
|
+
- `lastLcpTagName` (string | null): Tag name of the last LCP element
|
|
764
|
+
|
|
765
|
+
**Core Web Vitals Thresholds:**
|
|
766
|
+
- **LCP** (Largest Contentful Paint): good <= 2500ms, poor > 4000ms
|
|
767
|
+
- **INP** (Interaction to Next Paint): good <= 200ms, poor > 500ms
|
|
768
|
+
- **CLS** (Cumulative Layout Shift): good <= 0.1, poor > 0.25
|
|
769
|
+
|
|
770
|
+
**Supporting Metrics Thresholds:**
|
|
771
|
+
- **TTFB** (Time to First Byte): good <= 800ms, poor > 1800ms
|
|
772
|
+
- **FCP** (First Contentful Paint): good <= 1800ms, poor > 3000ms
|
|
773
|
+
|
|
774
|
+
**Usage:**
|
|
775
|
+
- Call after navigation and after user actions
|
|
776
|
+
- If you need more stable LCP/CLS/INP, pass waitMs (e.g., 1000-3000ms)
|
|
777
|
+
- Some metrics may be unavailable depending on browser support and whether interactions occurred
|
|
778
|
+
</details>
|
|
779
|
+
|
|
780
|
+
<details>
|
|
781
|
+
<summary><code>o11y_get-trace-id</code> - Gets the OpenTelemetry compatible trace id of the current session.</summary>
|
|
549
782
|
|
|
550
783
|
**Parameters:**
|
|
551
784
|
- No input parameters
|
|
@@ -554,9 +787,10 @@ Gets the OpenTelemetry compatible trace id of the current session.
|
|
|
554
787
|
- `traceId` (string, optional): The OpenTelemetry compatible trace id of the current session if available
|
|
555
788
|
|
|
556
789
|
**Note:** Requires OpenTelemetry to be enabled (`OTEL_ENABLE=true`).
|
|
790
|
+
</details>
|
|
557
791
|
|
|
558
|
-
|
|
559
|
-
Generates a new OpenTelemetry compatible trace id and sets it to the current session
|
|
792
|
+
<details>
|
|
793
|
+
<summary><code>o11y_new-trace-id</code> - Generates a new OpenTelemetry compatible trace id and sets it to the current session.</summary>
|
|
560
794
|
|
|
561
795
|
**Parameters:**
|
|
562
796
|
- No input parameters
|
|
@@ -565,9 +799,10 @@ Generates a new OpenTelemetry compatible trace id and sets it to the current ses
|
|
|
565
799
|
- `traceId` (string): The generated new OpenTelemetry compatible trace id
|
|
566
800
|
|
|
567
801
|
**Note:** Requires OpenTelemetry to be enabled (`OTEL_ENABLE=true`). The new trace ID is automatically set and will be used for all subsequent traces in the session.
|
|
802
|
+
</details>
|
|
568
803
|
|
|
569
|
-
|
|
570
|
-
Sets the OpenTelemetry compatible trace id of the current session
|
|
804
|
+
<details>
|
|
805
|
+
<summary><code>o11y_set-trace-id</code> - Sets the OpenTelemetry compatible trace id of the current session.</summary>
|
|
571
806
|
|
|
572
807
|
**Parameters:**
|
|
573
808
|
- `traceId` (string, optional): The OpenTelemetry compatible trace id to be set. Leave it empty to clear the session trace id, so no OpenTelemetry trace header will be propagated from browser throughout the API calls
|
|
@@ -576,11 +811,40 @@ Sets the OpenTelemetry compatible trace id of the current session.
|
|
|
576
811
|
- No return value
|
|
577
812
|
|
|
578
813
|
**Note:** Requires OpenTelemetry to be enabled (`OTEL_ENABLE=true`). When a trace ID is set, it will be propagated in HTTP headers (traceparent) for all API calls, enabling correlation with backend traces.
|
|
814
|
+
</details>
|
|
815
|
+
|
|
816
|
+
### Synchronization Tools
|
|
817
|
+
|
|
818
|
+
<details>
|
|
819
|
+
<summary><code>sync_wait-for-network-idle</code> - Waits until the page reaches a network-idle condition based on the session's tracked in-flight request count.</summary>
|
|
820
|
+
|
|
821
|
+
**Parameters:**
|
|
822
|
+
- `timeoutMs` (number, optional): Maximum time to wait before failing (milliseconds, default: 30000)
|
|
823
|
+
- `idleTimeMs` (number, optional): How long the network must stay idle continuously before resolving (milliseconds, default: 500)
|
|
824
|
+
- `maxConnections` (number, optional): Idle threshold - network is considered idle when in-flight requests <= maxConnections (default: 0)
|
|
825
|
+
- `pollIntervalMs` (number, optional): Polling interval used to sample the in-flight request count (milliseconds, default: 50)
|
|
826
|
+
|
|
827
|
+
**Returns:**
|
|
828
|
+
- `waitedMs` (number): Total time waited until the network became idle or the tool timed out
|
|
829
|
+
- `idleTimeMs` (number): Idle duration required for success
|
|
830
|
+
- `timeoutMs` (number): Maximum allowed wait time
|
|
831
|
+
- `maxConnections` (number): Idle threshold used
|
|
832
|
+
- `pollIntervalMs` (number): Polling interval used
|
|
833
|
+
- `finalInFlightRequests` (number): The last observed number of in-flight requests
|
|
834
|
+
- `observedIdleMs` (number): How long the in-flight request count stayed <= maxConnections
|
|
835
|
+
|
|
836
|
+
**Usage:**
|
|
837
|
+
- Use before interacting with SPA pages that load data asynchronously
|
|
838
|
+
- Use before taking screenshots or AX tree snapshots for more stable results
|
|
839
|
+
- Use after actions that trigger background fetch/XHR activity
|
|
840
|
+
|
|
841
|
+
**Note:** This tool uses server-side tracking, so it works reliably even with strict CSP. It does NOT rely on window globals or page-injected counters.
|
|
842
|
+
</details>
|
|
579
843
|
|
|
580
844
|
### Accessibility (A11Y) Tools
|
|
581
845
|
|
|
582
|
-
|
|
583
|
-
Captures an ARIA (accessibility) snapshot of the current page or a specific element
|
|
846
|
+
<details>
|
|
847
|
+
<summary><code>a11y_take-aria-snapshot</code> - Captures an ARIA (accessibility) snapshot of the current page or a specific element.</summary>
|
|
584
848
|
|
|
585
849
|
**Parameters:**
|
|
586
850
|
- `selector` (string, optional): CSS selector for element to snapshot
|
|
@@ -592,9 +856,10 @@ Captures an ARIA (accessibility) snapshot of the current page or a specific elem
|
|
|
592
856
|
- Use in combination with `accessibility_take-ax-tree-snapshot` for comprehensive UI analysis
|
|
593
857
|
- Provides semantic structure and accessibility roles
|
|
594
858
|
- Helps identify accessibility issues and page hierarchy problems
|
|
859
|
+
</details>
|
|
595
860
|
|
|
596
|
-
|
|
597
|
-
Captures a UI-focused snapshot by combining Chromium's Accessibility (AX) tree with runtime visual diagnostics
|
|
861
|
+
<details>
|
|
862
|
+
<summary><code>accessibility_take-ax-tree-snapshot</code> - Captures a UI-focused snapshot by combining Chromium's Accessibility (AX) tree with runtime visual diagnostics.</summary>
|
|
598
863
|
|
|
599
864
|
**Parameters:**
|
|
600
865
|
- `roles` (array, optional): Optional role allowlist (button, link, textbox, checkbox, radio, combobox, switch, tab, menuitem, dialog, heading, listbox, listitem, option). If omitted, a built-in set of interactive roles is used
|
|
@@ -627,6 +892,173 @@ Captures a UI-focused snapshot by combining Chromium's Accessibility (AX) tree w
|
|
|
627
892
|
- Identify wrong layout/geometry, styling issues, and overlap/stacking/occlusion problems
|
|
628
893
|
- ALWAYS use `checkOcclusion: true` when investigating UI/layout problems
|
|
629
894
|
- Use alongside `a11y_take-aria-snapshot` tool for complete UI analysis
|
|
895
|
+
</details>
|
|
896
|
+
|
|
897
|
+
### Stub Tools
|
|
898
|
+
|
|
899
|
+
<details>
|
|
900
|
+
<summary><code>stub_intercept-http-request</code> - Installs a request interceptor stub that can modify outgoing requests before they are sent.</summary>
|
|
901
|
+
|
|
902
|
+
**Parameters:**
|
|
903
|
+
- `pattern` (string, required): Glob pattern matched against the full request URL (picomatch)
|
|
904
|
+
- `modifications` (object, optional): Request modifications to apply
|
|
905
|
+
- `headers` (object, optional): Headers to merge into the outgoing request headers
|
|
906
|
+
- `body` (string | object, optional): Override request body. If object/array, it will be JSON-stringified
|
|
907
|
+
- `method` (string, optional): Override HTTP method (e.g., POST, PUT)
|
|
908
|
+
- `delayMs` (number, optional): Artificial delay in milliseconds before continuing the request (default: 0)
|
|
909
|
+
- `times` (number, optional): Apply only N times, then let through. Omit for infinite
|
|
910
|
+
|
|
911
|
+
**Returns:**
|
|
912
|
+
- `stubId` (string): Unique id of the installed stub
|
|
913
|
+
- `kind` (string): Stub kind (always "intercept_http_request")
|
|
914
|
+
- `pattern` (string): Glob pattern used
|
|
915
|
+
- `enabled` (boolean): Whether the stub is enabled
|
|
916
|
+
- `delayMs` (number): Applied artificial delay in milliseconds
|
|
917
|
+
- `times` (number): Max applications (-1 means infinite)
|
|
918
|
+
|
|
919
|
+
**Use cases:**
|
|
920
|
+
- A/B testing / feature flags (inject headers)
|
|
921
|
+
- Security testing (inject malformed headers / payload)
|
|
922
|
+
- Edge cases (special characters, large payload)
|
|
923
|
+
- Auth simulation (add API keys / tokens in headers)
|
|
924
|
+
|
|
925
|
+
**Notes:**
|
|
926
|
+
- Pattern is a glob matched against the full request URL (picomatch)
|
|
927
|
+
- This modifies requests; it does not change responses
|
|
928
|
+
- Times limits how many times the interceptor applies (-1 means infinite)
|
|
929
|
+
</details>
|
|
930
|
+
|
|
931
|
+
<details>
|
|
932
|
+
<summary><code>stub_mock-http-response</code> - Installs a response stub for matching requests using glob patterns (picomatch).</summary>
|
|
933
|
+
|
|
934
|
+
**Parameters:**
|
|
935
|
+
- `pattern` (string, required): Glob pattern matched against the full request URL (picomatch)
|
|
936
|
+
- `response` (object, required): Mock response configuration
|
|
937
|
+
- `action` (enum, optional): "fulfill" or "abort" (default: "fulfill")
|
|
938
|
+
- `status` (number, optional): HTTP status code (used when action="fulfill", range: 100-599)
|
|
939
|
+
- `headers` (object, optional): HTTP headers for the mocked response
|
|
940
|
+
- `body` (string | object, optional): Response body. If object/array, it will be JSON-stringified
|
|
941
|
+
- `abortErrorCode` (string, optional): Playwright abort error code (used when action="abort"), e.g., "timedout"
|
|
942
|
+
- `delayMs` (number, optional): Artificial delay in milliseconds before applying the stub (default: 0)
|
|
943
|
+
- `times` (number, optional): Apply only N times, then let through. Omit for infinite
|
|
944
|
+
- `chance` (number, optional): Probability (0..1) to apply the stub per request (flaky testing)
|
|
945
|
+
|
|
946
|
+
**Returns:**
|
|
947
|
+
- `stubId` (string): Unique id of the installed stub (use it to clear later)
|
|
948
|
+
- `kind` (string): Stub kind (always "mock_http_response")
|
|
949
|
+
- `pattern` (string): Glob pattern used
|
|
950
|
+
- `enabled` (boolean): Whether the stub is enabled
|
|
951
|
+
- `delayMs` (number): Applied artificial delay in milliseconds
|
|
952
|
+
- `times` (number): Max applications (-1 means infinite)
|
|
953
|
+
- `chance` (number, optional): Apply probability (omit means always)
|
|
954
|
+
- `action` (string): Applied action ("fulfill" or "abort")
|
|
955
|
+
- `status` (number, optional): HTTP status (present when action="fulfill")
|
|
956
|
+
|
|
957
|
+
**Use cases:**
|
|
958
|
+
- Offline testing (return 200 with local JSON)
|
|
959
|
+
- Error scenarios (force 500/404 or abort with timedout)
|
|
960
|
+
- Edge cases (empty data / huge payload / special characters)
|
|
961
|
+
- Flaky API testing (chance < 1.0)
|
|
962
|
+
- Performance testing (delayMs)
|
|
963
|
+
|
|
964
|
+
**Notes:**
|
|
965
|
+
- Pattern is a glob matched against the full request URL
|
|
966
|
+
- Stubs are evaluated in insertion order; first match wins
|
|
967
|
+
- Times limits how many times the stub applies (-1 means infinite)
|
|
968
|
+
</details>
|
|
969
|
+
|
|
970
|
+
<details>
|
|
971
|
+
<summary><code>stub_list</code> - Lists currently installed stubs for the active browser context/session.</summary>
|
|
972
|
+
|
|
973
|
+
**Parameters:**
|
|
974
|
+
- No input parameters
|
|
975
|
+
|
|
976
|
+
**Returns:**
|
|
977
|
+
- `stubs` (array): Array of installed stubs, each containing:
|
|
978
|
+
- `id` (string): Stub id
|
|
979
|
+
- `kind` (string): Stub kind ("intercept_http_request" or "mock_http_response")
|
|
980
|
+
- `enabled` (boolean): Whether stub is enabled
|
|
981
|
+
- `pattern` (string): Glob pattern (picomatch)
|
|
982
|
+
- `delayMs` (number): Artificial delay in ms
|
|
983
|
+
- `times` (number): Max applications (-1 means infinite)
|
|
984
|
+
- `usedCount` (number): How many times it has been applied
|
|
985
|
+
- `action` (string, optional): For mock_response: "fulfill" or "abort"
|
|
986
|
+
- `status` (number, optional): For mock_response: HTTP status (if set)
|
|
987
|
+
|
|
988
|
+
**Usage:**
|
|
989
|
+
- Useful to debug why certain calls are being mocked/intercepted
|
|
990
|
+
- Check stub status and usage statistics
|
|
991
|
+
- Verify stub configuration before debugging issues
|
|
992
|
+
</details>
|
|
993
|
+
|
|
994
|
+
<details>
|
|
995
|
+
<summary><code>stub_clear</code> - Clears stubs installed.</summary>
|
|
996
|
+
|
|
997
|
+
**Parameters:**
|
|
998
|
+
- `stubId` (string, optional): Stub id to remove. Omit to remove all stubs
|
|
999
|
+
|
|
1000
|
+
**Returns:**
|
|
1001
|
+
- `clearedCount` (number): Number of stubs removed
|
|
1002
|
+
|
|
1003
|
+
**Usage:**
|
|
1004
|
+
- Remove specific stub by ID when no longer needed
|
|
1005
|
+
- Clear all stubs to reset the browser context
|
|
1006
|
+
- Useful after testing or debugging sessions
|
|
1007
|
+
</details>
|
|
1008
|
+
|
|
1009
|
+
### Figma Tools
|
|
1010
|
+
|
|
1011
|
+
<details>
|
|
1012
|
+
<summary><code>compare-page-with-design</code> - Compares the current page UI against a Figma design snapshot and returns a combined similarity score.</summary>
|
|
1013
|
+
|
|
1014
|
+
**Parameters:**
|
|
1015
|
+
- `figmaFileKey` (string, required): Figma file key (the part after /file/ in Figma URL)
|
|
1016
|
+
- `figmaNodeId` (string, required): Figma node id (frame/component node, usually looks like "12:34")
|
|
1017
|
+
- `selector` (string, optional): Optional CSS selector to screenshot only a specific element instead of the whole page
|
|
1018
|
+
- `fullPage` (boolean, optional): If true, captures the full scrollable page. Ignored when selector is provided (default: true)
|
|
1019
|
+
- `figmaScale` (number, optional): Optional scale for Figma raster export (e.g., 1, 2, 3)
|
|
1020
|
+
- `figmaFormat` (enum, optional): Optional format for Figma export - "png" or "jpg" (default: "png")
|
|
1021
|
+
- `weights` (object, optional): Optional weights for combining signals. Missing/inactive signals are ignored and weights are renormalized:
|
|
1022
|
+
- `mssim` (number, optional): Weight for MSSIM signal
|
|
1023
|
+
- `imageEmbedding` (number, optional): Weight for image embedding signal
|
|
1024
|
+
- `textEmbedding` (number, optional): Weight for vision→text→text embedding signal
|
|
1025
|
+
- `mssimMode` (enum, optional): MSSIM mode - "raw" (stricter) or "semantic" (more layout-oriented, default: "semantic")
|
|
1026
|
+
- `maxDim` (number, optional): Optional preprocessing max dimension forwarded to compare pipeline
|
|
1027
|
+
- `jpegQuality` (number, optional): Optional JPEG quality forwarded to compare pipeline (used only when JPEG encoding is selected internally, range: 50-100)
|
|
1028
|
+
|
|
1029
|
+
**Returns:**
|
|
1030
|
+
- `score` (number): Combined similarity score in the range [0..1]. Higher means more similar
|
|
1031
|
+
- `notes` (array): Human-readable notes explaining which signals were used and their individual scores
|
|
1032
|
+
- `meta` (object): Metadata about what was compared:
|
|
1033
|
+
- `pageUrl` (string): URL of the page that was compared
|
|
1034
|
+
- `pageTitle` (string): Title of the page that was compared
|
|
1035
|
+
- `figmaFileKey` (string): Figma file key used for the design snapshot
|
|
1036
|
+
- `figmaNodeId` (string): Figma node id used for the design snapshot
|
|
1037
|
+
- `selector` (string | null): Selector used for page screenshot, if any. Null means full page
|
|
1038
|
+
- `fullPage` (boolean): Whether the page screenshot was full-page
|
|
1039
|
+
- `pageImageType` (enum): Image type of the captured page screenshot ("png" or "jpeg")
|
|
1040
|
+
- `figmaImageType` (enum): Image type of the captured Figma snapshot ("png" or "jpeg")
|
|
1041
|
+
|
|
1042
|
+
**How it works:**
|
|
1043
|
+
1. Fetches a raster snapshot from Figma (frame/node screenshot)
|
|
1044
|
+
2. Takes a screenshot of the live browser page (full page or a specific selector)
|
|
1045
|
+
3. Computes multiple similarity signals and combines them into one score:
|
|
1046
|
+
- MSSIM (structural similarity; always available)
|
|
1047
|
+
- Image embedding similarity (optional; may be skipped if provider is not configured)
|
|
1048
|
+
- Vision→text→text embedding similarity (optional; may be skipped if provider is not configured)
|
|
1049
|
+
|
|
1050
|
+
**Usage:**
|
|
1051
|
+
- Prefer 'semantic' MSSIM mode when comparing Figma sample data vs real data (less sensitive to text/value differences)
|
|
1052
|
+
- Use 'raw' MSSIM mode only when you expect near pixel-identical output
|
|
1053
|
+
- If you suspect layout/structure mismatch, run with fullPage=true first, then retry with a selector for the problematic region
|
|
1054
|
+
- Notes explain which signals were used or skipped; skipped signals usually mean missing cloud configuration (e.g., AWS_REGION, inference profile, etc.)
|
|
1055
|
+
|
|
1056
|
+
**Use cases:**
|
|
1057
|
+
- UI regression checks
|
|
1058
|
+
- Design parity validation
|
|
1059
|
+
- "Does this page still match the intended layout?" validation
|
|
1060
|
+
- Automated visual testing
|
|
1061
|
+
</details>
|
|
630
1062
|
|
|
631
1063
|
## Architecture
|
|
632
1064
|
|
|
@@ -655,6 +1087,8 @@ The server supports multiple browser engines:
|
|
|
655
1087
|
|
|
656
1088
|
Persistent contexts are shared across sessions and are not automatically closed when sessions end.
|
|
657
1089
|
|
|
1090
|
+
**Important for React Tools:** React tools work best with persistent browser context enabled. This allows you to manually install the React DevTools extension in the browser profile, which enables reliable root discovery and component search via `__REACT_DEVTOOLS_GLOBAL_HOOK__`.
|
|
1091
|
+
|
|
658
1092
|
- **System Browser**: When enabled (`BROWSER_USE_INSTALLED_ON_SYSTEM=true`), the server uses the system-installed Chrome browser instead of Playwright's bundled browser. This is useful for:
|
|
659
1093
|
- Testing with the exact browser version users have
|
|
660
1094
|
- Using browser extensions installed on the system
|
|
@@ -662,6 +1096,17 @@ The server supports multiple browser engines:
|
|
|
662
1096
|
|
|
663
1097
|
**Note:** System browser support is currently only available for Chromium/Chrome.
|
|
664
1098
|
|
|
1099
|
+
**React DevTools Extension Setup:**
|
|
1100
|
+
- React tools (`react_get-component-for-element`, `react_get-element-for-component`) work best when the React DevTools extension is installed in the browser profile
|
|
1101
|
+
- The MCP server does NOT automatically install the extension - you must install it manually
|
|
1102
|
+
- **Installation Steps:**
|
|
1103
|
+
1. Enable persistent browser context: `BROWSER_PERSISTENT_ENABLE=true`
|
|
1104
|
+
2. Start the MCP server (or navigate to a page in headful mode)
|
|
1105
|
+
3. Manually install the React Developer Tools extension from Chrome Web Store:
|
|
1106
|
+
- https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
|
|
1107
|
+
4. The extension will be available in all subsequent sessions using the same persistent context
|
|
1108
|
+
- **Without the Extension:** Tools will still work but use best-effort DOM scanning for `__reactFiber$` pointers, which is less reliable than using the DevTools hook
|
|
1109
|
+
|
|
665
1110
|
Browser instances are shared across sessions for efficiency. Each session gets its own isolated browser context, unless persistent context is enabled (in which case contexts are shared).
|
|
666
1111
|
|
|
667
1112
|
### Buffering & Filtering
|
|
@@ -742,20 +1187,23 @@ This server enables AI assistants to:
|
|
|
742
1187
|
3. **Distributed Tracing**: Enable OpenTelemetry to correlate frontend and backend traces for end-to-end debugging
|
|
743
1188
|
4. **Test User Flows**: Automate navigation and interactions
|
|
744
1189
|
5. **Visual Verification**: Compare visual states, verify UI changes
|
|
745
|
-
6. **
|
|
746
|
-
7. **
|
|
747
|
-
8. **
|
|
1190
|
+
6. **Design Comparison**: Compare live page UI against Figma designs with automated similarity scoring
|
|
1191
|
+
7. **Content Extraction**: Get HTML/text content with filtering and cleaning options
|
|
1192
|
+
8. **Accessibility Analysis**: Use ARIA and AX tree snapshots to understand page structure and detect UI issues
|
|
1193
|
+
9. **Performance Analysis**: Monitor HTTP request timing and failures
|
|
748
1194
|
|
|
749
1195
|
### Example Workflow
|
|
750
1196
|
|
|
751
1197
|
1. Navigate to a web page using `navigation_go-to`
|
|
752
|
-
2.
|
|
753
|
-
3.
|
|
754
|
-
4.
|
|
755
|
-
5.
|
|
756
|
-
6.
|
|
757
|
-
7.
|
|
758
|
-
8.
|
|
1198
|
+
2. Wait for network idle with `sync_wait-for-network-idle` if needed (for SPA pages)
|
|
1199
|
+
3. Take a screenshot with `content_take-screenshot` to see the current state
|
|
1200
|
+
4. Check console messages with `o11y_get-console-messages` for errors
|
|
1201
|
+
5. Monitor HTTP requests with `o11y_get-http-requests` to see API calls
|
|
1202
|
+
6. Capture accessibility snapshots with `a11y_take-aria-snapshot` and `accessibility_take-ax-tree-snapshot` to understand page structure
|
|
1203
|
+
7. Compare page with Figma design using `compare-page-with-design` to validate design parity
|
|
1204
|
+
8. Interact with elements using `interaction_click`, `interaction_fill`, etc.
|
|
1205
|
+
9. Extract content using `content_get-as-html` or `content_get-as-text`
|
|
1206
|
+
10. Save the page as PDF using `content_save-as-pdf` for documentation
|
|
759
1207
|
|
|
760
1208
|
## Contributing
|
|
761
1209
|
|