# WebPerf Snippets

WebPerf Snippets runs 56 web performance diagnostics snippets in headless Chromium: measures LCP, CLS, INP and their subparts, analyzes resources and render.

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

## What it does

The server gives the agent commands to run snippets from the webperf-snippets.net collection via Playwright. Measures Core Web Vitals (LCP, CLS, INP) and breakdowns: TTFB, render delays, blocking resources, long tasks, LoAF script attribution. Built-in workflows: `core-web-vitals` (LCP and CLS, LCP subparts if threshold is exceeded), `loading` (11 steps: TTFB, FCP, blocking resources, cache), `interaction` (tasks, animation frames, scroll, shifts), `audit` (22 CI checks: compression, fonts, images, DOM size).

Compares measurements with CrUX field data (real user experience at 75th percentile). Needs a Chrome UX Report API key, passed as `CRUX_API_KEY` during install. Playwright and the chromium browser install separately: `npm install --save-dev playwright && npx playwright install chromium`.

Pages behind a login open via storage state (cookies and localStorage), behind a proxy via `--header` flags. Interaction scripts for INP are passed with `--interact-script`.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `CRUX_API_KEY` — 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 webperf-snippets -e CRUX_API_KEY=<CRUX_API_KEY> -- npx -y webperf-snippets
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add cli --env CRUX_API_KEY=<CRUX_API_KEY> -- npx -y webperf-snippets
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "cli": {
            "command": "npx",
            "args": [
                "-y",
                "webperf-snippets"
            ],
            "env": {
                "CRUX_API_KEY": "<CRUX_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "cli": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "webperf-snippets"
            ],
            "env": {
                "CRUX_API_KEY": "<CRUX_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e CRUX_API_KEY=<CRUX_API_KEY> cli npx -y webperf-snippets
```
Replace <…> with your own values

## When to use it
- measure Core Web Vitals (LCP, CLS, INP) in a headless browser for CI
- diagnose LCP regressions via subparts (TTFB, Resource Load Delay, Element Render Delay)
- check blocking resources, long tasks and LoAF script attribution
- compare synthetic measurements with real user data from CrUX
- automate DevTools snippets in a CI pipeline

## Example prompts
- Run Core Web Vitals measurement for example.com and compare with CrUX data
- Run the loading workflow on the site and output results as markdown
- Measure INP on a page with interactions from `interactions.json`

## Similar
- [Web Performance taste](https://affpapa.org/en/nevibecode/prompts/web-performance-taste.md) — prompt · ★ 178454 repo stars
- [web-performance-skills](https://affpapa.org/en/nevibecode/plugins/web-performance-skills.md) — plugin · ★ 1218 repo stars
- [performance](https://affpapa.org/en/nevibecode/skills/performance.md) — skill · 438 installs
- [seo-performance](https://affpapa.org/en/nevibecode/agents/seo-performance.md) — subagent · ★ 161 repo stars
- [browser-and-app-testing-tools](https://affpapa.org/en/nevibecode/plugins/browser-and-app-testing-tools.md) — plugin · ★ 96 repo stars
- [Frontend Performance Investigator](https://affpapa.org/en/nevibecode/agents/frontend-performance-investigator.md) — subagent · ★ 41529 repo stars

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