Skip to content

fix(mcp): support remoteHeaders for remote browser endpoint#40828

Merged
yury-s merged 2 commits into
microsoft:mainfrom
yury-s:fix-40814
May 13, 2026
Merged

fix(mcp): support remoteHeaders for remote browser endpoint#40828
yury-s merged 2 commits into
microsoft:mainfrom
yury-s:fix-40814

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented May 13, 2026

Summary

  • Adds browser.remoteHeaders config option (and --remote-header CLI flag / PLAYWRIGHT_MCP_REMOTE_HEADERS env var) to forward custom headers when MCP/CLI connects to a Playwright run-server endpoint.
  • Lets the client send x-playwright-browser so the remote can select a browser type, fixing the Cannot read properties of undefined (reading 'launch') failure.

Fixes #40814

yury-s added 2 commits May 13, 2026 14:50
Allows the MCP/CLI client to forward custom headers (e.g.
`x-playwright-browser`) when connecting to a Playwright `run-server`
endpoint, which previously failed because no browser type was
specified.

Fixes: microsoft#40814
Remote server connection is browser-agnostic, so running the same test
against every mcpBrowser project just burns CI time.
@yury-s yury-s merged commit c0bcc84 into microsoft:main May 13, 2026
14 of 17 checks passed
@yury-s yury-s deleted the fix-40814 branch May 13, 2026 22:24
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

6 failed
❌ [chrome] › mcp/annotate.spec.ts:57 › should capture multiple screenshots in one annotation @mcp-windows-latest-chrome
❌ [chrome] › mcp/annotate.spec.ts:367 › should cancel browser_annotate when the MCP request is aborted @mcp-windows-latest-chrome
❌ [chromium] › mcp/annotate.spec.ts:297 › should annotate via direct browser_annotate MCP call @mcp-windows-latest-chromium
❌ [webkit] › mcp/annotate.spec.ts:137 › should abort MCP annotation when last screenshot is removed @mcp-windows-latest-webkit
❌ [webkit] › mcp/annotate.spec.ts:273 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest-webkit
❌ [webkit] › mcp/annotate.spec.ts:367 › should cancel browser_annotate when the MCP request is aborted @mcp-windows-latest-webkit

7080 passed, 1104 skipped


Merge workflow run.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

playwright-cli remoteEndpoint does not forward browserName to run-server

2 participants