web-performance-mcp
Integrates with Google PageSpeed Insights API to analyze web page performance, providing performance scores, lab metrics (FCP, LCP, Speed Index, TBT, CLS, TTI, TTFB), high-impact audits, and compact diagnostics for render-blocking resources, unused JS/CSS, image optimization, and main-thread work, along with actionable recommendations.
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., "@web-performance-mcp Analyze the performance of https://example.com"
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.
web-performance-mcp
MCP server for compact web performance analysis with the official Google APIs:
PageSpeed Insights API v5
Chrome UX Report API
It does not run Lighthouse locally and does not use Puppeteer, Playwright, Chrome DevTools Protocol, or a local browser.
Quick Start With npx
After the package is published to npm:
npx -y web-performance-mcpThe server reads GOOGLE_API_KEY from the environment. It also loads a .env file from the current working directory, so MCP clients can keep secrets in the project they are analyzing.
Create .env in your project:
GOOGLE_API_KEY=your-google-api-key-hereRelated MCP server: PageSpeed MCP Server
Codex MCP Configuration
Use npx directly:
[mcp_servers.webPerformance]
command = "npx"
args = ["-y", "web-performance-mcp"]
cwd = "/path/to/project-with-env"
startup_timeout_sec = 30
tool_timeout_sec = 180cwd should point to the project that contains .env.
You can also pass the key through MCP env config:
[mcp_servers.webPerformance.env]
GOOGLE_API_KEY = "your-google-api-key-here"Prefer .env or shell environment variables for local use so secrets do not end up in shared config.
Required Google APIs
Create a Google Cloud API key and enable:
PageSpeed Insights API
Chrome UX Report API
Restrict the API key to only these APIs.
Tools
analyze_pagespeed
Analyze one URL with PageSpeed Insights.
{
"url": "https://www.example.com/",
"strategy": "mobile",
"categories": ["performance"]
}Returns:
performance score;
lab metrics: FCP, LCP, Speed Index, TBT, CLS, TTI, TTFB;
high-impact audits;
compact diagnostics for render-blocking resources, unused JS/CSS, image optimization, and main-thread work;
recommendations.
analyze_pagespeed_batch
Analyze up to 10 URLs with concurrency control.
{
"urls": [
"https://www.example.com/",
"https://www.example.com/blog/"
],
"strategy": "mobile",
"categories": ["performance"],
"concurrency": 2
}get_crux_url
Query Chrome UX Report data for a URL.
{
"url": "https://www.example.com/"
}Returns LCP, INP, CLS p75 and good/needs improvement/poor distributions when CrUX has enough real-user data.
get_crux_origin
Query Chrome UX Report data for an origin.
{
"origin": "https://www.example.com"
}compare_web_performance
Combine PageSpeed and CrUX for several URLs and prioritize likely problems.
{
"urls": [
"https://www.example.com/",
"https://www.example.com/blog/"
],
"strategy": "mobile",
"categories": ["performance"],
"concurrency": 2
}Response Shape
Responses are intentionally compact. The server does not send the raw PageSpeed or CrUX API payload back to the model.
CrUX tools return available: false when Google has no field data for the URL or origin.
API errors are returned as compact MCP errors for timeout, quota, permissions, invalid URLs, and incomplete API responses.
Local Development
corepack enable
pnpm install
cp .env.example .env
pnpm build
pnpm test
pnpm startUse the local checkout in Codex:
[mcp_servers.webPerformance]
command = "node"
args = ["/Users/teles/dev/web-performance-mcp/dist/index.js"]
cwd = "/path/to/project-with-env"
startup_timeout_sec = 30
tool_timeout_sec = 180Publishing to npm
The npm package name is:
web-performance-mcpThe name is currently available if npm view web-performance-mcp returns 404 Not Found. During npm publish, however, a 404 Not Found usually means the workflow cannot create or access that package name with the current npm authentication.
One-Time npm Setup
Create or log in to your npm account.
Publish the package once with an npm account that can create unscoped public packages, or configure npm Trusted Publishing for the GitHub repository before the automated release runs.
For Trusted Publishing, configure this package on npmjs.com with:
Provider: GitHub Actions
Organization or user: teles
Repository: web-performance-mcp
Workflow filename: release.yml
Allowed action: npm publishKeep the GitHub Actions workflow permissions:
permissions:
contents: write
id-token: writeTrusted Publishing requires npm CLI 11.5.1+ and Node.js 22.14.0+. The release workflow uses Node 24.
If the release workflow fails while publishing with npm error 404 Not Found - PUT https://registry.npmjs.org/web-performance-mcp, confirm that the package exists under your npm account or that Trusted Publishing is configured for exactly teles/web-performance-mcp and workflow filename release.yml.
Release Flow
This repository uses zero-release.
Commits should follow Conventional Commits:
feat: add new tool
fix: handle CrUX permission errors
docs: improve npx setupPreview the next release locally:
pnpm release:dry-runCheck release readiness:
pnpm release:doctorPush to main to publish:
git push origin mainThe workflow runs tests, builds the package, updates CHANGELOG.md and package.json, creates a GitHub release, and publishes to npm with the npm plugin.
Manual Publish Fallback
If you do not want to use Trusted Publishing yet:
corepack enable
pnpm install --frozen-lockfile
pnpm test
pnpm build
npm login
npm publish --access publicUse zero-release for normal releases once npm Trusted Publishing is configured.
Security
Never commit
.envor real credentials.Restrict
GOOGLE_API_KEYto PageSpeed Insights API and Chrome UX Report API.The API key is never printed by the server.
The server does not execute browser automation.
License
MIT
Available Tools
5 toolsanalyze_pagespeedC
Analisa uma URL com PageSpeed Insights API v5 e retorna scores, metricas de laboratorio, auditorias de maior impacto e recomendacoes compactas.
Inputs: url (required), strategy, categories.
analyze_pagespeed_batchC
Analisa ate 10 URLs com PageSpeed Insights API v5, com limite de concorrencia, e retorna uma comparacao compacta.
Inputs: urls (required), strategy, categories, concurrency.
compare_web_performanceB
Compara varias URLs combinando PageSpeed Insights e CrUX, priorizando os maiores problemas de Core Web Vitals e laboratorio.
Inputs: urls (required), strategy, categories, concurrency.
get_crux_originA
Consulta a Chrome UX Report API para uma origem e retorna LCP, INP, CLS e distribuicoes good/needs improvement/poor agregadas.
Inputs: origin (required).
get_crux_urlA
Consulta a Chrome UX Report API para uma URL e retorna LCP, INP, CLS e distribuicoes good/needs improvement/poor.
Inputs: url (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct operation: single URL analysis, batch analysis, combined comparison, origin-level CrUX, and URL-level CrUX. No overlap in functionality.
All names use snake_case and follow a verb_noun pattern. Minor deviation with 'compare_web_performance' which uses a broader verb, but overall consistent.
Five tools is ideal for a web performance server, covering single/batch analysis, comparison, and CrUX data without bloat.
Covers the core PageSpeed Insights and CrUX functionalities well. Could include a tool for Lighthouse report details, but the current scope is reasonable.
Maintenance
Related MCP Connectors
Bulk PageSpeed Insights and Core Web Vitals (LCP, INP, CLS) for many URLs. Runs on Apify.
Real-user Core Web Vitals for any website with enough traffic, from Google's Chrome UX Report…
Bulk Google PageSpeed Insights: Lighthouse scores, Core Web Vitals, top fixes for URLs or a sitemap.
1Website performance monitoring: scans, Core Web Vitals, RUM data and alerts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceActs as a bridge between AI models and Google's PageSpeed Insights API, enabling detailed performance analysis of websites.13MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform comprehensive web performance analysis using Google's PageSpeed Insights API, including metrics, best practices, SEO, and accessibility audits.44 npmMIT
- FlicenseAqualityDmaintenanceAnalyzes websites like a senior performance engineer and produces prioritized Core Web Vitals recommendations. Provides 16 tools for detailed performance analysis, including Lighthouse, CrUX, WordPress and Cloudflare inspections.16-
- FlicenseNot gradedqualityCmaintenanceEnables analysis of web page performance through the Google PageSpeed Insights API v5, providing tools for scores, Core Web Vitals, opportunities, diagnostics, mobile vs desktop comparison, and batch analysis.-