PageSpeed Insights MCP Server
PageSpeed Insights MCP Server lets you audit, diagnose, compare, and monitor web performance using Google PageSpeed Insights, Lighthouse, and CrUX data.
Run PageSpeed/Lighthouse analyses for public pages or localhost/private URLs with summary, full, recommendations, audit, or performance-map reports.
Diagnose a page through visual screenshots, element metrics, network, JavaScript, image, render-blocking, or third-party lenses.
Fetch real-user Core Web Vitals from Chrome UX Report, including origin scope and historical trends.
Compare two pages or track a page against a stored baseline with multi-run regression checks.
Analyze batches of up to 10 URLs with per-page results and progress notifications.
Clear the in-memory PageSpeed cache after deployments.
Use CI budget checks, project baselines, MCP prompts/resources, and optional streamable HTTP sharing.
Provides web performance analysis using Google PageSpeed Insights API, including Lighthouse audits, Chrome UX Report data, and tools for analyzing page speed, mobile/desktop performance, recommendations, cache management, and detailed diagnostics like visual analysis, network waterfalls, and third-party script impact.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PageSpeed Insights MCP Server analyze https://example.com performance"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PageSpeed Insights MCP Server
Web performance engineering MCP server for Google PageSpeed Insights, Chrome UX Report (CrUX), and local Lighthouse. Audit public pages or localhost, inspect screenshots natively, track historical CrUX trends, enforce performance budgets in CI, and get code-level fixes directly inside Claude, Cursor, Codex, or Antigravity.
โก Quick Start (Zero-Config)
Paste into your MCP client config (claude_desktop_config.json, Cursor, or Antigravity) and restart:
{
"mcpServers": {
"pagespeed-insights": {
"command": "npx",
"args": ["-y", "pagespeed-insights-mcp"],
"env": {
"GOOGLE_API_KEY": "your-google-api-key"
}
}
}
}Codex / OpenAI / Grok (config.toml):
[mcp_servers.pagespeed-insights]
command = "npx"
args = ["-y", "pagespeed-insights-mcp"]
env = { GOOGLE_API_KEY = "your-google-api-key" }Docker:
docker build -t pagespeed-insights-mcp .
docker run -i -e GOOGLE_API_KEY=your-key pagespeed-insights-mcpNo API key yet? You can omit env completely to start immediately:
Public URLs work up to Google's anonymous PSI quota.
localhost/ private URLs run via local Chrome + Lighthouse CLI without any API key.Get a free key at Google Cloud Console (enable PageSpeed Insights API & Chrome UX Report API) for 25,000 req/day and CrUX field data.
Related MCP server: page-speed-insights-mcp
๐ฅ Why This Server
Hybrid Cloud + Local Engine: Public URLs run on Google PSI;
localhost,127.0.0.1, private IPs, and.localdomains automatically run via local Chrome + Lighthouse CLI (withextraHeadersfor auth-protected staging).Evidence-Backed AI Remediation: Covers 48 Lighthouse 12/13 audits with concrete offending URLs/DOM selectors, framework
stackPacksguidance (Next.js, React, etc.), and optionalworkspaceDirmapping tofile:linein your repo.Multimodal Visual Debugging:
focus="visual"returns native MCPimagescreenshots & filmstrip keyframes plus LCP/CLS bounding-box coordinates so multimodal models see layout shifts directly.Real-User CrUX + Historical Trends: 28-day p75 Core Web Vitals,
Good / Needs Improvement / Poorhistograms, and multi-week CrUX History trends (includeHistory: true) to pinpoint when regressions started.Statistically Honest Regression Tracking: Multi-run median + spread (
runs: 3โ5),fetchTimereplay deduplication, disjoint-rangeguaranteedDeltaverdicts, and git-committable.pagespeed/baselines.json.Same Engine in IDE & CI/CD: Built-in
.pagespeed.jsonperformance budgets,checkCLI gate for GitHub Actions, and stateless Streamable HTTP transport (--http) for shared team deployments.
๐ ๏ธ Tools (v2)
Every data tool accepts responseFormat (markdown default, or json) and returns MCP structuredContent.
Tool | Purpose |
| Lighthouse health check ( |
| Deep-dive through one lens: |
| CrUX real-user Core Web Vitals ( |
| Side-by-side comparison ( |
| Parallel triage of 1โ10 URLs bounded by |
| Clear the in-memory response cache after a deploy. |
MCP Prompts (Slash Commands) & Resources
Prompt | What it runs |
| Guided 4-step triage: Lighthouse summary โ CrUX field data โ targeted diagnostic โ prioritized fix plan. |
| Staging vs production comparison with a clear GO / NO-GO release verdict. |
| Contrasts real-user CrUX field metrics against synthetic Lighthouse lab data for LCP, INP, and CLS. |
Resource URI / Template | Content |
| Official 2026 Core Web Vitals thresholds & optimization playbook ( |
| All locally stored baselines ( |
| Dynamic template to read a single stored baseline snapshot ( |
๐ CI Performance Gate & Streamable HTTP
CI / GitHub Actions Budget Check (check)
# Inline budget thresholds (exits 0 on pass, 1 on budget violation or baseline regression)
npx pagespeed-insights-mcp check https://example.com --strategy mobile --min-score 90 --max-lcp 2500 --max-cls 0.1
# Or load thresholds from .pagespeed.json (supports route overrides) and output JSON
npx pagespeed-insights-mcp check https://example.com --budget .pagespeed.json --json
# Per-type transfer budgets (Lighthouse resource-summary; 0 is a real limit, an unmeasured run fails the check)
npx pagespeed-insights-mcp check https://example.com --max-js-bytes 150000 --max-image-bytes 400000.pagespeed.json is discovered from the nearest project root (.git or .pagespeed.json) at or above the
working directory, so check and the MCP server pick up the same strategy, budget and route budgets from
any checkout subdirectory. Precedence: per-call/flag values > route budget (exact URL, else pathname) > budget.
The MCP pagespeed_analyze_page and pagespeed_compare_pages tools apply the same defaults; compare resolves
each URL's route budget independently.
{
"strategy": "mobile",
"budget": {
"performanceScore": 85,
"lcp": 2500,
"cls": 0.1,
"tbt": 200,
"jsBytes": 150000,
"imageBytes": 400000
},
"budgets": {
"/checkout": {
"performanceScore": 92,
"lcp": 2000,
"jsBytes": 100000
}
},
"baselinesDir": ".pagespeed"
}Budget keys: performanceScore (โฅ), lcp/tbt/fcp/si/ttfb (ms, โค), cls (โค), totalByteWeight (bytes, โค),
jsBytes and imageBytes (transfer bytes from Lighthouse resource-summary, โค). A budget whose measurement is
missing from the result fails rather than passing silently.
Baseline storage (.pagespeed/baselines.json)
Baseline files are shared by the CLI and MCP server. The directory is chosen in this order (first match wins):
PAGESPEED_BASELINES_DIRenvironment variable.baselinesDirin the project's.pagespeed.json(relative paths resolve against that file).<project root>/.pagespeed/โ created on first write, so it does not need to pre-exist. The project root is the nearest ancestor with.gitor.pagespeed.json, so baselines land in the checkout, not in the subdirectory.~/.pagespeed-mcp/when there is no project โ a personal global store is never mixed with a project's.
Streamable HTTP Transport (--http)
Run a shared stateless MCP server for teams or cloud agents (/mcp endpoint + /health probe + optional Bearer auth):
MCP_AUTH_TOKEN=your-secret npx pagespeed-insights-mcp --http --port 3000 --host 127.0.0.1โ๏ธ Environment Variables
Variable | Default | Description |
| (optional) | Recommended for higher PSI quotas; required for CrUX field data. |
|
| Concurrent upstream/local analysis limit ( |
|
| Per-request timeout in milliseconds ( |
|
| Retry count for transient 5xx/network failures ( |
|
| In-memory cache TTL in seconds ( |
|
|
|
|
| Set |
| (optional) | Bearer token required on |
| (optional) | Override baseline storage dir. Without it: |
| (auto) | Chrome/Chromium binary path for local Lighthouse ( |
๐ Documentation & Development
Full Docs: ruslanlap.github.io/pagespeed-insights-mcp (Getting Started ยท Tools Reference ยท Architecture ยท Live Demo)
Changelog & Releases: GitHub Releases ยท CHANGELOG.md
Requirements: Node.js >= 20.19.0
Security: See SECURITY.md
npm run dev # Run with tsx
npm run build # Compile TypeScript -> dist/
npm run lint # ESLint
npm run typecheck # tsc --noEmit
npm test # Vitest suiteAcknowledgments & License
Special thanks to @engmsaleh and @system-conf for their significant contributions to this project.
Licensed under Apache-2.0.
Available Tools
6 toolspagespeed_analyze_batchAnalyze Multiple PagesARead-onlyIdempotent
Analyze 1โ10 URLs in parallel (bounded by concurrency) and return per-page results plus success/failure counts. Use pagespeed_analyze_page for one URL or pagespeed_compare_pages for a direct comparison. Progress notifications are emitted when supported by the client.
Inputs: urls (required), engine, locale, report, +4 more. Returns: tool, result, truncated, truncationMessage
pagespeed_analyze_pageAnalyze a Page with LighthouseARead-onlyIdempotent
Run a PageSpeed Insights (or local Lighthouse for localhost/private URLs) analysis for one 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.
Inputs: url (required), runs, budget, engine, +7 more. Returns: tool, result, truncated, truncationMessage
pagespeed_clear_cacheClear Local PageSpeed CacheAIdempotent
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.
Inputs: no named parameters. Returns: tool, result, truncated, truncationMessage
pagespeed_compare_pagesCompare Pages or a Stored BaselineADestructive
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.
Inputs: url (required), mode (required), runs, budget, +7 more. Returns: tool, result, truncated, truncationMessage
pagespeed_diagnose_pageDiagnose a Page Performance ProblemARead-onlyIdempotent
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 (including native image screenshots when focus=visual).
Inputs: url (required), focus (required), engine, strategy, +2 more. Returns: tool, result, truncated, truncationMessage
pagespeed_get_field_dataGet Chrome UX Report Field DataARead-onlyIdempotent
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. Set includeHistory=true to inspect multi-week historical trends. Returns p75 field metrics, distribution histograms, or a clear no-data result.
Inputs: url (required), scope, formFactor, includeHistory, +1 more. Returns: tool, result, truncated, truncationMessage
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 6 tools
Each tool targets a distinct workflow: general analysis, focused diagnosis, field data, comparison, batch analysis, and cache clearing. The potentially overlapping analyze/diagnose pair is explicitly differentiated by scope and use case.
All tools use the same pagespeed_ prefix and a predictable snake_case verb_noun pattern, such as analyze_page, get_field_data, and clear_cache. The convention is consistent throughout.
Six tools are well-scoped for a PageSpeed Insights server, with each tool earning its place by covering a separate workflow. There are no redundant variants or obviously missing core operations.
The set covers the main lifecycle: single-page analysis, diagnostic drill-downs, real-user field data, comparisons, batch runs, and cache clearing. A minor gap exists around explicit baseline management, since baseline state is handled implicitly through compare_pages rather than dedicated list/reset tools.
Maintenance
Related MCP Connectors
Free MCP server that audits any public URL: technical SEO, Core Web Vitals, indexing checks.
Unified 15-tool SEO, SERP, clean Markdown & GEO (LLM citation Share-of-Voice) MCP server.
Remote MCP server that gives Claude, ChatGPT, Cursor or any MCP client Google search volume, CPC, competition and similar keywords for 50+ countries. Works with no signup at 20 lookups a day; sign in with OAuth or an API key for higher limits, or $4.99 a month for unlimited.
Hosted MCP server for marketing agencies: connect Google Ads, GA4, Search Console, Meta, LinkedIn and more to Claude or ChatGPT. Pull reports and make changes via OAuth login, no setup.
Related MCP Servers
- AlicenseAqualityDmaintenanceCore Web Vitals analysis powered by Lighthouse. Four tools: analyze a URL, compare two URLs, check against thresholds, or crawl an entire site. Works with Claude Code, Cursor, Windsurf, and any MCP-compatible AI tool.413 npmMIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that wraps the Google PageSpeed Insights API to analyse web performance, providing tools for scores, Core Web Vitals, opportunities, diagnostics, and batch analysis.-
- AlicenseNot gradedqualityDmaintenanceThis MCP server integrates Google PageSpeed Insights to analyze website performance, accessibility, best practices, SEO, and PWA on mobile and desktop, returning detailed audits and optimization opportunities.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that pulls PageSpeed Insights and Google Search Console data across multiple owned sites, enabling cross-site performance reports and synthesis via Claude.MIT