codex icon indicating copy to clipboard operation
codex copied to clipboard

Chrome-Devtools-MCP Error on Linux

Open xochaels opened this issue 3 months ago • 17 comments

What version of Codex is running?

0.46.0

Which model were you using?

gpt-5-codex high

What platform is your computer?

Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Attempting to open Chrome DevTools through the Codex CLI with a headful browser immediately fails. The runtime lacks an X server, so Chromium can’t create a display. The DevTools API returns: Missing X server to start the headful browser. Either set headless to true or use xvfb-run to run your Puppeteer script.

What is the expected behavior?

output form claude code : ● I'll list the pages currently open in Chrome for you. ⎿ # list_pages response
## Pages 0: about:blank [selected]

What do you see instead?

Called chrome-devtools.list_pages({}) └ Missing X server to start the headful browser. Either set headless to true or use xvfb-run to run your Puppeteer script.

Additional information

No response

xochaels avatar Oct 14 '25 07:10 xochaels

I don't think this is Codex related but if it works in another agentic coding tool and not in Codex, feel free to reopen.

gpeal avatar Oct 15 '25 06:10 gpeal

Same thing happens to me as well, I can use chrome-devtools with copilot and claude code but not with codex

irfan798 avatar Oct 15 '25 17:10 irfan798

Same thing here - works in Gemini and Claude Code, but reports the aforementioned error in Codex CLI (Full Permissions granted).

TKasperczyk avatar Oct 15 '25 17:10 TKasperczyk

Could it be related to sandboxing? https://github.com/openai/codex/issues/1124 ?

But there are no more .ts code its written so it could be related to https://github.com/openai/codex/blob/774892c6d7ddbe55bf8862748f9507b03b75c92f/codex-rs/core/src/landlock.rs#L16

irfan798 avatar Oct 15 '25 18:10 irfan798

  1. Configure the browser-url parameter for chrome-devtools mcp
  2. Run the following command to open Chrome. nohup google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-headful --no-first-run --disable-gpu about:blank >/tmp/chrome-launch.log 2>&1 & A workaround to bypass the codex sandbox, even when I use --yolo.

bluebirddm avatar Oct 16 '25 02:10 bluebirddm

I was able to get the following successful result form the Chrome MCP using the prompt:

Please check the LCP of web.dev.

which was suggested by their docs. Could somebody provide more specific set of examples/cases of what isn't working.

The Chrome MCP server is what will execute its chrome commands, not our sandboxed exec tool so the sandbox shouldn't be in play here.

Image

gpeal avatar Oct 17 '25 21:10 gpeal

same thing on ubuntu

timothy-web3-dev avatar Oct 19 '25 00:10 timothy-web3-dev

same thing on ubuntu

Does it work with other coding agents?

gpeal avatar Oct 19 '25 02:10 gpeal

Same thing on Linux Mint, works fine with Claude Code

ReversedK avatar Oct 19 '25 17:10 ReversedK

LMDE7 is the same; both Codex and Claude Code have this issue.

deltabcd avatar Oct 20 '25 05:10 deltabcd

Same thing here - works in Gemini and Claude Code, but reports the aforementioned error in Codex CLI (Full Permissions granted).

LittleTurtle2333 avatar Oct 21 '25 07:10 LittleTurtle2333

  1. Configure the browser-url parameter for chrome-devtools mcp
  2. Run the following command to open Chrome. nohup google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-headful --no-first-run --disable-gpu about:blank >/tmp/chrome-launch.log 2>&1 & A workaround to bypass the codex sandbox, even when I use --yolo.

Thanks, It worked

xochaels avatar Oct 21 '25 15:10 xochaels

@LittleTurtle2333 are you also on Linux?

gpeal avatar Oct 21 '25 16:10 gpeal

@LittleTurtle2333 are you also on Linux?

Yes, I also use a Linux-based system.

LittleTurtle2333 avatar Oct 21 '25 17:10 LittleTurtle2333

  1. Configure the browser-url parameter for chrome-devtools mcp
  2. Run the following command to open Chrome. nohup google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-headful --no-first-run --disable-gpu about:blank >/tmp/chrome-launch.log 2>&1 & A workaround to bypass the codex sandbox, even when I use --yolo.

Thanks, It worked

What parameter should be used for the browser-url?

Just gotta it: "--browser-url=http://127.0.0.1:9222"

tonyho avatar Nov 07 '25 06:11 tonyho

Using the following to set up the mcp seems to work

[mcp_servers.chrome-devtools] command = "bash" args = [ "-lc", "DISPLAY=:1 XAUTHORITY=$HOME/.Xauthority npx -y chrome-devtools-mcp@latest --isolated" ]

csmashe avatar Dec 06 '25 16:12 csmashe

[mcp_servers.chrome-devtools]
command = "npx"
args = ["chrome-devtools-mcp@latest", "--executablePath", "/usr/bin/chromium", "--headless", "--isolated"]
env = {}

This is what worked for me on opensuse. It seems to work fine with headless.

kleinhenz avatar Dec 16 '25 19:12 kleinhenz

I have same issue on wayland ... seem like mcp exec in sandbox and no idea to lanuch chrome

StrayDragon avatar Dec 30 '25 08:12 StrayDragon

Same issue on wayland. I'm using Manjaro.

dushaoshuai avatar Jan 02 '26 06:01 dushaoshuai