browser-devtools-mcp 0.0.2 → 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.
Files changed (101) hide show
  1. package/README.md +594 -55
  2. package/dist/browser.js +168 -22
  3. package/dist/browser.js.map +1 -1
  4. package/dist/config.js +89 -8
  5. package/dist/config.js.map +1 -1
  6. package/dist/context.js +100 -17
  7. package/dist/context.js.map +1 -1
  8. package/dist/index.js +77 -42
  9. package/dist/index.js.map +1 -1
  10. package/dist/otel/otel-controller.js +323 -0
  11. package/dist/otel/otel-controller.js.map +1 -0
  12. package/dist/otel/otel-initializer.bundle.js +2 -0
  13. package/dist/otel/otel-initializer.bundle.js.map +7 -0
  14. package/dist/otel/otel-proxy.js +407 -0
  15. package/dist/otel/otel-proxy.js.map +1 -0
  16. package/dist/server-info.js +133 -18
  17. package/dist/server-info.js.map +1 -1
  18. package/dist/server.js +4 -19
  19. package/dist/server.js.map +1 -1
  20. package/dist/tools/content/take-screenshot.js +183 -1
  21. package/dist/tools/content/take-screenshot.js.map +1 -1
  22. package/dist/tools/figma/compare/compare-image-embedding.js +159 -0
  23. package/dist/tools/figma/compare/compare-image-embedding.js.map +1 -0
  24. package/dist/tools/figma/compare/compare-mssim.js +98 -0
  25. package/dist/tools/figma/compare/compare-mssim.js.map +1 -0
  26. package/dist/tools/figma/compare/compare-text-embedding.js +291 -0
  27. package/dist/tools/figma/compare/compare-text-embedding.js.map +1 -0
  28. package/dist/tools/figma/compare/index.js +139 -0
  29. package/dist/tools/figma/compare/index.js.map +1 -0
  30. package/dist/tools/figma/compare/types.js +3 -0
  31. package/dist/tools/figma/compare/types.js.map +1 -0
  32. package/dist/tools/figma/compare/vector.js +46 -0
  33. package/dist/tools/figma/compare/vector.js.map +1 -0
  34. package/dist/tools/figma/compare-page-with-design.js +240 -0
  35. package/dist/tools/figma/compare-page-with-design.js.map +1 -0
  36. package/dist/tools/figma/figma-service.js +134 -0
  37. package/dist/tools/figma/figma-service.js.map +1 -0
  38. package/dist/tools/figma/index.js +6 -0
  39. package/dist/tools/figma/index.js.map +1 -0
  40. package/dist/tools/index.js +12 -2
  41. package/dist/tools/index.js.map +1 -1
  42. package/dist/tools/interaction/index.js +6 -2
  43. package/dist/tools/interaction/index.js.map +1 -1
  44. package/dist/tools/interaction/resize-viewport.js +110 -0
  45. package/dist/tools/interaction/resize-viewport.js.map +1 -0
  46. package/dist/tools/interaction/resize-window.js +261 -0
  47. package/dist/tools/interaction/resize-window.js.map +1 -0
  48. package/dist/tools/interaction/scroll.js +304 -0
  49. package/dist/tools/interaction/scroll.js.map +1 -0
  50. package/dist/tools/{monitoring → o11y}/get-console-messages.js +1 -1
  51. package/dist/tools/o11y/get-console-messages.js.map +1 -0
  52. package/dist/tools/{monitoring → o11y}/get-http-requests.js +1 -1
  53. package/dist/tools/o11y/get-http-requests.js.map +1 -0
  54. package/dist/tools/o11y/get-trace-id.js +30 -0
  55. package/dist/tools/o11y/get-trace-id.js.map +1 -0
  56. package/dist/tools/o11y/get-web-vitals.js +595 -0
  57. package/dist/tools/o11y/get-web-vitals.js.map +1 -0
  58. package/dist/tools/o11y/index.js +18 -0
  59. package/dist/tools/o11y/index.js.map +1 -0
  60. package/dist/tools/o11y/new-trace-id.js +32 -0
  61. package/dist/tools/o11y/new-trace-id.js.map +1 -0
  62. package/dist/tools/o11y/set-trace-id.js +28 -0
  63. package/dist/tools/o11y/set-trace-id.js.map +1 -0
  64. package/dist/tools/react/get-component-for-element.js +941 -0
  65. package/dist/tools/react/get-component-for-element.js.map +1 -0
  66. package/dist/tools/react/get-element-for-component.js +1190 -0
  67. package/dist/tools/react/get-element-for-component.js.map +1 -0
  68. package/dist/tools/react/index.js +10 -0
  69. package/dist/tools/react/index.js.map +1 -0
  70. package/dist/tools/run/index.js +7 -0
  71. package/dist/tools/run/index.js.map +1 -0
  72. package/dist/tools/{interaction/evaluate.js → run/js-in-browser.js} +24 -6
  73. package/dist/tools/run/js-in-browser.js.map +1 -0
  74. package/dist/tools/run/js-in-sandbox.js +175 -0
  75. package/dist/tools/run/js-in-sandbox.js.map +1 -0
  76. package/dist/tools/stub/clear.js +41 -0
  77. package/dist/tools/stub/clear.js.map +1 -0
  78. package/dist/tools/stub/index.js +14 -0
  79. package/dist/tools/stub/index.js.map +1 -0
  80. package/dist/tools/stub/intercept-http-request.js +112 -0
  81. package/dist/tools/stub/intercept-http-request.js.map +1 -0
  82. package/dist/tools/stub/list.js +75 -0
  83. package/dist/tools/stub/list.js.map +1 -0
  84. package/dist/tools/stub/mock-http-response.js +152 -0
  85. package/dist/tools/stub/mock-http-response.js.map +1 -0
  86. package/dist/tools/stub/stub-controller.js +284 -0
  87. package/dist/tools/stub/stub-controller.js.map +1 -0
  88. package/dist/tools/sync/index.js +6 -0
  89. package/dist/tools/sync/index.js.map +1 -0
  90. package/dist/tools/sync/wait-for-network-idle.js +152 -0
  91. package/dist/tools/sync/wait-for-network-idle.js.map +1 -0
  92. package/dist/tools/tool-executor.js +26 -4
  93. package/dist/tools/tool-executor.js.map +1 -1
  94. package/dist/utils.js +38 -0
  95. package/dist/utils.js.map +1 -1
  96. package/package.json +17 -3
  97. package/dist/tools/interaction/evaluate.js.map +0 -1
  98. package/dist/tools/monitoring/get-console-messages.js.map +0 -1
  99. package/dist/tools/monitoring/get-http-requests.js.map +0 -1
  100. package/dist/tools/monitoring/index.js +0 -7
  101. package/dist/tools/monitoring/index.js.map +0 -1
