browser-devtools-mcp 0.1.3 → 0.1.5

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 (56) hide show
  1. package/README.md +600 -7
  2. package/SECURITY.md +136 -0
  3. package/dist/cli.js +1847 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/config.js +5 -1
  6. package/dist/config.js.map +1 -1
  7. package/dist/context.js +7 -7
  8. package/dist/context.js.map +1 -1
  9. package/dist/daemon-server.js +338 -0
  10. package/dist/daemon-server.js.map +1 -0
  11. package/dist/index.js +3 -260
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp-server.js +401 -0
  14. package/dist/mcp-server.js.map +1 -0
  15. package/dist/tools/a11y/take-aria-snapshot.js.map +1 -1
  16. package/dist/tools/a11y/take-ax-tree-snapshot.js.map +1 -1
  17. package/dist/tools/content/get-as-html.js.map +1 -1
  18. package/dist/tools/content/get-as-text.js.map +1 -1
  19. package/dist/tools/content/save-as-pdf.js.map +1 -1
  20. package/dist/tools/content/take-screenshot.js.map +1 -1
  21. package/dist/tools/figma/compare-page-with-design.js.map +1 -1
  22. package/dist/tools/interaction/click.js.map +1 -1
  23. package/dist/tools/interaction/drag.js.map +1 -1
  24. package/dist/tools/interaction/fill.js.map +1 -1
  25. package/dist/tools/interaction/hover.js.map +1 -1
  26. package/dist/tools/interaction/press-key.js.map +1 -1
  27. package/dist/tools/interaction/resize-viewport.js.map +1 -1
  28. package/dist/tools/interaction/resize-window.js.map +1 -1
  29. package/dist/tools/interaction/scroll.js.map +1 -1
  30. package/dist/tools/interaction/select.js.map +1 -1
  31. package/dist/tools/navigation/go-back.js.map +1 -1
  32. package/dist/tools/navigation/go-forward.js.map +1 -1
  33. package/dist/tools/navigation/go-to.js.map +1 -1
  34. package/dist/tools/navigation/reload.js.map +1 -1
  35. package/dist/tools/o11y/get-console-messages.js.map +1 -1
  36. package/dist/tools/o11y/get-http-requests.js.map +1 -1
  37. package/dist/tools/o11y/get-trace-id.js.map +1 -1
  38. package/dist/tools/o11y/get-web-vitals.js.map +1 -1
  39. package/dist/tools/o11y/new-trace-id.js.map +1 -1
  40. package/dist/tools/o11y/set-trace-id.js.map +1 -1
  41. package/dist/tools/react/get-component-for-element.js.map +1 -1
  42. package/dist/tools/react/get-element-for-component.js.map +1 -1
  43. package/dist/tools/run/js-in-browser.js.map +1 -1
  44. package/dist/tools/run/js-in-sandbox.js.map +1 -1
  45. package/dist/tools/stub/clear.js.map +1 -1
  46. package/dist/tools/stub/intercept-http-request.js.map +1 -1
  47. package/dist/tools/stub/list.js.map +1 -1
  48. package/dist/tools/stub/mock-http-response.js.map +1 -1
  49. package/dist/tools/sync/wait-for-network-idle.js.map +1 -1
  50. package/dist/tools/tool-executor.js +1 -1
  51. package/dist/tools/tool-executor.js.map +1 -1
  52. package/dist/utils/cli-utils.js +253 -0
  53. package/dist/utils/cli-utils.js.map +1 -0
  54. package/package.json +10 -7
  55. package/dist/server.js +0 -154
  56. package/dist/server.js.map +0 -1
