Three Ways to Run Claude Code + Playwright MCP on Fedora
Container-based solutions for Playwright compatibility on Fedora Linux
If you're a Fedora user wanting to use Claude Code with Playwright MCP for browser automation, you've likely encountered compatibility issues. Playwright officially supports only Ubuntu 22.04/24.04 and Debian 12, but there are several containerized approaches that work perfectly on Fedora.
Here are three different methods, from DIY to plug-and-play.
The Problem: Fedora vs. Playwright Compatibility
Playwright's browser automation framework has strict OS requirements. When Fedora users try to install Playwright directly, they encounter missing library dependencies and package manager incompatibilities that make setup frustrating or impossible.
The solution? Containers. Here are three approaches:
Method 1: Build Your Own Ubuntu Toolbox
Best for: Learning the process, full control over the setup
Step 1: Create Ubuntu Toolbox
toolbox create -d ubuntu -r 22.04 playwright
toolbox enter playwright
Step 2: Install Node.js
Follow the official Node.js installation instructions:
# Install Node.js 22.x
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify installation
node --version
npm --version
Step 3: Install Playwright
# Install Playwright
npm install -g playwright @playwright/mcp
# Install browser dependencies
npx playwright install-deps
npx playwright install chrome
Step 4: Configure Claude Code MCP
Exit the toolbox and configure Claude Code on your Fedora host:
exit # Exit toolbox
claude mcp add playwright -s user -- toolbox run -c playwright npx @playwright/mcp@latest
Pros: Full control, understand exactly what's installed Cons: Manual setup, need to maintain updates yourself
Method 2: Use Pre-built Playwright Toolbox Image
Best for: Quick setup with toolbox workflow
Step 1: Create Toolbox with Pre-built Image
toolbox create playwright --image ghcr.io/sbko/playwright-toolbox:latest
Step 2: Configure Claude Code MCP
claude mcp add playwright -s user -- toolbox run -c playwright npx @playwright/mcp@latest
Pros: Instant setup, maintained and updated automatically Cons: Less control, dependency on external image
Method 3: Use Official Docker Playwright MCP
Best for: Minimal setup, Docker workflow preference
Step 1: Configure Claude Code MCP with Docker
claude mcp add playwright -s user docker run -i --rm mcr.microsoft.com/playwright/mcp
Pros: Official Microsoft image, minimal configuration Cons: Headless only (no GUI browser windows), less tested configuration
Note: This approach works only in headless mode based on my testing. I haven't extensively tested all features yet, so your mileage may vary.
Why -s user
?
The -s user
flag makes Playwright available across all your projects (stored in ~/.claude.json
). Without it, you'd need to configure Playwright separately for each project directory. See the Claude Code MCP documentation for more details on server scopes.
Testing Your Setup
Regardless of which method you choose, test your setup with:
claude "Take a screenshot of example.com using MCP Playwright"
Which Method Should You Choose?
- Method 1 (DIY): Choose this if you want to understand the full setup process or need custom modifications
- Method 2 (Toolbox Image): Choose this for the best balance of convenience and functionality, especially if you want GUI browser support
- Method 3 (Official Docker): Choose this if you prefer Docker over toolbox and only need headless browser automation
All three methods solve the Fedora compatibility issue by running Playwright in a supported Ubuntu environment while maintaining seamless integration with your Fedora workflow.