Repository navigation
Description
What's going on?
--proxy-server http://user:pass@host:port (and PLAYWRIGHT_MCP_PROXY_SERVER) loses the credentials. config.ts:331 passes the value as { server } only, and normalizeProxySettings (server/browserContext.ts:849) rebuilds it as url.protocol + '//' + url.host, so the userinfo is dropped and username/password stay unset. Against a proxy that needs auth, browser_navigate fails with net::ERR_INVALID_AUTH_CREDENTIALS, although no credentials were ever sent.
Repro, offline: a local proxy on 127.0.0.1 that answers 407 to a request without Proxy-Authorization, MCP driven over stdio, browser_navigate to http://site.test/:
| setup | Proxy-Authorization reached the proxy |
result |
|---|---|---|
--proxy-server http://user:[email protected]:P |
no | ERR_INVALID_AUTH_CREDENTIALS |
--config with launchOptions.proxy: {server, username, password} |
yes | page loads |
--proxy-server http://127.0.0.1:P, proxy not requiring auth |
no | page loads |
So with an authenticated proxy only the config file works, and the README does not say so.
Suggested fix: when parsing --proxy-server, move the URL's userinfo into proxy.username / proxy.password (decoded) and strip it from server. Playwright already authenticates from those fields. I can send a PR with a test if you want it.
Version
@playwright/mcp 0.0.83 (playwright 1.64.0-alpha-1790635538000), Chromium 151.0.7922.34, Windows 10. Source lines from main at 46c9a5331a.
Activity
chore: mark v0.1.23 (#494)