# PlayGuard

PlayGuard — an MCP server for Claude Code that proxies browser actions and developer tools through a single connection. Handles Playwright, Figma, and DevTools calls while trimming response token size.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 24 repo stars
- Author: ZenyaDAR
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/ZenyaDAR/PlayGuard
- Updated: 2026-11-10
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/playguard

## What it does

PlayGuard routes requests to multiple upstream MCP servers through a single stdio connection. Playwright MCP comes bundled and active by default, whereas Figma, Chrome DevTools, Shopify Dev, and Context7 activate via environment variables. If an optional server crashes, PlayGuard removes its tools without disrupting the remaining services.

The server optimizes token consumption by compacting DOM accessibility trees, issuing delta updates, and pruning Figma node hierarchies. It also intercepts browser crash errors, restarts the Playwright process in the background, and restores the current URL before returning the result to the agent.

Two standalone tools are provided out of the box: `playguard_a11y_audit` running axe-core and `playguard_compare_design` for visual alignment. Running the package requires Node.js and `npx`.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `FIGMA_MCP_CMD`, `FIGMA_MCP_URL`, `DEVTOOLS_MCP_CMD`, `SHOPIFY_DEV_MCP_CMD`, `CONTEXT7_MCP_CMD` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env FIGMA_MCP_CMD=<FIGMA_MCP_CMD> --env FIGMA_MCP_URL=<FIGMA_MCP_URL> --env DEVTOOLS_MCP_CMD=<DEVTOOLS_MCP_CMD> --env SHOPIFY_DEV_MCP_CMD=<SHOPIFY_DEV_MCP_CMD> --env CONTEXT7_MCP_CMD=<CONTEXT7_MCP_CMD> --transport stdio playguard -- npx -y playguard
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add playguard --env FIGMA_MCP_CMD=<FIGMA_MCP_CMD> --env FIGMA_MCP_URL=<FIGMA_MCP_URL> --env DEVTOOLS_MCP_CMD=<DEVTOOLS_MCP_CMD> --env SHOPIFY_DEV_MCP_CMD=<SHOPIFY_DEV_MCP_CMD> --env CONTEXT7_MCP_CMD=<CONTEXT7_MCP_CMD> -- npx -y playguard
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "playguard": {
            "command": "npx",
            "args": [
                "-y",
                "playguard"
            ],
            "env": {
                "FIGMA_MCP_CMD": "<FIGMA_MCP_CMD>",
                "FIGMA_MCP_URL": "<FIGMA_MCP_URL>",
                "DEVTOOLS_MCP_CMD": "<DEVTOOLS_MCP_CMD>",
                "SHOPIFY_DEV_MCP_CMD": "<SHOPIFY_DEV_MCP_CMD>",
                "CONTEXT7_MCP_CMD": "<CONTEXT7_MCP_CMD>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "playguard": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "playguard"
            ],
            "env": {
                "FIGMA_MCP_CMD": "<FIGMA_MCP_CMD>",
                "FIGMA_MCP_URL": "<FIGMA_MCP_URL>",
                "DEVTOOLS_MCP_CMD": "<DEVTOOLS_MCP_CMD>",
                "SHOPIFY_DEV_MCP_CMD": "<SHOPIFY_DEV_MCP_CMD>",
                "CONTEXT7_MCP_CMD": "<CONTEXT7_MCP_CMD>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e FIGMA_MCP_CMD=<FIGMA_MCP_CMD> -e FIGMA_MCP_URL=<FIGMA_MCP_URL> -e DEVTOOLS_MCP_CMD=<DEVTOOLS_MCP_CMD> -e SHOPIFY_DEV_MCP_CMD=<SHOPIFY_DEV_MCP_CMD> -e CONTEXT7_MCP_CMD=<CONTEXT7_MCP_CMD> playguard npx -y playguard
```
Replace <…> with your own values

## When to use it
- trim token consumption from browser accessibility snapshots
- route Playwright, Figma, and DevTools through one MCP connection
- recover terminated browser sessions without failing the prompt
- perform accessibility audits on active pages using axe-core
- evaluate Figma design nodes against live DOM elements

## Example prompts
- Run an accessibility check on the current page with playguard_a11y_audit
- Match the Figma button design against the live DOM element using playguard_compare_design
- Browse to localhost:3000 and capture the trimmed accessibility tree

## Similar
- [DevTools Regression Investigator](https://affpapa.org/en/nevibecode/agents/devtools-regression-investigator.md) — subagent · ★ 41430 repo stars
- [rca-debugger](https://affpapa.org/en/nevibecode/agents/rca-debugger.md) — subagent · ★ 880 repo stars
- [troubleshooting](https://affpapa.org/en/nevibecode/skills/troubleshooting.md) — skill · 3600 installs
- [clone-website](https://affpapa.org/en/nevibecode/skills/dembrandt-clone-website.md) — skill · 411 installs
- [publish-substack-article](https://affpapa.org/en/nevibecode/skills/publish-substack-article.md) — skill · 611 installs
- [web-perf](https://affpapa.org/en/nevibecode/skills/cloudflare-web-perf.md) — skill · 129400 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
