
Pagespeed Insights Mcp
io.github.ruslanlap由 GitHub 账号 ruslanlap 发布v2.2.0更新于 Oct 24, 2026
Google PageSpeed Insights 与 CrUX:六个用于网页性能的工作流工具。
AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。
原文描述
Google PageSpeed Insights and CrUX: six workflow tools for web performance.
概览
Pagespeed Insights 的本地 MCP 服务;无需登录;STDIO。
暂无 AI 概览:以下信息来自注册中心条目和服务本身。
安装
在 SourceWeft 中
- 打开 控制台中的 Pagespeed Insights Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
PageSpeed Insights MCP Server
Six-tool MCP server for Google PageSpeed Insights & Chrome UX Report APIs. Analyze, compare, and optimize web performance directly through Claude, Cursor, or any MCP-compatible AI client.
⚡ Quick Start (Copy & Paste)
Get a free API key at Google Cloud Console → paste into Claude Desktop's claude_desktop_config.json → restart. Done. (Codex/OpenAI config, Docker)
[npm version] [npm downloads] [MCP Toplist] [Glama MCP] [Pagespeed Insights MCP server]
[PageSpeed MCP chat demo] [PageSpeed MCP terminal demo]
[GitHub Package Version] [CI] [Documentation] [Live Demo] [License: Apache-2.0]
🔥 What Makes It Different
Most PageSpeed MCP servers wrap one tool: "run PSI on a URL." This server ships six workflow tools covering the full performance workflow — not just a score, but an action plan:
- Full toolkit: page analysis, CrUX real-user data (URL + origin), Lighthouse audits, multi-page & batch comparison, baselines, and regression tracking
- Deep diagnostics: element-level, network, JavaScript, image optimization, render-blocking, and third-party impact analysis
- Actionable output: a recommendations engine that turns raw Lighthouse data into prioritized fixes, plus visual analysis of screenshots
- Practical extras: caching for repeat runs and smart recommendations tuned for AI agents to act on
- Battle-tested: published on npm, listed in the Official MCP Registry and Glama, CI-tested with Vitest
🎬 View Interactive Demo → — See the tools in action with animated examples Fallback URL: https://ruslanlap.github.io/pagespeed-insights-mcp/demo.html
📖 Table of Contents
- ⚡ Quick Start (Copy & Paste)
- 🔥 What Makes It Different
- ⚙️ Client Configuration
- 📊 Example Output
- 📚 Documentation
- 📝 Release Notes
- 🎯 Why You Need This
- ✨ Features
- 🚀 Quick Installation
- 🔑 Getting Google API Key
- ⚙️ Claude Desktop Configuration
- 💻 Usage
- Available Tools
- MCP Prompts (Slash Commands)
- MCP Resources
- ✨ Rich Visual & Aesthetic Outputs
- Development
- Troubleshooting
- Requirements
- Security
- Acknowledgments
- License
- Support
⚙️ Client Configuration
Claude Desktop
Add to your claude_desktop_config.json:
Codex / OpenAI
Add to your configuration (TOML):
Note: The
pino-prettypackage is required for proper log formatting. The above configurations ensure it is installed automatically vianpx.
For Grok Build (config.toml)
Add to ~/.grok/config.toml (global) or <repo>/.grok/config.toml (project-scoped, higher priority):
Project-scoped example (put in this repo's .grok/config.toml for local dist/index.js + tighter Serena):
Verification inside Grok session:
/mcps(or Ctrl+L → MCP tab) → ensure pagespeed-insights shows "running"- Use tools:
pagespeed-insights__pagespeed_analyze_page,pagespeed-insights__pagespeed_get_field_data, etc. (namespaced)
📊 Example Output
Real pagespeed_analyze_page results for github.com — one mobile Lighthouse run. CrUX numbers come from pagespeed_get_field_data with scope: "origin":
Lighthouse lab scores:
Core metrics (mobile):
CrUX field data — real users, github.com origin (phone):
Results vary between runs — Lighthouse lab data is noisy (a single run is one sample). Use
runs: 3-5for medians.Lab vs field: Lighthouse throttles the connection (hence 54/100 mobile), while CrUX shows how actual GitHub visitors experience it — both views come straight from this server's tools.
📚 Documentation
We have comprehensive documentation available online.
👉 View Full Documentation Site
You can also view the raw markdown files in the
docs/directory or runmkdocs servelocally.
📝 Release Notes
Current release: see the version badges at the top of this README.
Latest Highlights:
-
✨ Rich Aesthetic & Visual Formatters:
- Unicode Score Bars: Gauge progress visualization (
█████████████░░░ 85/100 🟢 Good) for instant visual feedback. - Core Web Vitals Scorecards: Clean markdown tables classified with official Google 2026 guidelines (
🟢 Good,🟡 Needs Improvement,🔴 Poor). - GitHub Shield Badges: Direct copy-paste markdown badges for repository READMEs with direct web.dev analysis links.
- Modernized Mermaid Architecture Maps: High-contrast, dark-mode friendly flowcharts with color-coded nodes.
- Recommendation Callouts: Visual priority summary callout cards (
🔴 High | 🟡 Medium | 🟢 Low | Impact: High).
- Unicode Score Bars: Gauge progress visualization (
-
💬 Native MCP Prompts (Slash Commands):
- Interactive prompts exposed to Claude Desktop, Cursor, and Cline slash menus:
/performance-audit: Guided 4-step performance triage with prioritized remediation./release-comparison: Staging vs production delta verification with a clear GO / NO-GO decision./core-web-vitals-deepdive: Deep-dive contrasting real-user CrUX field data with synthetic Lighthouse lab simulations.
- Interactive prompts exposed to Claude Desktop, Cursor, and Cline slash menus:
-
📚 Native MCP Resources:
- Direct context URIs without tool executions:
pagespeed://web-vitals-guide: 2026 Core Web Vitals thresholds and optimization playbooks.pagespeed://baselines: Locally recorded performance baselines for regression tracking.
- Direct context URIs without tool executions:
-
🧪 Enterprise-Grade Test Suite & Resilience:
- Expanded test coverage across 21 test suites and 304 tests (100% passing).
- High coverage standards: 96.43% statements, 85.82% branch coverage (
100%on formatters, resources, and baselines). - Clean, single-run execution across CI and
prepublishOnly(lint,typecheck,test,build).
-
v2 Core Architecture:
- Six workflow-oriented
pagespeed_*tools replace the former 19 v1 endpoint-shaped tools; all data tools support Markdown or JSON with structured results.
- Six workflow-oriented
The badges at the top of this README update automatically on every release (npm version, GitHub package version, downloads). No manual edits needed.
For the complete release history, see CHANGELOG.md.
🎯 Why You Need This
Pain point 1 — "My page is slow but I don't know why." You open PageSpeed Insights, get a wall of data, and still can't tell what to fix first. This MCP gives your AI assistant six focused workflows that cut through the noise: it identifies the exact render-blocking resources, the specific images wasting 2 MB, the third-party scripts eating 1.5 s of main-thread time — and ranks them by impact. Ask "why is my site slow?" and get a prioritized fix list, not a 40-metric dashboard.
Pain point 2 — "I ship performance regressions to production." Your team moves fast, deploys daily, and nobody runs a full Lighthouse audit before each merge. By the time someone notices the Core Web Vitals dropped, the regression is already live. This MCP lets any developer paste a URL into Claude/Cursor and get a complete audit — lab data, field data from real Chrome users (CrUX), element-level CLS/LCP debugging — in seconds. It's the difference between catching a regression at your desk and discovering it in a Slack message from the SEO team three days later.
✨ Features
Core Features
- 🚀 Performance Analysis of web pages using Google PageSpeed Insights
- 📱 Multi-platform Support: mobile and desktop devices
- 🔍 Detailed Lighthouse Reports with comprehensive metrics
- 📊 Simplified Reports with key performance indicators
- 🎯 Smart Recommendations with priority scoring and actionable fixes
- 💾 Intelligent Caching to reduce API calls and improve performance
- 🌍 Localization - support for multiple languages
- ⚡ Quick Installation - one command setup
- 🐳 Docker Support for containerized deployment
Advanced Analysis Tools (New!)
- 📸 Visual Analysis - Screenshots, filmstrip, and full-page captures
- 🎯 Element-Level Debugging - Find specific DOM elements causing issues
- 🌐 Network Waterfall - Detailed request timing and resource loading
- ⚡ JavaScript Profiling - Execution breakdown and unused code detection
- 🖼️ Image Optimization - Specific image issues with exact savings
- 🚫 Render-Blocking Analysis - Critical request chains and dependencies
- 🔌 Third-Party Impact - Script impact grouped by provider
- 📊 Full Audits - Complete Lighthouse audits for all categories
🚀 Quick Installation
Option 1: Automatic Installation (Recommended)
The installer uses the public npm package (pagespeed-insights-mcp) by default. To install the scoped GitHub Packages build instead, configure GitHub Packages authentication first and run:
Option 2: Via npm or GitHub Packages
From npm (Public Registry)
From GitHub Packages
Note: This package is available on both npm and GitHub Packages.
- For npm: Use
npm install pagespeed-insights-mcp- For GitHub Packages: Use
npm install @ruslanlap/pagespeed-insights-mcp(requires GitHub authentication)For detailed instructions on installing from GitHub Packages, see GITHUB_PACKAGES.md or visit the GitHub Packages page
🔧 Configuration
The MCP server requires a Google API key to access the PageSpeed Insights API.
📝 MCP Configuration Examples
For Claude Desktop (with pino-pretty logging):
For Codex (with pino-pretty logging):
Note: These examples include
pino-prettyfor better log formatting. For production use without pretty logs, see the Logging section below.
Google Antigravity
Example configuration files are available in the examples directory.
Option 3: Docker
🔑 Getting Google API Key
To use this MCP server, you need a Google API key with the PageSpeed Insights API enabled.
[!TIP] ⚡ Quick Setup Link: You can go directly to the Google Cloud Credentials Setup Page to quickly create a key in your project.
Step-by-Step Guide
- Go to the Google Cloud Console (or use the Quick Setup Link).
- Create a new project or select an existing one.
- Enable PageSpeed Insights API:
- Navigate to APIs & Services → Library.
- Search for "PageSpeed Insights API" and click Enable.
- Create an API key:
- Go to APIs & Services → Credentials.
- Click Create Credentials → API Key.
- Copy the generated key and set it as
GOOGLE_API_KEYin your configuration.
[Google Cloud Console API Key Setup]
⚙️ Claude Desktop Configuration
Config paths: macOS ~/Library/Application Support/Claude/claude_desktop_config.json · Windows %APPDATA%\Claude\claude_desktop_config.json · Linux ~/.config/claude/claude_desktop_config.json — see ⚙️ Client Configuration above for the JSON. Restart Claude Desktop after editing.
💻 Usage
After configuration, simply ask Claude any of these commands:
🔍 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
Available Tools (v2)
Version 2 replaces the former 19 endpoint-shaped tools with six workflow tools. This is a breaking change: update MCP client prompts, saved tool calls, and integrations to use the names below. Every data-returning tool accepts responseFormat (markdown, default, or json) and returns MCP structuredContent.
Migration from v1
Examples
Example
answer example from Claude Desktop with pagespeed-insights-mcp 🔥🔥🔥
MCP Prompts (Slash Commands)
This server exposes built-in MCP Prompts that appear automatically in the prompt / slash menu (/) in Claude Desktop, Cursor, and Cline:
MCP Resources
Access reference guides and local state directly through standard MCP resource URIs:
✨ Rich Visual & Aesthetic Outputs
Outputs returned to Claude Desktop, Cursor, and Cline feature rich aesthetic formatting:
- Unicode Score Bars: Gauge progress visualization (e.g.
\█████████████░░░` 85/100 🟢 (Good)`). - Core Web Vitals Scorecard: Clean status-badged tables with official 2026 targets (
🟢 Good,🟡 Needs Improvement,🔴 Poor). - README Shield Badges: Direct copy-paste markdown badges for your repository (
[](https://pagespeed.web.dev)). - Modernized Mermaid Architecture Maps: High-contrast, dark-mode friendly flowcharts with color-coded nodes.
Development
For better log formatting during development, it is recommended to install pino-pretty globally:
Logging / pino-pretty in MCP environments
This MCP server uses pino for logging and enables the pino-pretty transport when NODE_ENV=development.
- If you just want it to work with minimal setup (Claude, Codex, etc.), set:
or in your MCP config:
- If you want pretty logs in development via
npx, you can havenpxinstallpino-prettyalongside the server:
Troubleshooting
"Google API key not provided"
Ensure the GOOGLE_API_KEY environment variable is set in your Claude Desktop configuration.
"PageSpeed Insights API error: 403"
Check if PageSpeed Insights API is enabled in your Google Cloud project.
"Invalid URL"
Ensure the URL includes the protocol — only http:// and https:// are accepted. Other schemes (file://, ftp://, javascript:, etc.) are rejected at the schema level.
Requirements
- Node.js 20.19.0 or later (Node 18 is EOL since April 2025 and is no longer supported).
- A Google API key with PageSpeed Insights and (optionally) Chrome UX Report APIs enabled.
Security
Please report security issues privately — do not open a public issue. See SECURITY.md for the disclosure policy and operator hardening notes.
Acknowledgments
Special thanks to @engmsaleh (Mohamed Saleh Zaied) for his significant contribution to the development of this project.
A very special thank you to @system-conf for their outstanding and invaluable contribution to the growth and development of this project. Your dedication, expertise, and continuous support have made a tremendous impact — this project wouldn't be where it is today without you. 🙏
License
Apache-2.0 — see LICENSE. Patents granted by contributors under the Apache License 2.0.
Support
For bug reports or feature requests, please create an issue in the repository.
来源:README.md,提交 5adf263
工具
0版本历史
4- v2.2.0最新Oct 20, 2026
- v2.1.2Oct 17, 2026
- v2.1.1Oct 13, 2026
- v2.1.0Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分