playwright-mcp-wsl
Drop-in WSL-safe wrapper for @playwright/mcp that prevents Chromium GPU crashes on Windows Subsystem for Linux.
README
playwright-mcp-wsl
Drop-in WSL-safe wrapper for @playwright/mcp. Prevents Chromium GPU crashes on Windows Subsystem for Linux.
The Problem
Running Claude Code (or any Playwright-based browser automation) on WSL2 with parallel browser sessions causes cascading crashes:
- Chromium tries to allocate GPU memory through WSL's
dxgbridge - Multiple browser instances exhaust GPU memory allocations
- Chrome processes SEGFAULT (signal 11)
- Crash cascade takes down the entire WSL instance
This is invisible to users — WSL just "crashes" or "freezes" with no clear error.
The Fix
This package wraps @playwright/mcp and automatically injects GPU-safe flags when running on WSL:
--disable-gpu
--disable-software-rasterizer
--disable-dev-shm-usage
On non-WSL systems, it passes through to @playwright/mcp unchanged. No performance impact — GPU acceleration is meaningless for headless browser automation.
Installation
Claude Code (recommended)
Add to your Claude Code settings (.claude/settings.json or global settings):
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["playwright-mcp-wsl@latest"]
}
}
}
This replaces the default @playwright/mcp entry.
Manual / Other MCP Hosts
npx playwright-mcp-wsl@latest
All @playwright/mcp CLI flags are supported:
npx playwright-mcp-wsl@latest --headless --viewport-size 1440x900
Programmatic
const { createConnection } = require('playwright-mcp-wsl');
// Same API as @playwright/mcp, with WSL-safe defaults
How It Works
- Detects WSL by reading
/proc/versionfor Microsoft/WSL kernel strings - If WSL: sets
PLAYWRIGHT_MCP_CONFIGto a bundled config that adds--disable-gpuand related flags to Chromium launch args - If not WSL: passes through to
@playwright/mcpwith zero modifications - If user has custom config: merges WSL-safe args into existing config (no overwrite)
What It Disables
| Flag | Why |
|---|---|
--disable-gpu |
Prevents GPU memory allocation through the dxg bridge |
--disable-software-rasterizer |
Prevents fallback software GPU that still uses dxg |
--disable-dev-shm-usage |
Uses /tmp instead of /dev/shm (often undersized on WSL) |
What It Doesn't Affect
- Page rendering quality (identical for headless automation)
- JavaScript execution
- Network requests
- Screenshot quality
- DOM interaction
- Any Playwright MCP functionality
Compatibility
- WSL1 and WSL2
- Windows 10 and Windows 11
- Node.js 18+
- All
@playwright/mcpversions >= 0.0.60 - Claude Code, Cursor, Windsurf, or any MCP-compatible host
Verifying It Works
When running on WSL, you'll see in stderr:
[playwright-mcp-wsl] Detected WSL2 + dxg bridge. Injecting GPU-safe config.
When running on non-WSL:
[playwright-mcp-wsl] Not running in WSL. Passing through to @playwright/mcp.
Background
This package was created after diagnosing cascading WSL crashes during parallel browser automation with Claude Code's PAI system. The root cause was Chromium's GPU memory allocation through WSL2's dxg (DirectX Graphics) bridge — a kernel-level GPU passthrough layer not designed for concurrent headless browser load.
Crash signature in dmesg:
misc dxg: dxgk: dxgvmb_send_create_allocation: send_create_allocation failed ffffffb5
misc dxg: dxgk: dxgkio_create_allocation: Ioctl failed: -75
chrome: potentially unexpected fatal signal 11
WSL (CaptureCrash): Capturing crash for pid: ..., executable: chrome, signal: 11
License
Apache-2.0 — same as Playwright.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。