package/README.md CHANGED
@@ -13,10 +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
- - **JavaScript Evaluation**: Execute code in page context
20
+ - **OpenTelemetry Integration**: Automatic trace injection into web pages, UI trace collection, and backend trace correlation via trace context propagation
21
+ - **JavaScript Execution**: Execute code in browser page context or in Node.js VM sandbox on the server
20
22
  - **Session Management**: Long-lived, session-based debugging with automatic cleanup
21
23
  - **Multiple Transport Modes**: Supports both stdio and HTTP transports
22
24
 
@@ -34,21 +36,53 @@ Browser DevTools MCP exposes a Playwright-powered browser runtime to AI agents,
34
36
  - **Press Key**: Simulate keyboard input
35
37
  - **Select**: Select dropdown options
36
38
  - **Drag**: Drag and drop operations
37
- - **Evaluate**: Execute JavaScript in page context
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
38
42
 
39
43
  ### Navigation Tools
40
44
  - **Go To**: Navigate to URLs with configurable wait strategies
41
45
  - **Go Back**: Navigate backward in history
42
46
  - **Go Forward**: Navigate forward in history
43
47
 
44
- ### Monitoring Tools
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
45
53
  - **Console Messages**: Capture and filter browser console logs with advanced filtering (level, search, timestamp, sequence number)
46
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
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
57
+ - **Trace ID Management**: Get, set, and generate OpenTelemetry compatible trace IDs for distributed tracing across API calls
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
47
61
 
48
62
  ### Accessibility (A11Y) Tools
