codex icon indicating copy to clipboard operation
codex copied to clipboard

Windows - Playwright MCP issue

Open tomasmarekk opened this issue 1 year ago • 4 comments

What version of Codex is running?

0.23.0

Which model were you using?

gpt-5

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

I understand that Codex CLI on Windows isn’t ideal, but it would be great if you could fix the Playwright MCP functionality as soon as possible, since it’s one of the most important MCP servers for AI development.

I’m not sure whether this affects other Codex MCP configurations on Windows, but I’m having trouble setting up this MCP correctly. I’ve tried many options and I keep getting the following error in Codex:

Prompt: "go to http://localhost:3000/ and investigate Next.js error."

tool failed, duration: 3ms
playwright.browser_navigate({"url":"http://localhost:3000/"})
### ResultError: listen UNKNOWN: unknown error 0.0.0.0

This is my config.toml file:

[mcp_servers.playwright]
command = "C:\\Program Files\\nodejs\\node.exe"
args = ["C:\\Users\\xxxx\\AppData\\Roaming\\npm\\node_modules\\@playwright\\mcp\\cli.js", "--headless", "--browser", "chromium"]

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

tomasmarekk avatar Aug 20 '25 09:08 tomasmarekk

So I found a way to configure config.toml so that Playwright MCP works in the Windows binary without any problems.

I had to add this .env structure, and after that everything works great.


[mcp_servers.playwright]
command = "C:\\Program Files\\nodejs\\node.exe"
args = ["C:\\Users\\xxxx\\AppData\\Roaming\\npm\\node_modules\\@playwright\\mcp\\cli.js"]
[mcp_servers.playwright.env]
LOCALAPPDATA = 'C:\Users\xxxx\AppData\Local'
APPDATA = 'C:\Users\xxxx\AppData\Roaming'
PROGRAMFILES = 'C:\Program Files'
"PROGRAMFILES(X86)" = 'C:\Program Files (x86)'
SYSTEMROOT = 'C:\Windows'
WINDIR = 'C:\Windows'
HOMEDRIVE = 'C:'
HOMEPATH = '\Users\xxxx'
HOME = 'C:\Users\xxxx'

I understand you’re probably still tweaking Windows support, so let me know if anything changes and I’ll update it again 👍

tomasmarekk avatar Aug 21 '25 00:08 tomasmarekk

Thanks for posting a fix/workaround @marektomas-cz

gpeal avatar Sep 03 '25 16:09 gpeal

FYI -- If someone lands here looking for workaround until fixed.

I've tested workaround and got it working with just one playwright env needed on Windows 11

[mcp_servers.playwright] command = "C:\\Users\\xxxxx\\AppData\\Roaming\\npm\\npx.cmd" args = ["@playwright/mcp@latest"]

[mcp_servers.playwright.env] SYSTEMROOT = 'C:\Windows'

mikekidder avatar Sep 05 '25 04:09 mikekidder

FYI -- If someone lands here looking for workaround until fixed.

I've tested workaround and got it working with just one playwright env needed on Windows 11

[mcp_servers.playwright] command = "C:\Users\xxxxx\AppData\Roaming\npm\npx.cmd" args = ["@playwright/mcp@latest"]

[mcp_servers.playwright.env] SYSTEMROOT = 'C:\Windows'

@mikekidder thank you very much! Countless hours I tried to solve this under Windows 11. But only your solutions brought success.

This is my config.toml

[projects."C:/Users/xxxxx"] trust_level = "trusted"

[mcp_servers.playwright] command = 'C:\Program Files\nodejs\npx.cmd' args = ["-y", "@playwright/mcp@latest", "--extension", "--browser", "chrome", "--executable-path", "C:\Program Files\Google\Chrome\Application\chrome.exe", "--timeout-navigation", "30000", "--timeout-action", "10000", "--image-responses", "omit"]

[mcp_servers.playwright.env] SYSTEMROOT = 'C:\Windows'

berlinjudas avatar Sep 10 '25 08:09 berlinjudas