Repository navigation
fix(mcp): launch the browser MCP from playwright-mcp, not npx - #331
Conversation
96d2784 to
fe5748e
Compare
BaaRai
left a comment
There was a problem hiding this comment.
The fix itself is right: the global binary avoids the registry, --browser chromium matches the image, and the one-time migration leaves custom commands alone. Two things before merge.
- CI does not build the Docker image, so the new
node ... playwright-core/cli.js install chromiumline is the only part I cannot verify from the diff. Please paste the successfuldocker buildline for that invocation, on the same base image. - The rewrite includes explicitly pinned
npx @playwright/mcp@versionrows, which silently move them to the image's global build. Either say so in the CHANGELOG or leave pinned rows alone. A custom image that ships Chrome also gets--browser chromiumonce; document that in the migration note.
fe5748e to
c9e030b
Compare
|
One correction to the Dockerfile, pushed as f6e9b75. The It now runs the binary npm links for @playwright/mcp, which is the copy MCP actually loads: Verified with a full |
BaaRai
left a comment
There was a problem hiding this comment.
The Docker line is fixed and proven: both Chromium builds are in the image and MCP own playwright-core launches 155.0.8059.12. Approving.
npx @playwright/mcp queries the npm registry on every start even with the package installed globally, so the image's pin did not decide what ran and offline starts failed. Seed playwright-mcp --headless --browser chromium, rewrite leftover stock npx rows once, and install the Chromium build the MCP's own playwright-core expects. Fixes BaaRai#329
The stock seed was npx @playwright/mcp, but the UI mock and common invocations use npx -y, which the first pass left untouched. Also add --browser chromium to a leftover playwright-mcp --headless row, resolve the MCP's playwright-core CLI via require.resolve, and cover proxy-arg stripping so capture sync does not depend on args[0].
playwright-core's exports map does not expose ./cli.js, so require.resolve threw inside the command substitution, the outer node got an empty script path, and the build still succeeded without installing chromium v1247. Run the binary npm links for @playwright/mcp instead. Verified with docker build: both v1247 and v1248 are in the cache, and @playwright/mcp's playwright-core launches 155.0.8059.12.
f6e9b75 to
5a4af1b
Compare
npx @playwright/mcphits the npm registry on every start even with the global install, so the image pin is not what runs and offline/egress-filtered starts fail. Playwright MCP then defaults to the chrome channel, and its playwright-core wants Chromium 1247 whileplaywright installputs 1248 in the cache.playwright-mcp --headless --browser chromiumnpx @playwright/mcprows once (browser_mcp_direct_bin_v1), including the common-yform; aplaywright-mcprow with no--browsergets--browser chromium; any other command or package is left alone@playwright/mcp's playwright-core (resolved viarequire.resolve)syncBrowserMCPProxy/ stdio spawn do not assumeargs[0]is npxTested:
go test ./db ./server -run TestRewriteStockNpxBrowserMCP|TestRewriteBrowserMCPRow|TestStripProxyArgsLeavesBrowserMCPFlagspass. PG migrate tests skipped (no DSN). Did not rebuild the image.Fixes #329