49
63
  - **ARIA Snapshots**: Capture semantic structure and accessibility roles in YAML format
50
64
  - **AX Tree Snapshots**: Combine Chromium's Accessibility tree with runtime visual diagnostics (bounding boxes, visibility, occlusion detection, computed styles)
51
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
+
52
86
  ## Prerequisites
53
87
 
54
88
  - Node.js 18+
@@ -363,14 +397,28 @@ The server can be configured using environment variables:
363
397
  | `SESSION_CLOSE_ON_SOCKET_CLOSE` | Close session when socket closes | `false` |
364
398
  | `CONSOLE_MESSAGES_BUFFER_SIZE` | Maximum console messages to buffer | `1000` |
365
399
  | `HTTP_REQUESTS_BUFFER_SIZE` | Maximum HTTP requests to buffer | `1000` |
400
+ | `BROWSER_HEADLESS_ENABLE` | Run browser in headless mode | `true` |
401
+ | `BROWSER_PERSISTENT_ENABLE` | Use persistent browser context (preserves cookies, localStorage, etc.). **Required for React tools to work optimally.** | `false` |
402
+ | `BROWSER_PERSISTENT_USER_DATA_DIR` | Directory for persistent browser context user data | `./browser-devtools-mcp` |
403
+ | `BROWSER_USE_INSTALLED_ON_SYSTEM` | Use system-installed Chrome browser instead of Playwright's bundled browser | `false` |
366
404
  | `BROWSER_EXECUTABLE_PATH` | Custom browser executable path | (uses Playwright default) |
405
+ | `OTEL_ENABLE` | Enable OpenTelemetry integration | `false` |
406
+ | `OTEL_SERVICE_NAME` | OpenTelemetry service name | `frontend` |
407
+ | `OTEL_SERVICE_VERSION` | OpenTelemetry service version | (none) |
408
+ | `OTEL_ASSETS_DIR` | Directory containing OpenTelemetry bundle files | (uses default) |
409
+ | `OTEL_EXPORTER_TYPE` | OpenTelemetry exporter type: "otlp/http", "console", or "none" | `none` |
410
+ | `OTEL_EXPORTER_HTTP_URL` | OpenTelemetry collector base URL (e.g., "http://localhost:4318") | (none) |
411
+ | `OTEL_EXPORTER_HTTP_HEADERS` | OpenTelemetry exporter HTTP headers (comma-separated key=value pairs) | (none) |
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` |
367
415
 
368
416
  ## Available Tools
369
417
 
370
418
  ### Content Tools
371
419
 
372
- #### `content_take-screenshot`
373
- 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>
374
422
 
375
423
  **Parameters:**
376
424
  - `outputPath` (string, optional): Directory path where screenshot will be saved (default: OS temp directory)
@@ -378,13 +426,20 @@ Takes a screenshot of the current page or a specific element.
378
426
  - `selector` (string, optional): CSS selector for element to capture
379
427
  - `fullPage` (boolean, optional): Capture full scrollable page (default: false)
380
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)
381
430
 
382
431
  **Returns:**
383
432
  - `filePath` (string): Full path of the saved screenshot file
384
433
  - `image` (object): Screenshot image data with mimeType
385
434
 
386
- #### `content_get-as-html`
387
- Retrieves the HTML content of the current page or a specific element.
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>
388
443
 
389
444
  **Parameters:**
390
445
  - `selector` (string, optional): CSS selector to limit the HTML content to a specific container
@@ -398,9 +453,10 @@ Retrieves the HTML content of the current page or a specific element.
398
453
 
399
454
  **Returns:**
400
455
  - `output` (string): The requested HTML content of the page
456
+ </details>
401
457
 
402
- #### `content_get-as-text`
403
- 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>
404
460
 
405
461
  **Parameters:**
406
462
  - `selector` (string, optional): CSS selector to limit the text content to a specific container
@@ -408,9 +464,10 @@ Retrieves the visible text content of the current page or a specific element.
408
464
 
409
465
  **Returns:**
410
466
  - `output` (string): The requested text content of the page
467
+ </details>
411
468
 
412
- #### `content_save-as-pdf`
413
- 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>
414
471
 
415
472
  **Parameters:**
416
473
  - `outputPath` (string, optional): Directory path where PDF will be saved (default: OS temp directory)
@@ -421,61 +478,135 @@ Saves the current page as a PDF document.
421
478
 
422
479
  **Returns:**
423
480
  - `filePath` (string): Full path of the saved PDF file
481
+ </details>
424
482
 
425
483
  ### Interaction Tools
426
484
 
427
- #### `interaction_click`
428
- Clicks an element on the page.
485
+ <details>
486
+ <summary><code>interaction_click</code> - Clicks an element on the page.</summary>
429
487
 
430
488
  **Parameters:**
431
489
  - `selector` (string, required): CSS selector for the element to click
490
+ </details>
432
491
 
433
- #### `interaction_fill`
434
- Fills a form input field.
492
+ <details>
493
+ <summary><code>interaction_fill</code> - Fills a form input field.</summary>
435
494
 
436
495
  **Parameters:**
437
496
  - `selector` (string, required): CSS selector for the input field
438
497
  - `value` (string, required): Value to fill
498
+ </details>
439
499
 
440
- #### `interaction_hover`
441
- Hovers over an element.
500
+ <details>
501
+ <summary><code>interaction_hover</code> - Hovers over an element.</summary>
442
502
 
443
503
  **Parameters:**
444
504
  - `selector` (string, required): CSS selector for the element to hover
505
+ </details>
445
506
 
446
- #### `interaction_press-key`
447
- Simulates keyboard input.
507
+ <details>
508
+ <summary><code>interaction_press-key</code> - Simulates keyboard input.</summary>
448
509
 
449
510
  **Parameters:**
450
511
  - `key` (string, required): Key to press (e.g., "Enter", "Escape", "Tab")
512
+ </details>
451
513
 
452
- #### `interaction_select`
453
- Selects an option from a dropdown.
514
+ <details>
515
+ <summary><code>interaction_select</code> - Selects an option from a dropdown.</summary>
454
516
 
455
517
  **Parameters:**
456
518
  - `selector` (string, required): CSS selector for the select element
457
519
  - `value` (string, required): Value to select
520
+ </details>
458
521
 
459
- #### `interaction_drag`
460
- Performs drag and drop operation.
522
+ <details>
523
+ <summary><code>interaction_drag</code> - Performs drag and drop operation.</summary>
461
524
 
462
525
  **Parameters:**
463
526
  - `sourceSelector` (string, required): CSS selector for the source element
464
527
  - `targetSelector` (string, required): CSS selector for the target element
528
+ </details>
465
529
 
466
- #### `interaction_evaluate`
467
- Executes JavaScript in the browser console.
530
+ <details>
531
+ <summary><code>interaction_scroll</code> - Scrolls the page viewport or a specific scrollable element.</summary>
468
532
 
469
533
  **Parameters:**
470
- - `script` (string, required): JavaScript code to execute
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)
570
+
571
+ **Returns:**
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")
471
592
 
472
593
  **Returns:**
473
- - `result` (any): Result of the JavaScript evaluation
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>
474
605
 
475
606
  ### Navigation Tools
476
607
 
477
- #### `navigation_go-to`
478
- Navigates to a URL.
608
+ <details>
609
+ <summary><code>navigation_go-to</code> - Navigates to a URL.</summary>
479
610
 
480
611
  **Parameters:**
481
612
  - `url` (string, required): URL to navigate to (must include scheme)
@@ -487,17 +618,82 @@ Navigates to a URL.
487
618
  - `status` (number): HTTP status code
488
619
  - `statusText` (string): HTTP status text
489
620
  - `ok` (boolean): Whether navigation was successful (2xx status)
621
+ </details>
622
+
623
+ <details>
624
+ <summary><code>navigation_go-back</code> - Navigates backward in browser history.</summary>
625
+ </details>
626
+
627
+ <details>
628
+ <summary><code>navigation_go-forward</code> - Navigates forward in browser history.</summary>
629
+ </details>
490
630
 
491
- #### `navigation_go-back`
492
- Navigates backward in browser history.
631
+ ### Run Tools
493
632
 
494
- #### `navigation_go-forward`
495
- Navigates forward in browser history.
633
+ <details>
634
+ <summary><code>run_js-in-browser</code> - Runs custom JavaScript INSIDE the active browser page using Playwright's "page.evaluate()".</summary>
496
635
 
497
- ### Monitoring Tools
636
+ **Parameters:**
637
+ - `script` (string, required): JavaScript code to execute
498
638
 
499
- #### `monitoring_get-console-messages`
500
- Retrieves console messages/logs from the browser with advanced filtering.
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>
501
697
 
502
698
  **Parameters:**
503
699
  - `type` (enum, optional): Filter by message level - "ERROR", "WARNING", "INFO", "DEBUG"
@@ -510,9 +706,10 @@ Retrieves console messages/logs from the browser with advanced filtering.
510
706
 
511
707
  **Returns:**
512
708
  - `messages` (array): Array of console messages with type, text, location, timestamp, and sequence number
709
+ </details>
513
710
 
514
- #### `monitoring_get-http-requests`
515
- 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>
516
713
 
517
714
  **Parameters:**
518
715
  - `resourceType` (enum, optional): Filter by resource type (e.g., "document", "script", "stylesheet")
@@ -528,11 +725,126 @@ Retrieves HTTP requests from the browser with detailed filtering.
528
725
 
529
726
  **Returns:**
530
727
  - `requests` (array): Array of HTTP requests with URL, method, headers, body, response, timing, and metadata
728
+ </details>
729
+
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>
782
+
783
+ **Parameters:**
784
+ - No input parameters
785
+
786
+ **Returns:**
787
+ - `traceId` (string, optional): The OpenTelemetry compatible trace id of the current session if available
788
+
789
+ **Note:** Requires OpenTelemetry to be enabled (`OTEL_ENABLE=true`).
790
+ </details>
791
+
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>
794
+
795
+ **Parameters:**
796
+ - No input parameters
797
+
798
+ **Returns:**
799
+ - `traceId` (string): The generated new OpenTelemetry compatible trace id
800
+
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>
803
+
804
+ <details>
805
+ <summary><code>o11y_set-trace-id</code> - Sets the OpenTelemetry compatible trace id of the current session.</summary>
806
+
807
+ **Parameters:**
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
809
+
810
+ **Returns:**
811
+ - No return value
812
+
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>
531
843
 
532
844
  ### Accessibility (A11Y) Tools
533
845
 
534
- #### `a11y_take-aria-snapshot`
535
- 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>
536
848
 
537
849
  **Parameters:**
538
850
  - `selector` (string, optional): CSS selector for element to snapshot
@@ -544,9 +856,10 @@ Captures an ARIA (accessibility) snapshot of the current page or a specific elem
544
856
  - Use in combination with `accessibility_take-ax-tree-snapshot` for comprehensive UI analysis
545
857
  - Provides semantic structure and accessibility roles
546
858
  - Helps identify accessibility issues and page hierarchy problems
859
+ </details>
547
860
 
548
- #### `accessibility_take-ax-tree-snapshot`
549
- 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>
550
863
 
551
864
  **Parameters:**
552
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
@@ -579,6 +892,173 @@ Captures a UI-focused snapshot by combining Chromium's Accessibility (AX) tree w
579
892
  - Identify wrong layout/geometry, styling issues, and overlap/stacking/occlusion problems
580
893
  - ALWAYS use `checkOcclusion: true` when investigating UI/layout problems
581
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>
582
1062
 
583
1063
  ## Architecture
584
1064
 
@@ -597,7 +1077,37 @@ The server supports multiple browser engines:
597
1077
  - **Firefox**
598
1078
  - **WebKit**
599
1079
 
600
- Browser instances are shared across sessions for efficiency, but each session has its own isolated browser context.
1080
+ **Browser Configuration:**
1081
+ - **Headless Mode**: By default, browsers run in headless mode (`BROWSER_HEADLESS_ENABLE=true`). Set to `false` to see the browser window.
1082
+ - **Persistent Context**: When enabled (`BROWSER_PERSISTENT_ENABLE=true`), browser contexts persist across sessions, preserving:
1083
+ - Cookies and session data
1084
+ - LocalStorage and IndexedDB
1085
+ - Browser extensions and settings
1086
+ - User preferences
1087
+
1088
+ Persistent contexts are shared across sessions and are not automatically closed when sessions end.
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
+
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:
1093
+ - Testing with the exact browser version users have
1094
+ - Using browser extensions installed on the system
1095
+ - Better compatibility with certain web applications
1096
+
1097
+ **Note:** System browser support is currently only available for Chromium/Chrome.
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
+
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).
601
1111
 
602
1112
  ### Buffering & Filtering
603
1113
 
@@ -609,6 +1119,31 @@ Console messages and HTTP requests are buffered in memory with configurable buff
609
1119
  - **Incremental retrieval**: Use sequence numbers to fetch only new items
610
1120
  - **Pagination**: Limit results with start/end trimming
611
1121
 
1122
+ ### OpenTelemetry Integration
1123
+
1124
+ When enabled (`OTEL_ENABLE=true`), the server automatically injects OpenTelemetry instrumentation into all web pages navigated by the browser. This enables:
1125
+
1126
+ - **Automatic Trace Collection**: UI traces are automatically collected for:
1127
+ - Document load events
1128
+ - Fetch/XHR requests
1129
+ - User interactions (clicks, form submissions, etc.)
1130
+
1131
+ - **Trace Context Propagation**: Trace IDs are automatically propagated in HTTP headers (traceparent) for all API calls, enabling:
1132
+ - Correlation between frontend and backend traces
1133
+ - End-to-end distributed tracing across the entire application stack
1134
+
1135
+ - **Trace ID Management**: Tools allow you to:
1136
+ - Get the current session's trace ID
1137
+ - Generate new trace IDs
1138
+ - Set custom trace IDs (e.g., from backend trace context)
1139
+
1140
+ - **Exporter Configuration**: Traces can be exported to:
1141
+ - **OTLP/HTTP**: Send to OpenTelemetry collector (configure via `OTEL_EXPORTER_HTTP_URL`)
1142
+ - **Console**: Log traces to browser console (for debugging)
1143
+ - **None**: Collect traces but don't export (for testing)
1144
+
1145
+ The OpenTelemetry integration uses a proxy mechanism (`/__mcp_otel/`) to forward traces from the browser to the configured collector, ensuring proper CORS handling and trace context propagation.
1146
+
612
1147
  ## Development
613
1148
 
614
1149
  ### Prerequisites
@@ -649,22 +1184,26 @@ This server enables AI assistants to:
649
1184
 
650
1185
  1. **Debug Web Applications**: Capture screenshots, inspect DOM, check console errors
651
1186
  2. **Monitor Network Activity**: Track API calls, analyze request/response patterns
652
- 3. **Test User Flows**: Automate navigation and interactions
653
- 4. **Visual Verification**: Compare visual states, verify UI changes
654
- 5. **Content Extraction**: Get HTML/text content with filtering and cleaning options
655
- 6. **Accessibility Analysis**: Use ARIA and AX tree snapshots to understand page structure and detect UI issues
656
- 7. **Performance Analysis**: Monitor HTTP request timing and failures
1187
+ 3. **Distributed Tracing**: Enable OpenTelemetry to correlate frontend and backend traces for end-to-end debugging
1188
+ 4. **Test User Flows**: Automate navigation and interactions
1189
+ 5. **Visual Verification**: Compare visual states, verify UI changes
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
657
1194
 
658
1195
  ### Example Workflow
659
1196
 
660
1197
  1. Navigate to a web page using `navigation_go-to`
661
- 2. Take a screenshot with `content_take-screenshot` to see the current state
662
- 3. Check console messages with `monitoring_get-console-messages` for errors
663
- 4. Monitor HTTP requests with `monitoring_get-http-requests` to see API calls
664
- 5. Capture accessibility snapshots with `a11y_take-aria-snapshot` and `accessibility_take-ax-tree-snapshot` to understand page structure
665
- 6. Interact with elements using `interaction_click`, `interaction_fill`, etc.
666
- 7. Extract content using `content_get-as-html` or `content_get-as-text`
667
- 8. Save the page as PDF using `content_save-as-pdf` for documentation
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
668
1207
 
669
1208
  ## Contributing
670
1209