How to run Playwright MCP against the Flatpak build of Chrome on Linux, with the real GPU enabled so WebGPU / WebGL hit your discrete GPU instead of SwiftShader.
Assumes you've already got WebGPU working in Flatpak Chrome (the chrome-flags.conf part). This gist is about getting Playwright MCP to drive that same Chrome with the real GPU enabled.
Playwright MCP defaults to the chrome channel and hardcodes the path /opt/google/chrome/chrome. Symlink that to the Flatpak export (which is itself a shell script that does exec /usr/bin/flatpak run … com.google.Chrome "$@"):
sudo mkdir -p /opt/google/chrome
sudo ln -sf /var/lib/flatpak/exports/bin/com.google.Chrome /opt/google/chrome/chromeOn rpm-ostree systems (Silverblue, Bluefin, Kinoite, …) /opt → /var/opt, so this persists across image updates.
No plugin config changes, no wrapper script, no --executable-path — Playwright just finds Chrome at its default path. Trick from thenets.org.
Playwright passes --user-data-dir=/tmp/… to Chrome. The Flatpak sandbox needs that directory:
flatpak override --user com.google.Chrome --filesystem=/tmpBy default, even with --use-angle=vulkan and friends in ~/.var/app/com.google.Chrome/config/chrome-flags.conf, WebGPU still falls back to software:
const adapter = await navigator.gpu.requestAdapter();
adapter.info; // { vendor: "google", architecture: "swiftshader", ... }Two reasons:
- Playwright launches Chromium in headless mode by default, which skips the discrete GPU.
- Playwright's default args include
--enable-unsafe-swiftshader, which lets Chrome pick the software adapter as a "fallback" — and in practice it wins.
Fix: a Playwright MCP config file that disables headless and drops the swiftshader default.
// ~/.config/playwright-mcp/gpu.json
{
"browser": {
"browserName": "chromium",
"launchOptions": {
"headless": false,
"channel": "chrome",
"args": [
"--enable-unsafe-webgpu",
"--use-angle=vulkan",
"--enable-features=Vulkan,VulkanFromANGLE",
"--ignore-gpu-blocklist"
],
"ignoreDefaultArgs": ["--enable-unsafe-swiftshader"]
}
}
}Register the MCP entry pointing at it. For Claude Code:
claude mcp add --scope user playwright -- \
npx @playwright/mcp@latest --config ~/.config/playwright-mcp/gpu.jsonIf you were previously using the bundled playwright@claude-plugins-official plugin, disable it (enabledPlugins in ~/.claude/settings.json) so it doesn't shadow your override.
Restart your MCP client, navigate to https://webgpureport.org/, and re-check the adapter:
const adapter = await navigator.gpu.requestAdapter();
adapter.info; // { vendor: "nvidia", architecture: "lovelace", ... }You should now see your real GPU's vendor/architecture instead of swiftshader.
channel: "chrome"makes Playwright use the system (Flatpak) Chrome rather than its bundled Chromium. Drop it if you'd rather use bundled Chromium — though then the symlink trick is irrelevant too.--ignore-gpu-blocklistis only needed if your driver/distro combo is on Chrome's blocklist; harmless otherwise.- Tested on Fedora Bluefin DX (NVIDIA-Open) with an RTX 4060, but only the Flatpak-specific bits are Linux-only — the swiftshader-override config works anywhere Playwright MCP runs.