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

Feature Request: Support for browser extension development and debugging

Open keleus opened this issue 3 months ago • 17 comments

Goals

The primary goals of these new tools is to enable Chrome Extension debugging for AI Assistants:

  • Manage the extension lifecycle (install, reload, …)
  • Ability to inspect and debug extension components, such as service workers, side panel, and popups.
  • Simulate extension user interactions (e.g. click the extension action, …)

Example prompts

  • Install my extension and open https://example.com. Find out why the reading time is not injected into the page below the first heading.
  • Why does my extension not show a summary of https://example.com in the sidepanel when clicking the extension action?
  • When selecting the first heading on https://example.com, opening my extension popup and clicking "translate text" the translation is not displayed in the popup. Why?

Use cases

  1. Load an extension while in development
  2. Debug extensions via console logs for extension pages (side panel, tabs, popup, offscreen document) and extension context (content scripts, service worker)
  3. Inspect extension state by evaluating scripts in extension pages and contexts
  4. Test an extension by triggering an extension action
  5. Test an extension by simulating user input on extension pages

Features

The following tools should be added to the Chrome DevTools MCP server:

Extension Management

  • list_extensions: Lists all installed extensions, including their name, ID, version, and enabled status.
  • install_extension: Installs an extension.
    • Existing CDP method: Extensions.loadUnpacked
  • uninstall_extension: Uninstalls an enabled extension.
    • Existing CDP method: Extensions.uninstall
  • reload_extension: Reloads an extension to apply any changes.

Extension Debugging

Extension Interaction

  • click_extension_icon: Simulates a click on an extension's browser action or page action icon.
    • Note: Once the extension's popup is open, CDP already exposes the popup as a target, so we can inspect it just like a page.
  • click_extension_context_menu: Simulates a click on an extension’s context menu entry.
  • All input automation tools need to be able to work in an extension context (sidepanel, popup, extension tab page)

Constraints

  • Token usage should not increase when extension debugging is not enabled.

keleus avatar Sep 24 '25 02:09 keleus

I agree, this is the only reason I need a browser-based MCP; it's very important to be able to debug extensions.

djeknet avatar Sep 24 '25 03:09 djeknet

agreeed if you guys solved this my eyes would cry

samthedataman avatar Sep 28 '25 02:09 samthedataman

This means the world to me!

samzong avatar Sep 29 '25 01:09 samzong

Looking forward to it, this function must be a productivity tool

anlijun avatar Sep 29 '25 04:09 anlijun

Extension is needed, although it can be installed one by one after launch the browser manually now, but it's not convenient.

phoenixg avatar Sep 29 '25 12:09 phoenixg

I built this from a fork, even though --load-extension is deprecated. Also documented the technical and security aspects in the README.

https://github.com/usedhonda/chrome-devtools-mcp

usedhonda avatar Sep 29 '25 15:09 usedhonda

All, as a workaround I am launching the browser using the "--load-extension=''" flag and it works well for me.

Tasktivity avatar Oct 07 '25 00:10 Tasktivity

I've put together a list of initial requirements for extension support in the Chrome DevTools MCP server and updated the first comment with it. Feedback is welcome!

Please note that some features can be implement straight away with Puppeteer and CDP, but other require updating Chrome and hence have a much longer time release time (e.g. support for clicking the extension icon).

sebastianbenz avatar Oct 09 '25 14:10 sebastianbenz

I've put together a list of initial requirements for extension support in the Chrome DevTools MCP server and updated the first comment with it. Feedback is welcome!

There are two more actions: Pin and Unpin certain extensions that may be needed.

Below is the result of my discussion with ChatGPT. There may be unreasonable requests, please ignore them. Please select the parts that you think are high priority and adopt them. Maybe these three are helpful: storage_get, storage_set, storage_clear

--ChatGPT--

These are not mentioned in your original requirements, but are essential for full Chrome Extension debugging support in chrome-devtools-mcp.


🧩 Recommended Additional Features (Not in Original Spec)

Category Feature Description
Service Worker Debugging start_service_worker, stop_service_worker, keepalive_service_worker, get_service_worker_state Allow explicit control of the MV3 background Service Worker: start, stop, keep alive, and inspect its current state, wake reason, and recent errors.
Permissions & Content Script Diagnostics show_effective_permissions, test_content_script_match Analyze whether an extension has the required host/API permissions for a given URL and explain why a content script is or isn’t injected.
Side Panel / Popup / Offscreen Control open_side_panel, open_popup, list_offscreen_documents, close_offscreen_document Programmatically open or close Side Panels and Popups, and list or terminate Offscreen Documents for debugging.
Message Passing Diagnostics probe_messaging, list_active_ports, send_message Test communication links between extension contexts (Service Worker, popup, content scripts, side panel) and list active runtime.Port connections.
Network & DeclarativeNetRequest Testing dnr_test_rule, list_dnr_rules Test how specific network requests are modified by DeclarativeNetRequest rules and list all active rule sets (including dynamic rules).
Storage Inspection & Manipulation storage_get, storage_set, storage_clear, dump_data_stores Inspect and modify data in chrome.storage (local/sync/managed) and summarize IndexedDB, CacheStorage, and LocalStorage usage.
Diagnostics & Export list_extension_issues, export_diagnostics Collect and export manifest errors, permission denials, CSP violations, and recent console/network logs into a single reproducible debugging report.
Web Accessible Resources Testing check_web_accessible_resources Check whether a page is allowed to access a given resource from the extension and explain the cause if blocked.

