# PageSpeed MCP

> Core Web Vitals and Lighthouse fixes, straight into your agent.

MCP server for PageSpeed Insights v5 and the Chrome UX Report: audits, real-user Core Web Vitals, 40-week history, prioritised fixes and sitemap batch audits.

- Type: MCP Server
- Price: €49, one-time purchase, 12 months of updates, downloads forever
- URL: https://provencart.com/products/pagespeed-mcp

## From "the site feels slow" to a fix list

A Lighthouse report is long, a CrUX dashboard is somewhere else, and neither tells you what to fix first. So the usual routine is: run PageSpeed Insights, scroll, copy numbers into a ticket, repeat for the next template. An AI agent can do the scrolling, if it gets the data in a form it can reason about.

PageSpeed MCP gives Claude, Cursor, VS Code, Codex or any MCP client direct access to the **PageSpeed Insights API v5** and the **Chrome UX Report API**, and turns their output into compact, rated, prioritised answers.

## 7 tools

- **psi_audit**: Lighthouse audit on mobile, desktop or both. Category scores, lab FCP, LCP, TBT, CLS, Speed Index and server response time, each rated; real-user field data for the URL and the whole origin; the top opportunities.
- **psi_opportunities**: every failing opportunity and Lighthouse insight, sorted by estimated savings in milliseconds and kilobytes, with the metrics it affects and the worst resources. Plus failing diagnostics like DOM size or main-thread work.
- **psi_compare_urls**: 2–10 URLs side by side (your template A vs. B, or you vs. competitors), with the best URL per metric.
- **psi_batch_sitemap**: reads a sitemap, sitemap index or `.xml.gz`, filters URLs by regex and audits up to 200 of them with a concurrency limit and progress updates. Returns a worst-first table and a site summary.
- **psi_budget_check**: pass/fail against a performance budget, before and after a deploy.
- **crux_cwv**: real-user LCP, INP, CLS, FCP and TTFB at p75 with good / needs-improvement / poor shares, per phone, desktop or tablet, with automatic fallback from URL to origin.
- **crux_history**: up to 40 weekly periods (about nine months) of field data with a trend summary, so you can see whether last month's fix actually reached users.

Plus a resource with the official CWV thresholds and two prompts: a **CWV triage** for one URL and a client-ready **speed report** for a whole site.

## Lab explains, field decides

Google's Core Web Vitals assessment uses field data: the 75th percentile of real Chrome users. Lighthouse lab data is one simulated load, but it shows causes. The server keeps both apart, rates both with the official thresholds (LCP ≤ 2.5 s, INP ≤ 200 ms, CLS ≤ 0.1) and tells the agent which is which, so you don't get "INP is fine" from a lab run that cannot measure INP.

## Built for real runs

PSI runs take 10–60 seconds. Results are cached for ten minutes, so asking for opportunities after an audit costs nothing. Batch and compare runs respect a concurrency limit. Transient errors are retried with backoff; pages Lighthouse cannot load are not retried pointlessly. Every audit comes with a small text gauge, `▰▰▰▰▰▰▰▱▱▱ 72/100`.

## Speed has always been our thing

ProvenCart spent years building WordPress performance plugins, and our logo is still a speedometer. This server is that experience, rebuilt for agents.

## What you need

Node.js 20+ and a free Google API key with the PageSpeed Insights and Chrome UX Report APIs enabled. Five minutes with the included guide.

## Outcomes

- A prioritised fix list instead of a 40-section Lighthouse report
- Real-user Core Web Vitals and their trend in one question
- A whole sitemap audited worst-first while you do something else
- Pass/fail performance budgets before and after every deploy

## Features

- **Lab and field in one call**: Lighthouse scores and lab metrics plus CrUX field data for URL and origin, rated with the official thresholds.
- **Fixes ranked by savings**: Opportunities and Lighthouse insights sorted by estimated ms and KB saved, with affected metrics and offending resources.
- **40-week CWV history**: Weekly CrUX p75 and good-share series with a trend summary to verify that fixes reached real users.
- **Sitemap batch audits**: Sitemap, index or .xml.gz, regex filters, up to 200 URLs, concurrency limit and progress notifications.
- **Budgets and comparisons**: Pass/fail budget checks for deploys and side-by-side comparison of up to 10 URLs.
- **stdio or HTTP**: Runs locally over stdio or as a Streamable HTTP server with bearer token and Docker image.

## Who it is for

- Web developers and agencies who fix Core Web Vitals for clients
- SEO consultants who need performance data in their audits
- Shop and site owners who want to know what to fix first

