Access chrome while in WSL environment
Is your feature request related to a problem? Please describe.
Codex works far better in a linux based environment thus it's generally recommended if yo are on windows to use WSL. The problem here is this MCP only tries to look for chrome inside the WSL instead of the host system.
Describe the solution you'd like
The MCP server would know it's in WSL and use the host system's chrome
Describe alternatives you've considered
Can use codex for windows but it's not officially supported.
Additional context Add any other context or screenshots about the feature request here.
@OrKoN @jackfranklin It is indeed necessary to consider supporting the windows subsystem.
@ljmerza Could you try to use the --executable-path argument in the MCP server config to pass a custom path to where Chrome is installed?
@OrKoN I just tried it and it didn't work. The wsl subsystem is Ubuntu. If I configure it with this parameter, it's equivalent to using windows chrome across systems. Does the code logic support it? You need to look at the code.
Thanks for checking! I would have expected the ability to run Windows binaries to be a feature of the WSL :) In this case a few other options are possible:
- Starting Chrome manually with
--remote-debugging-port=9222and a custom--user-data-diroutside of WSL and connecting to the running Chrome by specifying--browser-url=http://127.0.0.1:9222in the args for the MCP server. - Installing a Linux Chrome version in WSL (https://support.google.com/chrome/a/answer/9025903?hl=en).
- Installing a Chrome for Testing build in WSL and pointing to it via
--executable-path.npx @puppeteer/browsers install chrome@stablewould install the latest stable build.
We will look into WSL support in general but in code we are just launching sub-processes (and we cannot do much if the environment does not support it) and locating Chrome at the well-known path per OS reported by Node.
@yuwenlong also Chrome is not started in the MCP discovery phase (it is started on the first tool call). The error could be something else. Which gemini-cli version do you use and which node version is it?
Hello, I'm also trying to use the MCP through a DevContainer, can be the same solution for WSL and DevContainer I guess.
I already tried to launch a Chrome instance by using the --browserUrl=http://host.docker.internal:9222, but I got a connection refused that my header isn't an IP with a curl.
So I tried the solution with Puppeteer installation, I give the executable path to the MCP with this configuration:
"chrome-devtools": {
"type": "stdio",
"command": "npx",
"args": [
"chrome-devtools-mcp@latest",
"--executable-path=/workspaces/xxx/chrome/linux_arm-140.0.7339.207/chrome-linux64/chrome",
"--headless",
"--isolated",
"--no-sandbox"
// "--browserUrl=http://host.docker.internal:9222"
]
}
When I'm not using the isolated parameter, I got this error:
When I'm using it, I've got now:
When I'm checking the output of the MCP Server, I don't see any errors :
2025-09-25 08:49:35.039 [info] Discovered 26 tools
2025-09-25 08:50:23.874 [info] Stopping server chrome-devtools
2025-09-25 08:50:23.910 [info] Connection state: Stopped
2025-09-25 08:50:27.460 [info] Starting server chrome-devtools
2025-09-25 08:50:27.461 [info] Connection state: Starting
2025-09-25 08:50:27.467 [info] Starting server from Remote extension host
2025-09-25 08:50:27.493 [info] Connection state: Starting
2025-09-25 08:50:27.494 [info] Connection state: Running
2025-09-25 08:50:28.231 [warning] [server stderr] chrome-devtools-mcp exposes content of the browser instance to the MCP clients allowing them to inspect,
2025-09-25 08:50:28.231 [warning] [server stderr] debug, and modify any data in the browser or DevTools.
2025-09-25 08:50:28.231 [warning] [server stderr] Avoid sharing sensitive or personal information that you do want to share with MCP clients.
2025-09-25 08:50:28.244 [info] Discovered 26 tools
Let me know If I need to open an other issue specifically for DevContainer
If you use containers you should also have required system dependencies installed to run Chrome in the container https://pptr.dev/guides/system-requirements
@yuwenlong also Chrome is not started in the MCP discovery phase (it is started on the first tool call). The error could be something else. Which gemini-cli version do you use and which node version is it?
Thanks for checking. Node 20 is not supported (see https://github.com/ChromeDevTools/chrome-devtools-mcp?tab=readme-ov-file#requirements).
If you use containers you should also have required system dependencies installed to run Chrome in the container https://pptr.dev/guides/system-requirements
I've already installed the needed package but still got the Protocol error (Target.setDiscoverTargets): Target closed
感谢您的检查。Node 20 不受支持(请参阅https://github.com/ChromeDevTools/chrome-devtools-mcp?tab=readme-ov-file#requirements)。
@OrKoN Thank you. node has been upgraded.
It seems to be okay. The mcp configuration is as follows. Let others who have encountered problems take a look:
"chrome-devtools": {
"command": "npx",
"args": [
"-y",
"chrome-devtools-mcp@latest",
"--executable-path=/mnt/c/Program\\ Files/Google/Chrome/Application/chrome.exe"
]
}
@OrKoN I'm still not sure if it can work in actual operation? After all, this is an exe run by ubuntu on windows. It should still not work. After all, it's cross-system!
@yuwenlong please see other possible options in https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/131#issuecomment-3332300428
Note that we will still investigate how we can solve it in a better way without extra manual steps, so thanks a lot for reporting and sharing the details about the setup.
You can use this guide about WSL and GUI apps - https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps#install-support-for-linux-gui-apps It shows how to install Chrome and run it from WSL.
One you install it, the MCP should be able to pick it up automatically. Reminder you need to call at least one tool for the browser to start.
Tested with the following WSL version
From wsl --version
// Version
WSL version: 2.6.1.0
Kernel version: 6.6.87.2-1
WSLg version: 1.0.66
MSRDC version: 1.2.6353
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: **10.0.26100.6584**
From wsl --status:
Default Distribution: Ubuntu
Default Version: 2
Launching chrome with these options is the only way to get the chrome-devtools-mcp to function in a dev container.
google-chrome --headless --remote-debugging-port=9222 --no-sandbox disable-dev-shm-usage --disable-gpu
Combined with:
{ "mcpServers": { "chrome-devtools": { "command": "npx", "args": [ "chrome-devtools-mcp@latest", "--browserUrl", "http://127.0.0.1:9222" ] } } }
Unfortunately, the chrome-devtools mcp doesn't appear to pass along any of those options to chrome.
Thanks for checking! I would have expected the ability to run Windows binaries to be a feature of the WSL :) In this case a few other options are possible:
- Starting Chrome manually with
--remote-debugging-port=9222and a custom--user-data-diroutside of WSL and connecting to the running Chrome by specifying--browser-url=http://127.0.0.1:9222in the args for the MCP server.- Installing a Linux Chrome version in WSL (https://support.google.com/chrome/a/answer/9025903?hl=en).
- Installing a Chrome for Testing build in WSL and pointing to it via
--executable-path.npx @puppeteer/browsers install chrome@stablewould install the latest stable build.We will look into WSL support in general but in code we are just launching sub-processes (and we cannot do much if the environment does not support it) and locating Chrome at the well-known path per OS reported by Node.
Hi @OrKoN, I am in the same case and have tried for 3 days several alternatives, including those you mention. And it did not work, having a chrome exe in the wsl is useless as we cant launch it within the wsl. I cant even run on windows as my repo are Linux only librairies.
@nelyajizi did you try the suggestion in https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/131#issuecomment-3335699730 ?
Update: success!
[!TIP] REQUIREMENTS: single Chrome instance + new profile (
--user-data-dir) + remote debugging port
No matter whether your Chrome is installed on Windows or in WSL2, both work well.
Use Windows as an example:
- Kill all Chrome instances
- Start Chrome with a new profile and enable the remote debugging port
- Access
http://127.0.0.1:9222/json/versionin the opened Chrome window and check the result
- Kill the Chrome instance and start a new one:
taskkill /F /IM chrome.exe
$chrome = "$env:LOCALAPPDATA\Google\Chrome\Application\chrome.exe"
if (-not (Test-Path $chrome)) { $chrome = "C:\Program Files\Google\Chrome\Application\chrome.exe" }
& $chrome --user-data-dir="$env:TEMP\chrome-mcp" --remote-debugging-port=9222 --remote-debugging-address=127.0.0.1 --no-first-run --no-default-browser-check
- Gemini CLI
~/.gemini/settings.jsonRequires--browserUrl=http://localhost:9222and--isolated=true(If Chrome has already been manually started, this parameter is unnecessary):
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": [
"chrome-devtools-mcp@latest",
"--browserUrl=http://localhost:9222",
"--isolated=true" // MCP starts Chrome with a new profile. If you start Chrome manually, that's not required.
]
}
}
}
Thanks for the help ♥️ https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/99#issuecomment-3327349975
[!NOTE] below history
Still struggling :(
Tried installing google-chrome in WSL2, then ran it with google-chrome --no-sandbox --remote-debugging-port=9222.
All we got the Protocol error (Target.setDiscoverTargets): Target closed error.
- Codex:
[mcp_servers.chrome-devtools]
command = "npx"
args = ["chrome-devtools-mcp@latest", "--isolated=true", "--executable-path=/usr/bin/google-chrome"]
- Gemini CLI