Playwright MCP on Linux Mint stays headless and never shows a browser window

Resolved 💬 3 comments Opened Oct 3, 2025 by mion-kr Closed Dec 25, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.42.0

Which model were you using?

gpt-5-codex

What platform is your computer?

Linux 6.8.0-84-generic x86_64 x86_64 (Linux Mint 22.1)

What steps can reproduce the bug?

  1. Start a codex exec session on Linux Mint 22.1 with Codex CLI 0.42.0 inside a project directory.
  2. Ensure the Playwright MCP (npx @playwright/mcp@latest) is registered; then ask the Codex agent to open any URL

via browser_navigate, e.g., http://localhost:3000.

  1. Observe that Codex returns DOM snapshots/logs, but no GUI browser window is rendered on the desktop.
  2. Run the same URL locally via npx playwright test --headed (or npx playwright codegen) on the same machine; note

that a Chromium window appears immediately, proving the local environment supports headful Playwright.

What is the expected behavior?

Codex only returns textual snapshots and never launches a visible window;

What do you see instead?

Codex only returns textual snapshots and never launches a visible window; system process lists and window managers
show no Chromium/Firefox instance tied to the user session, even though manual headed runs work.

Additional information

The MCP list shows the Playwright server as npx @playwright/mcp@latest. Playwright MCP Bridge is installed,
but Codex sessions still stay headless. Other agents (e.g., Claude Code) on the same machine can spawn headed
Playwright sessions, so the limitation seems specific to Codex MCP.

View original on GitHub ↗

3 Comments

etraut-openai contributor · 8 months ago

I think this bug is stale and no longer relevant. If you're still seeing the problem, let us know and I'll reopen.

psychananaz · 8 months ago

The problem is that Codex does not pass the DISPLAY environment variable to stdio servers by default.
You must explicitly include DISPLAY in the env_args section of your MCP configuration.

https://developers.openai.com/codex/mcp/#stdio-servers

simonegiacomelli · 7 months ago

Just for reference, below the excerpt that fixed the issue for me.

Pertinent section from ~/.codex/config.toml:

[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]
env_vars = ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR"]