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:pass@127.0.0.1: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.
What's going on?
--proxy-server http://user:pass@host:port(andPLAYWRIGHT_MCP_PROXY_SERVER) loses the credentials.config.ts:331passes the value as{ server }only, andnormalizeProxySettings(server/browserContext.ts:849) rebuilds it asurl.protocol + '//' + url.host, so the userinfo is dropped andusername/passwordstay unset. Against a proxy that needs auth,browser_navigatefails withnet::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_navigatetohttp://site.test/:Proxy-Authorizationreached the proxy--proxy-server http://user:pass@127.0.0.1:PERR_INVALID_AUTH_CREDENTIALS--configwithlaunchOptions.proxy: {server, username, password}--proxy-server http://127.0.0.1:P, proxy not requiring authSo 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 intoproxy.username/proxy.password(decoded) and strip it fromserver. 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
mainat46c9a5331a.