Skip to content

Instantly share code, notes, and snippets.

@davidar
Created May 23, 2026 01:42
Show Gist options
  • Select an option

  • Save davidar/be59931b655cb4a4c3fb5f064b6f2498 to your computer and use it in GitHub Desktop.

Select an option

Save davidar/be59931b655cb4a4c3fb5f064b6f2498 to your computer and use it in GitHub Desktop.
Playwright MCP with Flatpak Chrome on Linux (real GPU / WebGPU)

Playwright MCP with Flatpak Chrome on Linux (real GPU / WebGPU)

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.

1. Make Playwright find Flatpak Chrome

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/chrome

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

2. Give Flatpak Chrome access to /tmp

Playwright passes --user-data-dir=/tmp/… to Chrome. The Flatpak sandbox needs that directory:

flatpak override --user com.google.Chrome --filesystem=/tmp

3. Force the real GPU (avoid SwiftShader)

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

  1. Playwright launches Chromium in headless mode by default, which skips the discrete GPU.
  2. 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.json

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

Verify

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.

Notes

  • 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-blocklist is 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment