PageSpeed性能分析服务器添加福利群:解决AI开发者的「MCP实战痛点」一个扩展了 AI 助手功能的 Model Context Protocol (MCP) 服务器,通过 PageSpeed Insights 功能实现。该服务器充当 AI 模型与 Google 的 PageSpeed Insights API 之间的桥梁,能够对网站进行详细的性能分析。
PageSpeed MCP 服务器旨在通过允许 AI 助手执行全面的网页性能分析来增强其能力。集成后,AI 模型可以请求并解释任何给定 URL 的详细性能指标、核心 Web 指标和其他关键的网页性能数据。
要通过 Smithery 自动为 Claude Desktop 安装 PageSpeed 服务器:
npx -y @smithery/cli install mcp-pagespeed-server --client claude
npm install pagespeed-mcp-server
将 PageSpeed MCP 添加到您的 AI 助手(此处以 claude 为例)的配置文件中:
{
"pagespeed": {
"command": "node",
"args": ["path/to/mcp-pagespeed-server/dist/index.js"]
}
}

MCP 服务器提供详细的 JSON 响应,包括:
{
"lighthouseResult": {
"categories": {
"performance": { /* Performance metrics */ },
"accessibility": { /* Accessibility results */ },
"best-practices": { /* Best practices audit */ },
"seo": { /* SEO findings */ }
},
"audits": {
// Detailed audit results for each category
},
"timing": {
// Performance timing data
},
"stackPacks": {
// Technology-specific advice
}
}
}

您可以通过提供额外参数来自定义 PageSpeed 分析:
{
"strategy": "mobile", // or "desktop"
"category": ["performance", "accessibility", "best-practices", "seo"],
"locale": "en",
"threshold": {
"performance": 90,
"accessibility": 100,
"best-practices": 90,
"seo": 90
}
}

MCP 服务器包含强大的错误处理功能,包括:
const PageSpeedMCP = require('pagespeed-mcp-server');
const mcp = new PageSpeedMCP();
await mcp.analyze('https://example.com');

const results = await mcp.analyze('https://example.com', {
strategy: 'mobile',
categories: ['performance', 'accessibility'],
locale: 'en-US'
});

连接超时
API 速率限制
内存问题
git clone https://github.com/PhialsBasement/Pagespeed-MCP-Server
cd mcp-pagespeed-server
npm install
npm run build

npm run test

MIT 许可证 - 详情请参见 LICENSE 文件