Skip to content

[MCP]: --proxy-server drops credentials written in the URL #43048

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: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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions