# pagespeed-insights-mcp [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/ruslanlap/pagespeed-insights-mcp  
**GitHub Stars:** 77  
**npm Downloads (last month):** 3500  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/pagespeed-insights-mcp-2

## Description
Google PageSpeed Insights & CrUX APIs: 16 tools for web performance audits.

## Tools
Capabilities this server exposes over MCP:

- **pagespeed_analyze_page** — Run a PageSpeed Insights Lighthouse analysis for one public page. Start with report=summary for a health check; choose full for audits, recommendations for a prioritized fix list, audit for non-performance categories, or performance-map for Mermaid. Example: analyze a mobile product page and return the three most useful remediation steps. Returns a report plus structured result. The Google API is contacted and results may be served from the local cache.
- **pagespeed_diagnose_page** — Inspect one page through exactly one diagnostic lens: visual, elements, network, javascript, images, render-blocking, or third-parties. Use after pagespeed_analyze_page identifies a problem; do not use it for a general score. Example: focus=render-blocking to identify CSS/JS delaying first render. Returns focused evidence rather than a full Lighthouse dump.
- **pagespeed_get_field_data** — Get real-user Core Web Vitals from Chrome UX Report, not Lighthouse lab measurements. Use scope=page for one URL; use scope=origin with a bare origin when the page has insufficient traffic. Example: check mobile LCP and INP for https://example.com/checkout. Returns p75 field metrics or a clear no-data result.
- **pagespeed_compare_pages** — Compare two pages now (mode=pages) or measure one page against its locally stored baseline (mode=baseline). Baseline mode records the first call; use runs=3 or more and rely on guaranteed deltas, not medians alone. Example: compare staging against production, or verify whether a deployed fix improved mobile LCP. replaceBaseline overwrites local baseline state.
- **pagespeed_analyze_batch** — Analyze 1–10 public URLs and return per-page results plus success/failure counts. Use pagespeed_analyze_page for one URL or pagespeed_compare_pages for a direct comparison. Example: triage the ten highest-traffic landing pages. Progress notifications are emitted when supported by the client.
- **pagespeed_clear_cache** — Clear only this server process's in-memory PageSpeed response cache, forcing later analysis calls to contact Google again. Use after a deploy when a cached result is stale. It does not change the target website, files, or remote data; repeating the call is safe.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "pagespeed-insights-mcp": {
    "command": "npx",
    "args": ["-y","pagespeed-insights-mcp"],
    "env": {
      "GOOGLE_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `GOOGLE_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What pagespeed-insights-mcp does

pagespeed-insights-mcp exposes Google PageSpeed Insights and Chrome UX Report capabilities to MCP-compatible AI clients. It combines Lighthouse lab analysis with CrUX field data, allowing an agent to examine both a controlled performance run and real-user Core Web Vitals for a page or origin.

The server is suited to performance reviews that need more than a single score. It can return audit findings, recommendations, screenshots-based visual analysis, focused diagnostic views, comparisons, batch results, and saved-baseline comparisons. Its tools are useful for investigating regressions after a deployment, reviewing several URLs, or identifying concrete optimization work.

## How it works

The server runs as a local stdio process and communicates with the MCP client. A Google API key is passed through the process environment, and requests are made to the PageSpeed Insights and CrUX APIs. Repeated requests can use the process's in-memory cache; the cache can be cleared after a deployment with the dedicated cache tool.

Lighthouse analysis can be requested for a single page, while focused diagnosis narrows the investigation to visual output, page elements, network activity, JavaScript, images, render-blocking resources, or third-party code. CrUX queries accept either a page or an origin. Comparison requests can compare two current pages or compare a page with its stored baseline. Batch analysis handles between one and ten pages and can report progress when the connected client supports notifications.

## Setup and configuration

Install and launch the package with `npx` from the MCP client's server configuration. The process requires the `GOOGLE_API_KEY` environment variable, which should contain a Google API key obtained through Google Cloud's PageSpeed Insights setup. A minimal configuration uses the `pagespeed-insights-mcp` package as the command's argument and passes the key in `env`.

Claude Desktop configuration uses `claude_desktop_config.json`. Codex/OpenAI configurations use TOML. The documented client configurations also install `pino-pretty` alongside the server with `npx` for log formatting. After changing the configuration, restart the client and verify that the server is running before invoking its tools.

## Tools and capabilities

- Analyze one page with a Lighthouse health check, full report, recommendations, audit findings, or a Mermaid map.
- Diagnose one performance area, including visual output, elements, network, JavaScript, images, render-blocking resources, or third parties.
- Retrieve CrUX real-user Core Web Vitals for a page or origin.
- Compare two pages or compare a page against a saved baseline.
- Analyze one to ten pages in a batch with progress notifications where supported.
- Clear the process-local in-memory API cache after a deployment.

## Limitations and notes

Lighthouse results represent lab runs and can vary between requests; using multiple runs can help produce a more representative median. CrUX data describes real-user experience and is distinct from Lighthouse's controlled test conditions. Batch progress depends on MCP client notification support. API access also depends on a valid Google API key and the availability of data for the requested page or origin.

_Full upstream README: https://allmcps.com/mcp/pagespeed-insights-mcp-2/readme_

