Skip to content

Conversation

@Tasktivity
Copy link

@Tasktivity Tasktivity commented Dec 28, 2025

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

@google-cla
Copy link

google-cla bot commented Dec 28, 2025

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.

@Tasktivity Tasktivity force-pushed the feature/extension-debugging branch from 314d2df to 92ab6b3 Compare December 28, 2025 04:19
Add --enableExtensions flag to enable debugging of Chrome extension contexts.

New capabilities:
- Extension pages (sidepanels, popups, options pages) visible in list_pages
- Service workers listed in dedicated section
- New open_extension_sidepanel tool to open sidepanel in detached window
- Full debugging support: snapshots, console, script evaluation

Due to Chrome security requirements, chrome.sidePanel.open() requires a user
gesture and cannot be triggered via CDP. The open_extension_sidepanel tool
uses chrome.windows.create() as the standard workaround, opening the sidepanel
in a detached popup window with identical code execution.

Partially Addresses ChromeDevTools#96
@Tasktivity Tasktivity force-pushed the feature/extension-debugging branch from 92ab6b3 to ed85500 Compare December 28, 2025 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant