Repository navigation
fix(claude-code): make Playwright MCP work in both image variants (#85) - #86
Merged
Merged
Conversation
Plugin defaults to the chrome channel (/opt/google/chrome/chrome), which neither variant ships. Adds chromium to sandbox (firewall blocks runtime install), patches every cached .mcp.json to launch /usr/bin/chromium with --no-sandbox --headless, and re-runs the patch on postStartCommand so plugin auto-updates between sessions don't silently regress.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes the Playwright MCP plugin (
playwright@claude-plugins-official) so it can launch a browser in bothclaude-codeandclaude-code-sandboximages, and survives plugin auto-updates.Closes #85.
Why
@playwright/mcpdefaults to thechromechannel, which hard-codes/opt/google/chrome/chrome— neither variant ships that. The existing ARM64 patch ininit-plugins.sh(#64) only ran on aarch64, only atpostCreateCommand, andfind -print -quitpatched only the first cached.mcp.json, so plugin auto-updates between sessions silently broke MCP. Sandbox additionally lacked chromium entirely and couldn't recover at runtime (firewall blocksdeb.debian.org).One factual correction relative to the issue:
--browser chromiumis not rejected by current@playwright/mcp(v0.0.71) — upstream's own canonical Dockerfile usescli.js --headless --browser chromium --no-sandbox. The flag is kept in the patched config.Changes
fonts-freefont-ttfnow installed in thesandboxstage too, with the samePLAYWRIGHT_*env vars asdefault. Updated the stale "kept lean" comment in the default stage.patch-playwright-mcp.sh(new): idempotent script that loops every~/.claude/plugins/cache/*/playwright*/.mcp.jsonand rewrites the args to--browser chromium --executable-path /usr/bin/chromium --no-sandbox --headless. No-op if/usr/bin/chromiumis missing.init-plugins.sh: removed the ARM64-only block; delegates to the new patch script (universal across arches).devcontainer.json(default): addedpostStartCommandinvoking the patch script.claude-sandbox/devcontainer.json: appended the patch to the existing firewallpostStartCommand.claude-code/.devcontainer/*.sh(per.claude/rules/workflows.md)..mcp.jsonshape, updated layout diagram and the "Default-only" callout.Notes
/usr/local/bin/playwright-mcp-launcher. Skipped here in favor of inlining the canonical flags directly into the patched.mcp.json— fewer moving parts, and the actual flags are visible to anyone debugging.mcp__plugin_playwright_playwright__browser_navigateagainstabout:blank).Test plan
claude-code:latestcontainer: install Playwright plugin, confirmcat ~/.claude/plugins/cache/claude-plugins-official/playwright/*/.mcp.jsonshows the patched argsclaude-code-sandbox:latestcontainer: same check; confirm/usr/bin/chromium --versionworks post-firewallmcp__plugin_playwright_playwright__browser_navigatetoabout:blank— succeeds (no "Chromium distribution 'chrome' is not found").mcp.jsoninto a fresh cache dir, restart container, confirmpostStartCommandre-patched it