Summary
These additional features fill the main gaps in the current MCP design — enabling deep debugging of Chrome Extensions across Service Worker lifecycle, permissions, context visibility, messaging, network rules, storage state, diagnostic export, and resource accessibility.

anlijun avatar Oct 11 '25 10:10 anlijun

I've put together a list of initial requirements for extension support in the Chrome DevTools MCP server and updated the first comment with it. Feedback is welcome!

Please note that some features can be implement straight away with Puppeteer and CDP, but other require updating Chrome and hence have a much longer time release time (e.g. support for clicking the extension icon).

Hey @sebastianbenz, the list looks great, and features sound very helpful. Thank you!

I wonder if it would be possible to toggle sidebar, and popup views and take screenshots of them too.

onderceylan avatar Oct 19 '25 22:10 onderceylan

This would greatly improve everything, vouch from my side.

ShivaHaze avatar Oct 25 '25 13:10 ShivaHaze

I wonder if it would be possible to toggle sidebar, and popup views and take screenshots of them too.

In which cases would you need this? Afaik in most cases sidepanel and popup are triggered by either the extension icon, context menu or content script. All these should be possible to trigger by the features I've described above. One exception in theory is when opening a popup programmatically (as action.openPopup() does not require a user interaction), but I'm not sure about the use cases for this (in the context of devtools mcp).

sebastianbenz avatar Oct 28 '25 15:10 sebastianbenz

I wonder if it would be possible to toggle sidebar, and popup views and take screenshots of them too.

In which cases would you need this? Afaik in most cases sidepanel and popup are triggered by either the extension icon, context menu or content script. All these should be possible to trigger by the features I've described above. One exception in theory is when opening a popup programmatically (as action.openPopup() does not require a user interaction), but I'm not sure about the use cases for this (in the context of devtools mcp).

My use case is more on debugging automation tools support on extension contexts. Such as opening a sidepanel and getting a snapshot, and a screenshot for debugging and verification during development lifecycle. And, similar for popup.

The features that are listed might already cover those, it looks well thought of.

onderceylan avatar Oct 28 '25 19:10 onderceylan

I wonder if it would be possible to toggle sidebar, and popup views and take screenshots of them too.

In which cases would you need this? Afaik in most cases sidepanel and popup are triggered by either the extension icon, context menu or content script. All these should be possible to trigger by the features I've described above. One exception in theory is when opening a popup programmatically (as action.openPopup() does not require a user interaction), but I'm not sure about the use cases for this (in the context of devtools mcp).

My use case is more on debugging automation tools support on extension contexts. Such as opening a sidepanel and getting a snapshot, and a screenshot for debugging and verification during development lifecycle. And, similar for popup.

The features that are listed might already cover those, it looks well thought of.

I have a situation right now. I would like to enable my agentic coding CLI to take screenshots for automated troubleshooting. It works with web pages, but not with an extension sidebar I am working on.

Tasktivity avatar Nov 13 '25 18:11 Tasktivity

@usedhonda I tried your extension and I can't make it working getting this in OpenAI Codex CLI

• Called chrome-devtools.list_pages({})
  └ Error: tool call error: tool call failed for `chrome-devtools/list_pages`
        Caused by:
            tools/call failed: Transport closed

it does launch chrome instance but it shows warning You are using an unsupported command-line flag: --disable-blink-features=AutomationControlled. Stability and security will suffer. Your extension is missing --chromeArg original extension had, to play with arguments and see if it would fix it. is it only compatible with specific Chrome versions?

P.S. ok, nevermind using "chrome --remote-debugging-port=9222" with "--browser-url=http://127.0.0.1:9222" mcp server argument did the trick for me - I can use extensions now

dmatora avatar Nov 22 '25 09:11 dmatora

Do we think this enhancement will eventually happen? I check the repo literally daily looking for it!

Tasktivity avatar Dec 18 '25 13:12 Tasktivity

It is in the works. We need to land a few changes in Chrome first before we can add it to the MCP server.

sebastianbenz avatar Dec 18 '25 16:12 sebastianbenz