MCP server for performing PageSpeed Audits
npm install mcp-pagespeed-serverA Model Context Protocol (MCP) server that extends AI assistant capabilities with PageSpeed Insights functionality. This server acts as a bridge between AI models and Google's PageSpeed Insights API, enabling detailed performance analysis of websites.
The PageSpeed MCP server is designed to enhance AI assistants' capabilities by allowing them to perform comprehensive web performance analysis. When integrated, AI models can request and interpret detailed performance metrics, Core Web Vitals, and other critical web performance data for any given URL.
``bash`
npm install pagespeed-mcp-server
Add the PageSpeed MCP to your AI assistant's(claude in this case) configuration file:
`json`
{
"pagespeed": {
"command": "node",
"args": ["path/to/mcp-pagespeed-server/dist/index.js"]
}
}
The MCP server provides detailed JSON responses including:
`javascript`
{
"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
}
}
}
`json`
{
"strategy": "mobile", // or "desktop"
"category": ["performance", "accessibility", "best-practices", "seo"],
"locale": "en",
"threshold": {
"performance": 90,
"accessibility": 100,
"best-practices": 90,
"seo": 90
}
}
javascript
const PageSpeedMCP = require('pagespeed-mcp-server');
const mcp = new PageSpeedMCP();await mcp.analyze('https://example.com');
`$3
`javascript
const results = await mcp.analyze('https://example.com', {
strategy: 'mobile',
categories: ['performance', 'accessibility'],
locale: 'en-US'
});
`Troubleshooting
$3
1. Connection Timeouts
- Check internet connectivity2. API Rate Limiting
- Use API key for higher limits
3. Memory Issues
- Adjust Node.js memory limits
Development
$3
`bash
git clone https://github.com/phialsbasement/mcp-pagespeed-server
cd mcp-pagespeed-server
npm install
npm run build
`$3
`bash
npm run test
``MIT License - See LICENSE file for details