Purpose
pagespeed-insights-mcp is an MCP (Model Context Protocol) server used to connect to the Google PageSpeed Insights and Chrome UX Report (CrUX) APIs, allowing users to directly analyze, compare, and optimize web page performance through Claude, Cursor, or other MCP-compatible AI clients. It is aimed at developers and teams that need to handle web performance issues, with the goal of integrating scattered performance data into an actionable optimization workflow.
Main Capabilities
This server provides six workflow-oriented tools, covering the complete performance workflow rather than just giving a score:
- Page analysis
- CrUX real user data, supporting both URL and origin scopes
- Lighthouse audit
- Multi-page and batch comparison
- Baselines
- Regression tracking
For deep diagnostics, it supports element-level diagnostics, network analysis, JavaScript analysis, image optimization, render blocking, and third-party script impact analysis. The output is actionable results: the recommendation engine can turn raw Lighthouse data into prioritized fix suggestions and provides visual analysis with screenshots. It also includes a caching mechanism for repeated runs, as well as smart suggestions tuned for AI agents.
Performance analysis features also include: multi-platform support (mobile and desktop), detailed Lighthouse reports, simplified key metrics reports, smart suggestions with priority scores and actionable fixes, smart caching to reduce API calls, multilingual localization support, and Docker containerized deployment.
Advanced analysis tools include: visual analysis (screenshots, filmstrip, full-page screenshots), element-level debugging (locating the specific DOM elements causing problems), network waterfall charts (request timing and resource loading details), JavaScript performance analysis (execution breakdown and unused code detection), image optimization (specific image issues and precise savings), render-blocking analysis (critical request chains and dependencies), third-party impact (script impact grouped by provider), and full audits.
Usage
Configuration requires a Google API key and enabling the PageSpeed Insights API. Quick start process: in the Google Cloud Console, obtain a free API key, enter it into Claude Desktop's claude_desktop_config.json, then restart, and it is done. The project also provides Codex/OpenAI configuration and a Docker method.
Installation methods include:
- Automatic installation (recommended), using the public npm package pagespeed-insights-mcp by default
- Via npm:
npm install pagespeed-insights-mcp - Via GitHub Packages:
npm install @ruslanlap/pagespeed-insights-mcp(Requires GitHub authentication) - Docker
Steps to obtain an API key: Go to Google Cloud Console to create or select a project; in APIs & Services → Library, search for and enable the PageSpeed Insights API; in APIs & Services → Credentials, create an API key and set it as GOOGLE_API_KEY.
Claude Desktop configuration file paths: macOS is ~/Library/Application Support/Claude/claude_desktop_config.json, Windows is %APPDATA%\Claude\claude_desktop_config.json, Linux is ~/.config/claude/claude_desktop_config.json. After editing, restart Claude Desktop.
Once configured, you can directly give instructions to Claude, for example: full page analysis, mobile device analysis, quick performance overview, desktop analysis, multi-category analysis, smart performance recommendations, cache management, visual analysis, element-level debugging, network waterfall analysis, JavaScript performance, image optimization opportunities, render-blocking resources, third-party script impact, full Lighthouse audit, etc.
Use Cases
- When a page is slow but you don't know why, this tool does not return a dashboard of 40 metrics; instead, it identifies specific render-blocking resources, images wasting 2 MB, and third-party scripts consuming 1.5 seconds of main thread time, sorts them by impact, and outputs a prioritized fix list.
- When a team iterates quickly, deploys daily, and no one runs a full Lighthouse audit before merging, developers can paste a URL into Claude/Cursor and within seconds get a complete audit including lab data, CrUX field data from real Chrome users, and element-level CLS/LCP debugging, thereby catching regressions on desktop instead of learning about them three days later from a Slack message in the SEO team.
Limitations
- Requires a Google API key and enabling the PageSpeed Insights API (Chrome UX Report API is optional).
- Requires Node.js 20.19.0 or higher; Node 18 has been unsupported since April 2025.
- URLs must include a protocol; only http:// and https://,其他协议(file://、ftp://、javascript: , etc.) are rejected at the schema level.
- v2 is a breaking change: the original 19 endpoint-style tools are replaced by six workflow tools, requiring updates to MCP client prompts, saved tool calls, and integrations. Every tool that returns data accepts responseFormat (markdown is the default, or json) and returns MCP structuredContent.
- Lab data is noisy, and a single run is only one sample; it is recommended to use runs: 3-5 to obtain a median. Lighthouse throttles the connection, while CrUX shows the experience of actual visitors; the two offer different perspectives.
- Using pino-pretty as the log transport in a development environment requires NODE_ENV=development, or installing pino-pretty via npx.
Additional Information
This project has been published on npm, is listed in the Official MCP Registry and Glama, and uses Vitest for CI testing. The license is Apache-2.0. For how to report security issues, see SECURITY.md; do not disclose them through public issues.