package/README.md CHANGED
@@ -1,10 +1,18 @@
1
- # Browser DevTools MCP
2
-
3
- ![Build Status](https://github.com/serkan-ozal/browser-devtools-mcp/actions/workflows/build.yml/badge.svg)
4
- ![NPM Version](https://badge.fury.io/js/browser-devtools-mcp.svg)
5
- ![License](https://img.shields.io/badge/license-MIT-blue)
6
-
7
- A powerful [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that provides AI coding assistants with comprehensive browser automation and debugging capabilities using Playwright. This server enables both **execution-level debugging** (logs, network requests) and **visual debugging** (screenshots, ARIA snapshots) to help AI assistants understand and interact with web pages effectively.
1
+ <p align="center">
2
+ <img src="public/icon.svg" alt="Browser DevTools MCP" width="128" height="128">
3
+ <br>
4
+ <strong style="font-size: 2em;">Browser DevTools MCP</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/serkan-ozal/browser-devtools-mcp/actions/workflows/build.yml"><img src="https://github.com/serkan-ozal/browser-devtools-mcp/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
9
+ <a href="https://www.npmjs.com/package/browser-devtools-mcp"><img src="https://badge.fury.io/js/browser-devtools-mcp.svg" alt="NPM Version"></a>
10
+ <a href="https://github.com/serkan-ozal/browser-devtools-mcp/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License"></a>
11
+ </p>
12
+
13
+ <p align="center">
14
+ A powerful <a href="https://modelcontextprotocol.io">Model Context Protocol (MCP)</a> server that provides AI coding assistants with comprehensive browser automation and debugging capabilities using Playwright. This server enables both <strong>execution-level debugging</strong> (logs, network requests) and <strong>visual debugging</strong> (screenshots, ARIA snapshots) to help AI assistants understand and interact with web pages effectively.
15
+ </p>
8
16
 
9
17
  ## Overview
10
18
 
@@ -385,6 +393,526 @@ npx -y browser-devtools-mcp --transport=streamable-http --port=3000
385
393
  npx -y @modelcontextprotocol/inspector http://localhost:3000/mcp --transport http
386
394
  ```
387
395
 
396
+ ## CLI Tool
397
+
398
+ Browser DevTools MCP includes a standalone CLI tool (`browser-devtools-cli`) for direct command-line access to browser automation capabilities. This is particularly useful for:
399
+
400
+ - **Scripting and automation**: Use in shell scripts, CI/CD pipelines, or automated workflows
401
+ - **Session-based testing**: Maintain browser state across multiple commands with session IDs
402
+ - **Skill-based workflows**: Build reusable automation sequences
403
+
404
+ ### Installation
405
+
406
+ The CLI is included with the npm package:
407
+
408
+ ```bash
409
+ # Run directly with npx
410
+ npx -y browser-devtools-mcp browser-devtools-cli --help
411
+
412
+ # Or install globally
413
+ npm install -g browser-devtools-mcp
414
+ browser-devtools-cli --help
415
+ ```
416
+
417
+ ### Global Options
418
+
419
+ | Option | Description | Default |
420
+ |--------|-------------|---------|
421
+ | `--port <number>` | Daemon server port | `2020` |
422
+ | `--session-id <string>` | Session ID for maintaining browser state across commands | (none) |
423
+ | `--json` | Output results as JSON | `false` |
424
+ | `--quiet` | Suppress log messages, only show output | `false` |
425
+ | `--verbose` | Enable verbose/debug output for troubleshooting | `false` |
426
+ | `--timeout <ms>` | Timeout for operations in milliseconds | `30000` |
427
+
428
+ ### Browser Options
429
+
430
+ | Option | Description | Default |
431
+ |--------|-------------|---------|
432
+ | `--headless` / `--no-headless` | Run browser in headless (no visible window) or headful mode | `true` |
433
+ | `--persistent` / `--no-persistent` | Use persistent browser context (preserves cookies, localStorage) | `false` |
434
+ | `--user-data-dir <path>` | Directory for persistent browser context user data | `./browser-devtools-mcp` |
435
+ | `--use-system-browser` | Use system-installed Chrome instead of bundled browser | `false` |
436
+ | `--browser-path <path>` | Custom browser executable path | (none) |
437
+
438
+ **Note:** Browser options are applied when the daemon server starts. If the daemon is already running, stop it first (`daemon stop`) then start with new options.
439
+
440
+ ### Commands
441
+
442
+ The CLI organizes tools into domain-based subcommands:
443
+
444
+ ```
445
+ browser-devtools-cli
446
+ ├── daemon # Manage the daemon server
447
+ │ ├── start # Start the daemon server
448
+ │ ├── stop # Stop the daemon server
449
+ │ ├── restart # Restart the daemon server (stop + start)
450
+ │ ├── status # Check daemon server status
451
+ │ └── info # Get detailed daemon info (version, uptime, sessions)
452
+ ├── session # Manage browser sessions
453
+ │ ├── list # List all active sessions
454
+ │ ├── info <session-id> # Get information about a session
455
+ │ └── delete <session-id> # Delete a specific session
456
+ ├── tools # Inspect available tools
457
+ │ ├── list # List all tools (with --domain filter)
458
+ │ ├── info <tool-name> # Get detailed tool info and parameters
459
+ │ └── search <query> # Search tools by name or description
460
+ ├── config # Show current configuration
461
+ ├── completion # Generate shell completion scripts
462
+ │ ├── bash # Generate bash completion script
463
+ │ └── zsh # Generate zsh completion script
464
+ ├── interactive (repl) # Start interactive REPL mode
465
+ ├── update # Check for and install updates
466
+ ├── navigation # Navigation commands
467
+ │ ├── go-to # Navigate to a URL
468
+ │ ├── go-back # Navigate backward
469
+ │ ├── go-forward # Navigate forward
470
+ │ └── reload # Reload the page
471
+ ├── content # Content extraction commands
472
+ │ ├── take-screenshot # Take a screenshot
473
+ │ ├── get-as-html # Get HTML content
474
+ │ ├── get-as-text # Get text content
475
+ │ └── save-as-pdf # Save as PDF
476
+ ├── interaction # Interaction commands
477
+ │ ├── click # Click an element
478
+ │ ├── fill # Fill a form field
479
+ │ ├── hover # Hover over an element
480
+ │ ├── press-key # Press a keyboard key
481
+ │ ├── select # Select from dropdown
482
+ │ ├── drag # Drag and drop
483
+ │ ├── scroll # Scroll the page
484
+ │ ├── resize-viewport # Resize viewport
485
+ │ └── resize-window # Resize browser window
486
+ ├── a11y # Accessibility commands
487
+ │ └── take-aria-snapshot # Take ARIA snapshot
488
+ ├── accessibility # Extended accessibility commands
489
+ │ └── take-ax-tree-snapshot # Take AX tree snapshot
490
+ ├── o11y # Observability commands
491
+ │ ├── get-console-messages # Get console logs
492
+ │ ├── get-http-requests # Get HTTP requests
493
+ │ ├── get-web-vitals # Get Web Vitals metrics
494
+ │ ├── get-trace-id # Get current trace ID
495
+ │ ├── new-trace-id # Generate new trace ID
496
+ │ └── set-trace-id # Set trace ID
497
+ ├── react # React debugging commands
498
+ │ ├── get-component-for-element
499
+ │ └── get-element-for-component
500
+ ├── run # Script execution commands
501
+ │ ├── js-in-browser # Run JS in browser
502
+ │ └── js-in-sandbox # Run JS in sandbox
503
+ ├── stub # HTTP stubbing commands
504
+ │ ├── mock-http-response # Mock HTTP responses
505
+ │ ├── intercept-http-request # Intercept requests
506
+ │ ├── list # List stubs
507
+ │ └── clear # Clear stubs
508
+ ├── sync # Synchronization commands
509
+ │ └── wait-for-network-idle # Wait for network idle
510
+ └── figma # Figma integration commands
511
+ └── compare-page-with-design
512
+ ```
513
+
514
+ ### Usage Examples
515
+
516
+ #### Basic Navigation and Screenshot
517
+
518
+ ```bash
519
+ # Navigate to a URL
520
+ browser-devtools-cli navigation go-to --url "https://example.com"
521
+
522
+ # Take a screenshot
523
+ browser-devtools-cli content take-screenshot --name "homepage"
524
+ ```
525
+
526
+ #### Browser Options
527
+
528
+ Configure browser behavior when starting the daemon:
529
+
530
+ ```bash
531
+ # Run browser in headful mode (visible window)
532
+ browser-devtools-cli --no-headless navigation go-to --url "https://example.com"
533
+
534
+ # Use persistent browser context
535
+ browser-devtools-cli --persistent --user-data-dir ./my-profile navigation go-to --url "https://example.com"
536
+
537
+ # Use system Chrome instead of bundled Chromium
538
+ browser-devtools-cli --use-system-browser navigation go-to --url "https://example.com"
539
+
540
+ # Use a custom browser executable
541
+ browser-devtools-cli --browser-path /path/to/chrome navigation go-to --url "https://example.com"
542
+ ```
543
+
544
+ #### Session-Based Workflow
545
+
546
+ Maintain browser state across multiple commands using session IDs:
547
+
548
+ ```bash
549
+ # Start a session and navigate
550
+ browser-devtools-cli --session-id my-session navigation go-to --url "https://example.com"
551
+
552
+ # Interact with the page (same session)
553
+ browser-devtools-cli --session-id my-session interaction click --selector "button.login"
554
+
555
+ # Fill a form
556
+ browser-devtools-cli --session-id my-session interaction fill --selector "#username" --value "user@example.com"
557
+
558
+ # Take a screenshot
559
+ browser-devtools-cli --session-id my-session content take-screenshot --name "after-login"
560
+
561
+ # Clean up session when done
562
+ browser-devtools-cli session delete my-session
563
+ ```
564
+
565
+ #### JSON Output for Scripting
566
+
567
+ Use `--json` and `--quiet` flags for machine-readable output:
568
+
569
+ ```bash
570
+ # Get page content as JSON
571
+ browser-devtools-cli --json --quiet --session-id test navigation go-to --url "https://api.example.com"
572
+
573
+ # Output:
574
+ # {
575
+ # "url": "https://api.example.com/",
576
+ # "status": 200,
577
+ # "statusText": "",
578
+ # "ok": true
579
+ # }
580
+ ```
581
+
582
+ #### Daemon Management
583
+
584
+ ```bash
585
+ # Check daemon status
586
+ browser-devtools-cli daemon status
587
+
588
+ # Start daemon manually
589
+ browser-devtools-cli daemon start
590
+
591
+ # Stop daemon
592
+ browser-devtools-cli daemon stop
593
+
594
+ # Restart daemon (useful when changing browser options)
595
+ browser-devtools-cli daemon restart
596
+
597
+ # Check status with JSON output
598
+ browser-devtools-cli daemon status --json
599
+ # Output: {"status":"running","port":2020}
600
+
601
+ # Get detailed daemon information
602
+ browser-devtools-cli daemon info
603
+ # Output:
604
+ # Daemon Server Information:
605
+ # Version: 0.5.0
606
+ # Port: 2020
607
+ # Uptime: 5m 23s
608
+ # Sessions: 2
609
+ ```
610
+
611
+ #### Session Management
612
+
613
+ ```bash
614
+ # List all active sessions
615
+ browser-devtools-cli session list
616
+ # Output:
617
+ # Active Sessions (2):
618
+ # my-session
619
+ # Created: 2025-01-26T10:00:00.000Z
620
+ # Last Active: 2025-01-26T10:05:30.000Z
621
+ # Idle: 30s
622
+ # #default
623
+ # Created: 2025-01-26T09:55:00.000Z
624
+ # Last Active: 2025-01-26T10:04:00.000Z
625
+ # Idle: 1m 30s
626
+
627
+ # Get info about a specific session
628
+ browser-devtools-cli session info my-session
629
+
630
+ # Delete a session
631
+ browser-devtools-cli session delete my-session
632
+ ```
633
+
634
+ #### Tool Discovery
635
+
636
+ ```bash
637
+ # List all available tools
638
+ browser-devtools-cli tools list
639
+ # Output:
640
+ # Available Tools (35 total):
641
+ #
642
+ # navigation:
643
+ # go-to Navigate the browser to the given URL...
644
+ # go-back Navigate back in browser history
645
+ # ...
646
+
647
+ # Filter tools by domain
648
+ browser-devtools-cli tools list --domain interaction
649
+
650
+ # Search for tools by keyword
651
+ browser-devtools-cli tools search click
652
+ # Output:
653
+ # Tools matching "click" (2 found):
654
+ #
655
+ # interaction/click
656
+ # Clicks an element on the page.
657
+ # ...
658
+
659
+ # Get detailed info about a specific tool
660
+ browser-devtools-cli tools info navigation_go-to
661
+ # Output:
662
+ # Tool: navigation_go-to
663
+ # Domain: navigation
664
+ #
665
+ # Description:
666
+ # Navigate the browser to the given URL...
667
+ #
668
+ # Parameters:
669
+ # --url <string> (required)
670
+ # The URL to navigate to
671
+ # --wait-until <load | domcontentloaded | networkidle> (optional)
672
+ # When to consider navigation succeeded
673
+ # Default: "load"
674
+ #
675
+ # Usage:
676
+ # browser-devtools-cli navigation go-to [options]
677
+ ```
678
+
679
+ #### Configuration
680
+
681
+ ```bash
682
+ # Show current configuration
683
+ browser-devtools-cli config
684
+ # Output:
685
+ # Current Configuration:
686
+ #
687
+ # Daemon:
688
+ # Port: 2020
689
+ # Session Idle (sec): 300
690
+ # Idle Check Interval: 30
691
+ #
692
+ # Browser:
693
+ # Headless: true
694
+ # Persistent: false
695
+ # ...
696
+
697
+ # Show config as JSON
698
+ browser-devtools-cli config --json
699
+ ```
700
+
701
+ #### Verbose/Debug Mode
702
+
703
+ Enable verbose output for troubleshooting:
704
+
705
+ ```bash
706
+ # Run any command with --verbose for detailed debug logs
707
+ browser-devtools-cli --verbose navigation go-to --url "https://example.com"
708
+ # Output:
709
+ # [2025-01-26T10:00:00.000Z] [DEBUG] Verbose mode enabled
710
+ # [2025-01-26T10:00:00.001Z] [DEBUG] CLI version: 0.5.0
711
+ # [2025-01-26T10:00:00.001Z] [DEBUG] Node version: v20.10.0
712
+ # [2025-01-26T10:00:00.001Z] [DEBUG] Platform: darwin
713
+ # [2025-01-26T10:00:00.002Z] [DEBUG] Checking if daemon is running on port 2020
714
+ # [2025-01-26T10:00:00.010Z] [DEBUG] Daemon health check result: running
715
+ # [2025-01-26T10:00:00.011Z] [DEBUG] Calling tool: navigation_go-to
716
+ # [2025-01-26T10:00:00.011Z] [DEBUG] Tool input: { url: "https://example.com" }
717
+ # ...
718
+ ```
719
+
720
+ #### Tool Search
721
+
722
+ Find tools by keyword:
723
+
724
+ ```bash
725
+ # Search for tools related to "screenshot"
726
+ browser-devtools-cli tools search screenshot
727
+ # Output:
728
+ # Tools matching "screenshot" (2 found):
729
+ #
730
+ # content/take-screenshot
731
+ # Takes a screenshot of the current page or a specific element.
732
+ #
733
+ # figma/compare-page-with-design
734
+ # Compares the CURRENT PAGE UI against a Figma design snapshot...
735
+
736
+ # Search for tools related to "network"
737
+ browser-devtools-cli tools search network
738
+ ```
739
+
740
+ #### Shell Completions
741
+
742
+ Enable tab completion for faster command entry. Shell completions require a one-time setup:
743
+
744
+ **For Bash:**
745
+ ```bash
746
+ # Option 1: Add to ~/.bashrc (recommended)
747
+ echo 'eval "$(browser-devtools-cli completion bash)"' >> ~/.bashrc
748
+ source ~/.bashrc
749
+
750
+ # Option 2: Or add manually to ~/.bashrc
751
+ eval "$(browser-devtools-cli completion bash)"
752
+ ```
753
+
754
+ **For Zsh (macOS default):**
755
+ ```bash
756
+ # Option 1: Add to ~/.zshrc (recommended)
757
+ echo 'eval "$(browser-devtools-cli completion zsh)"' >> ~/.zshrc
758
+ source ~/.zshrc
759
+
760
+ # Option 2: Or add manually to ~/.zshrc
761
+ eval "$(browser-devtools-cli completion zsh)"
762
+ ```
763
+
764
+ **Using with npx:**
765
+ ```bash
766
+ # If using npx instead of global install:
767
+ echo 'eval "$(npx -y browser-devtools-cli completion zsh)"' >> ~/.zshrc
768
+ source ~/.zshrc
769
+ ```
770
+
771
+ After setup, press TAB for completions:
772
+ ```bash
773
+ browser-devtools-cli dae<TAB> # Completes to "daemon"
774
+ browser-devtools-cli daemon st<TAB> # Shows "start", "stop", "status", "restart"
775
+ browser-devtools-cli --<TAB> # Shows all global options
776
+ ```
777
+
778
+ #### Interactive REPL Mode
779
+
780
+ Start an interactive session for continuous command entry:
781
+
782
+ ```bash
783
+ # Start in headless mode (default)
784
+ browser-devtools-cli interactive
785
+
786
+ # Start with visible browser window
787
+ browser-devtools-cli --no-headless interactive
788
+
789
+ # Start with persistent context (preserves cookies, localStorage)
790
+ browser-devtools-cli --no-headless --persistent interactive
791
+
792
+ # Aliases
793
+ browser-devtools-cli repl
794
+ browser-devtools-cli --no-headless repl
795
+ ```
796
+
797
+ **Example session:**
798
+
799
+ ```
800
+ Browser DevTools CLI - Interactive Mode
801
+ Type "help" for available commands, "exit" to quit
802
+
803
+ browser> navigation go-to --url "https://example.com"
804
+ url: https://example.com/
805
+ status: 200
806
+ ok: true
807
+
808
+ browser> content take-screenshot --name "homepage"
809
+ path: /path/to/homepage.png
810
+
811
+ browser> interaction click --ref "Login"
812
+ clicked: true
813
+
814
+ browser> interaction fill --ref "Email" --value "test@example.com"
815
+ filled: true
816
+
817
+ browser> tools search screenshot
818
+ Found 2 tools:
819
+ content_take-screenshot - Take a screenshot of the current page
820
+ content_take-pdf - Generate a PDF of the current page
821
+
822
+ browser> daemon info
823
+ Version: 0.5.0
824
+ Uptime: 5m 23s
825
+ Sessions: 1
826
+ Port: 2020
827
+
828
+ browser> session list
829
+ Active sessions: 1
830
+ #default (idle: 30s)
831
+
832
+ browser> config
833
+ Current Configuration:
834
+ port = 2020
835
+ headless = false
836
+ persistent = true
837
+ ...
838
+
839
+ browser> exit
840
+ Goodbye!
841
+ ```
842
+
843
+ **Available commands in interactive mode:**
844
+
845
+ | Command | Description |
846
+ |---------|-------------|
847
+ | `help` | Show available commands |
848
+ | `exit`, `quit` | Exit interactive mode |
849
+ | `status` | Show daemon status summary |
850
+ | `config` | Show current configuration |
851
+ | `daemon <cmd>` | Daemon management (start, stop, restart, status, info) |
852
+ | `session <cmd>` | Session management (list, info, delete) |
853
+ | `tools <cmd>` | Tool discovery (list, search, info) |
854
+ | `update` | Check for CLI updates |
855
+ | `<domain> <tool>` | Execute a tool |
856
+
857
+ #### Check for Updates
858
+
859
+ Keep your CLI up to date:
860
+
861
+ ```bash
862
+ # Check for updates without installing
863
+ browser-devtools-cli update --check
864
+ # Output:
865
+ # Checking for updates...
866
+ #
867
+ # Current version: 0.5.0
868
+ # Latest version: 0.5.1
869
+ #
870
+ # ⚠ Update available: 0.5.0 → 0.5.1
871
+ #
872
+ # To update, run:
873
+ # npm install -g browser-devtools-mcp@latest
874
+
875
+ # Check and install updates interactively
876
+ browser-devtools-cli update
877
+ # Output:
878
+ # ...
879
+ # Do you want to update now? (y/N) y
880
+ # Updating...
881
+ # ✓ Update complete!
882
+ ```
883
+
884
+ #### Shell Script Example
885
+
886
+ ```bash
887
+ #!/bin/bash
888
+ SESSION="test-$(date +%s)"
889
+ CLI="browser-devtools-cli --json --quiet --session-id $SESSION"
890
+
891
+ # Navigate
892
+ $CLI navigation go-to --url "https://example.com"
893
+
894
+ # Get text content
895
+ CONTENT=$($CLI content get-as-text)
896
+ echo "Page content: $CONTENT"
897
+
898
+ # Take screenshot
899
+ $CLI content take-screenshot --name "test-result"
900
+
901
+ # Cleanup
902
+ browser-devtools-cli session delete $SESSION
903
+ ```
904
+
905
+ ### Daemon Architecture
906
+
907
+ The CLI uses a daemon server architecture for efficient browser management:
908
+
909
+ 1. **Auto-start**: The daemon starts automatically when you run any tool command
910
+ 2. **Shared browser**: Multiple CLI invocations share the same browser instance
911
+ 3. **Session isolation**: Each session ID gets its own isolated browser context
912
+ 4. **Auto-cleanup**: Idle sessions are automatically cleaned up after inactivity
913
+
914
+ The daemon listens on port 2020 by default. Use `--port` to specify a different port.
915
+
388
916
  ## Configuration
389
917
 
390
918
  The server can be configured using environment variables:
@@ -1223,6 +1751,71 @@ This server enables AI assistants to:
1223
1751
  9. Extract content using `content_get-as-html` or `content_get-as-text`
1224
1752
  10. Save the page as PDF using `content_save-as-pdf` for documentation
1225
1753
 
1754
+ ## Plugins
1755
+
1756
+ Browser DevTools MCP is available as a plugin for various AI coding assistants.
1757
+
1758
+ ### Claude Code
1759
+
1760
+ A dedicated Claude Code plugin is available with slash commands, skills, and agents for browser automation and testing.
1761
+
1762
+ #### Installation
1763
+
1764
+ ```bash
1765
+ # Add the marketplace
1766
+ /plugin marketplace add https://github.com/serkan-ozal/browser-devtools-mcp
1767
+
1768
+ # Install the plugin
1769
+ /plugin install browser-devtools-mcp@browser-devtools
1770
+ ```
1771
+
1772
+ #### Features
1773
+
1774
+ **Slash Commands (29 commands):**
1775
+ - Navigation: `/browse`, `/back`, `/forward`, `/reload`
1776
+ - Content: `/screenshot`, `/html`, `/text`, `/pdf`
1777
+ - Interaction: `/click`, `/fill`, `/hover`, `/keypress`, `/select`, `/drag`, `/scroll`, `/resize`
1778
+ - Debugging: `/console`, `/network`, `/webvitals`, `/react`
1779
+ - Observability: `/trace`, `/otel`
1780
+ - Testing: `/mock`, `/intercept`, `/wait`
1781
+ - Accessibility: `/accessibility`
1782
+ - Design: `/figma`
1783
+ - Execution: `/run-js`, `/sandbox`
1784
+
1785
+ **Skills (5 skills):**
1786
+ - `browser-testing` - General browser test capabilities
1787
+ - `web-debugging` - Console, network, JS debugging
1788
+ - `performance-audit` - Web Vitals and performance analysis
1789
+ - `visual-testing` - Visual testing and responsive design
1790
+ - `observability` - Distributed tracing and monitoring
1791
+
1792
+ **Agents (5 agents):**
1793
+ - `qa-tester` - Automated QA testing agent
1794
+ - `accessibility-auditor` - WCAG compliance auditor
1795
+ - `performance-analyzer` - Performance analysis agent
1796
+ - `scraper` - Web scraping agent
1797
+ - `design-qa` - Figma design QA agent
1798
+
1799
+ #### Configuration
1800
+
1801
+ The plugin can be configured via environment variables. See [CONFIG.md](plugins/claude/CONFIG.md) for all available options.
1802
+
1803
+ Example configuration in `~/.claude/settings.json`:
1804
+
1805
+ ```json
1806
+ {
1807
+ "mcpServers": {
1808
+ "browser-devtools": {
1809
+ "command": "npx",
1810
+ "args": ["-y", "browser-devtools-mcp@latest"],
1811
+ "env": {
1812
+ "BROWSER_HEADLESS_ENABLE": "false"
1813
+ }
1814
+ }
1815
+ }
1816
+ }
1817
+ ```
1818
+
1226
1819
  ## Contributing
1227
1820
 
1228
1821
  Contributions are welcome! Please feel free to submit a Pull Request.