Edge and WebView2 in Chrome DevTools MCP
The Chrome DevTools MCP is very useful! Although it is the Chrome DevTools MCP, it supports connecting to pretty much all chromium based browsers. This includes Microsoft Edge and WebView2 with a bit of extra configuration in mcp.json. The tool knows explicitly about Chrome, so you have to specify either the --executablePath for launch scenarios or --userDataDir for auto-connect scenarios.
Edge Launch #
To launch Edge you set the executablePath to point to your Edge binary. For example the following uses the Edge Dev channel on Windows:
"args": [
"--registry",
"https://registry.npmjs.org",
"chrome-devtools-mcp@0.18.1",
// Relevant part next:
"--executablePath=C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe"
]
There are a few different locations where Edge could be installed so you'll need to ensure you have the correct one for your device.
Default Edge install paths (not definitive, may vary based on user configuration, version or group policies):
| OS | Channel | Path |
|---|---|---|
| Windows | Stable | %PROGRAMFILES(X86)%\Microsoft\Edge\Application\msedge.exe |
| Windows | Beta | %PROGRAMFILES(X86)%\Microsoft\Edge Beta\Application\msedge.exe |
| Windows | Dev | %PROGRAMFILES(X86)%\Microsoft\Edge Dev\Application\msedge.exe |
| Windows | Canary | %LOCALAPPDATA%\Microsoft\Edge SxS\Application\msedge.exe |
| macOS | Stable | /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge |
| macOS | Beta | /Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge |
| macOS | Dev | /Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge |
| macOS | Canary | /Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge |
| Linux | Stable | /usr/bin/microsoft-edge |
| Linux | Beta | /usr/bin/microsoft-edge-beta |
| Linux | Dev | /usr/bin/microsoft-edge-dev |
| Linux | Canary | Not available |
Edge Auto-connect #
To auto-connect to Edge, you need to:
- Setup Edge for remote debugging:
- Either use the
--remote-debugging-port=0flag when launching Edge - Or start Edge, navigate to
edge://inspect/#remote-debugging, and enable remote debugging on that page
- Either use the
- And then set the
--user-data-dirto point to the Edge user data directory inmcp.json:
"args": [
"--registry",
"https://registry.npmjs.org",
"chrome-devtools-mcp@0.18.1",
// Relevant part next:
"--autoConnect",
"--user-data-dir=C:\\Users\\davris\\AppData\\Local\\Microsoft\\Edge Dev\\User Data"
]
Default Edge user data directories (not definitive, may vary based on user configuration, version or group policies):
| OS | Channel | Path |
|---|---|---|
| Windows | Stable | %LOCALAPPDATA%\Microsoft\Edge\User Data |
| Windows | Beta | %LOCALAPPDATA%\Microsoft\Edge Beta\User Data |
| Windows | Dev | %LOCALAPPDATA%\Microsoft\Edge Dev\User Data |
| Windows | Canary | %LOCALAPPDATA%\Microsoft\Edge SxS\User Data |
| macOS | Stable | ~/Library/Application Support/Microsoft Edge |
| macOS | Beta | ~/Library/Application Support/Microsoft Edge Beta |
| macOS | Dev | ~/Library/Application Support/Microsoft Edge Dev |
| macOS | Canary | ~/Library/Application Support/Microsoft Edge Canary |
| Linux | Stable | ~/.config/microsoft-edge |
| Linux | Beta | ~/.config/microsoft-edge-beta |
| Linux | Dev | ~/.config/microsoft-edge-dev |
| Linux | Canary | Not available |
WebView2 Auto-connect #
WebView2 is similar to the Edge auto-connect scenario. WebView2 doesn't have a launch scenario because its up to the host app to decide when to create a WebView2.
To auto-connect to WebView2, you need to:
- Setup WebView2 for remote debugging using WebView2 loader overrides:
- Either use WebView2Utilities and follow the How to: Auto open DevTools wiki page but instead of checking the
Auto open DevToolscheckbox, type--remote-debugging-port=0in theArgumentstextbox. - Or manually create a registry value to set the AdditionalBrowserArguments after replacing
appname.exewith the name of your WebView2 host executable.
- Either use WebView2Utilities and follow the How to: Auto open DevTools wiki page but instead of checking the
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Edge\WebView2\AdditionalBrowserArguments]
"appname.exe"="--remote-debugging-port=0"
- And then set the
--user-data-dirto point to the WebView2 user data directory inmcp.json. You'll need to discover the user data directory of the host app. You can use WebView2Utilities to do this as well, by going to theHost Appstab, selecting your running host app, and looking at theUser data folderrow. For WebView2 user data folders, the path should end withEBWebView. This is automatically added by WebView2 so if you are copying the path from source code, you will need to add it yourself.
"args": [
"--registry",
"https://registry.npmjs.org",
"chrome-devtools-mcp@0.18.1",
// Relevant part next:
"--autoConnect",
"--user-data-dir=C:\\Users\\davris\\AppData\\Local\\Packages\\Microsoft.WinUI3ControlsGallery_8wekyb3d8bbwe\\LocalState\\EBWebView"
],
- Previous: WebView2 wv2winrt bug case study