Agent CLI with chrome-devtools-mcp using chrome in headless mode broken

Hey @Marlou!

I don’t quite have the setup to reproduce this on yet, but I dug into the code and have a theory.

The issue might be that DISPLAY (and other X11 env vars) aren’t being passed to your MCP server. When Cursor spawns MCP servers, it inherits the full shell environment, including environment variables, but the agent CLI doesn’t. It only passes variables explicitly defined in your mcp.json config.

This would explain why the agent sees “DISPLAY is set” when checking via shell, but the MCP server itself can’t access it.

Try adding the X11 vars explicitly to your config:

{
  "mcpServers": {
    "chrome-devtools-mcp": {
      "command": "npx",
      "args": ["-y", "chrome-devtools-mcp"],
      "env": {
        "DISPLAY": ":0",
        "XAUTHORITY": "/run/user/1000/.Xauthority"
      }
    }
  }
}

You can get the actual values for your system with:

echo $DISPLAY
echo $XAUTHORITY

Let me know if that helps at all!