chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

feat: add browser extension context debugging support

Open Tasktivity opened this issue 3 weeks ago • 1 comments

Summary

Implements browser extension context debugging as requested in #96.

This PR adds the ability for AI coding assistants to inspect, debug, and interact with Chrome extension components including service workers, sidepanels, popups, and extension pages.

New Features

Feature Description
--enableExtensions flag Opt-in to enable extension debugging (avoids token overhead from enumerating extension contexts when not needed)
Extension pages in list_pages Sidepanels, popups, options pages now visible
Service workers section Extension service workers listed separately
open_extension_sidepanel Opens sidepanel in detached popup window for debugging

Scope

This PR implements extension context debugging as requested in #96:

  • Inspecting extension pages, sidepanels, popups, service workers
  • Executing scripts in extension contexts
  • Capturing console messages from extensions
  • DOM interaction with extension UIs

Not Included (Future Work)

  • Extension lifecycle management (install/uninstall/reload/list) - Planned for follow-up PR

Known Chrome Limitations

The following requested features are not technically feasible due to Chrome security restrictions:

  • click_extension_icon - Browser toolbar is outside CDP's accessible viewport (puppeteer#2486)
  • click_extension_context_menu - Context menus are browser UI elements, inaccessible via CDP

These are fundamental browser security constraints, not implementation gaps.

Testing

  • 223/223 unit tests passing
  • Real-world testing with TaskGator extension verified:
    • Sidepanel appears in list_pages
    • select_page works for extension contexts ✓
    • take_snapshot captures extension UI ✓
    • click, fill, hover work on extension elements ✓
    • evaluate_script executes in extension context ✓
    • Settings navigation and theme toggle tested ✓

Usage

# Enable extension debugging
npx @anthropic-ai/claude-code-mcp chrome-devtools --enableExtensions

Partially Addresses #96

Tasktivity avatar Dec 28 '25 03:12 Tasktivity

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Dec 28 '25 03:12 google-cla[bot]

Thanks for the PR but in its current form it does not align with how we plan to engineer it (e.g., re-using and modifying Puppeteer to provide better support for extension objects). We are already working on this feature including the features to support something like open_extension_sidepanel so stay tuned!

OrKoN avatar Jan 12 '26 14:01 OrKoN