# WebPerf Snippets

> WebPerf Snippets is an open-source MCP server for browser automation. Run 56 web performance snippets in headless Chromium and read Core Web Vitals results. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Web
- **Website:** https://webperf-snippets.net
- **Repository:** https://github.com/nucliweb/webperf-snippets/tree/HEAD/cli
- **MCP Registry name:** io.github.nucliweb/webperf-snippets
- **Categories:** browser automation, developer tools
- **Listing updated:** 2026-11-14

## About

WebPerf Snippets began as a collection of JavaScript snippets you paste into DevTools; this package runs the same code through Playwright so an agent or a CI job gets the same result each time. The collection spans Core Web Vitals (LCP with subparts, CLS, INP), loading checks (TTFB, render-blocking resources, preloads, fonts, bfcache), interaction diagnostics (long animation frames, long tasks, input latency) and media audits.

The README positions it beside Lighthouse: Lighthouse gives a score, the snippets give the diagnosis, such as the LCP sub-part that is slow or which script blocked a frame. A default workflow runs LCP and CLS and adds sub-parts when LCP passes 2.5 seconds; other workflows run an 11-step loading audit and a 22-check structural audit. Output can be JSON or Markdown for pull-request comments.

Install the npm package with Playwright and Chromium. Field data through get_crux needs an optional Chrome UX Report API key; the other tools do not.

## Features

- **56 snippets:** Curated Core Web Vitals, loading, interaction and media diagnostics.
- **Workflows:** Default, loading and audit runs for common cases.
- **CI-friendly output:** JSON and Markdown results for budgets and PR comments.
- **Third-party analysis:** Separate first- and third-party scripts, with own-domain overrides.
- **Field data option:** Pull Chrome UX Report data with an API key.
- **Same code as DevTools:** Run the identical snippets manually in the console.

## Good for

- Diagnose an LCP regression after a deploy
- Gate pull requests on performance budgets
- Find render-blocking resources and lazy-loading mistakes
- Attribute long animation frames to scripts
- Compare lab results with CrUX field data

## Install

### Claude Code (Terminal)

```sh
claude mcp add webperf-snippets --env CRUX_API_KEY='<CRUX_API_KEY>' -- npx -y webperf-snippets
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "webperf-snippets": {
      "command": "npx",
      "args": [
        "-y",
        "webperf-snippets"
      ],
      "env": {
        "CRUX_API_KEY": "<CRUX_API_KEY>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "webperf-snippets": {
      "command": "npx",
      "args": [
        "-y",
        "webperf-snippets"
      ],
      "env": {
        "CRUX_API_KEY": "<CRUX_API_KEY>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "webperf-snippets": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "webperf-snippets"
      ],
      "env": {
        "CRUX_API_KEY": "<CRUX_API_KEY>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "webperf-snippets": {
      "command": "npx",
      "args": [
        "-y",
        "webperf-snippets"
      ],
      "env": {
        "CRUX_API_KEY": "<CRUX_API_KEY>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "webperf-snippets": {
      "command": "npx",
      "args": [
        "-y",
        "webperf-snippets"
      ],
      "env": {
        "CRUX_API_KEY": "<CRUX_API_KEY>"
      }
    }
  }
}
```

## Tools

- `get_crux`: Chrome UX Report field data; needs a CRUX_API_KEY.

## FAQ

### What do I need installed?

The npm package, Playwright and a Chromium build.

### Is an API key required?

Only for get_crux field data; the other tools work without it.

### How does it differ from Lighthouse?

It reports the diagnosis behind a score, per the README.

### Can I run it without an agent?

Yes, the same snippets work in DevTools or from the CLI.

### Is WebPerf Snippets free?

Yes. WebPerf Snippets is open source, so you can use and self-host it for free.

### How do I add WebPerf Snippets to Claude Code?

Run this command in your terminal: claude mcp add webperf-snippets --env CRUX_API_KEY='<CRUX_API_KEY>' -- npx -y webperf-snippets

### What are the best alternatives to WebPerf Snippets?

The closest alternatives to WebPerf Snippets are REA, Browser Use, Scrapling MCP Server, Codebase Memory and GitHub.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Browser Use](https://ai-powered.com/mcp/browser-use): Browser Use is a freemium MCP server for browser automation.
- [Scrapling MCP Server](https://ai-powered.com/mcp/scrapling-mcp-server): Scrapling MCP Server is an open-source MCP server for web search and scraping.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/webperf-snippets