## What's inside

- `src/`: TypeScript source: 7 tools, CWV thresholds resource, 2 prompts, PSI/CrUX client with cache
- `dist/`: Prebuilt JavaScript, runs with node dist/index.js
- `test/`: Vitest unit tests with PSI and CrUX fixtures in the real response structure
- `README.md / README.de.md`: API key guide, client configs, tool reference, lab vs. field explainer
- `.env.example`: Every configuration option, documented
- `Dockerfile`: Container image for stdio or HTTP mode
- `LICENSE.md, CHANGELOG.md`: Commercial license and version history

## Example: What to fix first

```json
psi_opportunities { "url": "https://shop.example.com/", "strategy": "mobile", "limit": 3 }
```

```text
{
 "performance": 61,
 "gauge": "▰▰▰▰▰▰▱▱▱▱ 61/100 needs-improvement",
 "opportunities": [
  { "title": "Eliminate render-blocking resources", "savings_ms": 850, "metrics": ["FCP", "LCP"],
    "items": [ { "url": "https://shop.example.com/wp-content/themes/shop/style.css", "wasted_ms": 610 } ] },
  { "title": "LCP request discovery", "savings_ms": 600, "metrics": ["LCP"] },
  { "title": "Reduce unused JavaScript", "savings_ms": 420, "savings_kb": 176, "metrics": ["LCP"] }
 ],
 "diagnostics": [ { "title": "Avoid an excessive DOM size", "display": "2,410 elements" } ]
}
```

## Installation

1. Unzip and build (a prebuilt `dist/` is included):

   ```bash
   cd pagespeed-mcp && npm install && npm run build
   ```

2. In Google Cloud Console enable **PageSpeed Insights API** and **Chrome UX Report API**, then create an **API key** (APIs & Services → Credentials) and restrict it to those two APIs.

3. Register the server, e.g. in Claude Code:

   ```bash
   claude mcp add pagespeed -e PAGESPEED_API_KEY=AIza... -- node /absolute/path/to/pagespeed-mcp/dist/index.js
   ```

   Configs for Claude Desktop, Cursor, VS Code and Codex are in the README.

4. Ask: *"Audit https://your-site.com on mobile and desktop and tell me what to fix first."*

## Requirements

- Node.js 20 or newer (or Docker)
- Free Google API key with PageSpeed Insights API and Chrome UX Report API enabled
- Publicly reachable pages to audit
- An MCP client such as Claude Code, Claude Desktop, Cursor, VS Code or Codex

## FAQ

**Do I need an API key?**

For the CrUX tools, yes. For PageSpeed Insights it is technically optional, but the keyless quota is shared by everyone and often exhausted. A key is free and gives you 25,000 PSI queries per day by default.

**How is the API key handled?**

It stays in your MCP client config or environment. Both Google APIs expect it as a URL parameter; the server redacts it from every error message and log line. Restrict the key to the PageSpeed Insights and Chrome UX Report APIs in Google Cloud Console.

**Why do lab and field numbers differ?**

Lab data is one simulated load on a throttled phone; field data is the 75th percentile of real Chrome users over 28 days. Google's Core Web Vitals assessment uses field data. Use the lab results to find causes and crux_history to verify the effect after a release.

**Why does CrUX say there is no data for my page?**

The Chrome UX Report only publishes URLs and origins with enough real-user traffic. crux_cwv then falls back to the origin automatically; for very small sites use the lab data from psi_audit.

**Can I run it on a server or in CI?**

Yes. It runs over stdio or as a Streamable HTTP server (--http --port) with an optional bearer token, and a Dockerfile is included. psi_budget_check returns a clear pass/fail for deploy checks.

**How do updates and licensing work?**

You get 12 months of updates from your ProvenCart library; downloaded versions keep working forever. The license covers unlimited own and client projects; reselling or redistributing the files is not allowed. Setting PROVENCART_LICENSE_KEY enables an optional check (key, product and an anonymous installation ID) that only logs a message and never blocks the server.

**Can I get a refund?**

It's a digital product: at checkout you agree that the download starts immediately, so the statutory right of withdrawal expires (§ 356 (5) BGB). If something doesn't work for your setup, write us via the support page and we'll help you get it running.

Keywords: PageSpeed MCP, PageSpeed Insights API, Core Web Vitals MCP, CrUX API, Lighthouse AI agent, LCP INP CLS, Claude PageSpeed, Model Context Protocol, website speed audit, sitemap performance audit, Core Web Vitals history
