A Lighthouse MCP server lets AI coding agents run live Google PageSpeed Insights audits directly from your terminal or IDE, inspect a stripped AIReport under 50KB, edit the exact source files causing slow Core Web Vitals, and re-scan to verify the fix.
Instead of copying screenshots from pagespeed.web.dev or wrestling with 500KB–2MB raw PSI JSON dumps, your agent calls one MCP tool (analyze_url), reads scorePlan.pointsAtRisk, patches your codebase, and loops until every lab metric hits targetFor90.
Why Use MCP Instead of Manual Lighthouse Exports?
| Workflow | Payload Size | Context Window Impact | Re-scan Loop | Setup |
|---|
| Raw PSI API / CLI JSON | 500 KB – 2 MB | High (screenshots + passing audits) | Scripted | Google API key |
| Downloaded AIReport JSON | Under 50 KB | Low (culprits + scorePlan only) | Re-upload each run | None |
| PageSpeed Exporter MCP | Under 50 KB | Low (tool call in-editor) | Autonomous tool call | 1 account token |
Every analyze_url call returns the same stripped AIReport produced by the web app: 0–100 category scores, Core Web Vitals lab metrics, CrUX real-user field data, scorePlan ranked by pointsAtRisk, fixLocation ownership (code, build-config, server-cdn, third-party, asset), exact culprit selectors/modules, and framework stackPacks.
Step 1: Create Your MCP Account Token
- Sign in at speedexporter.com and open your account dashboard.
- Generate an MCP token and copy it once (only a SHA-256 hash is stored server-side).
- MCP calls share your account's monthly report allowance with the website:
- Free (\$0): 5 mobile reports/month
- Starter (\$9/month): 50 reports/month, Mobile + Desktop + Both
- Pro (\$29/month): 200 reports/month, batch ZIP export
Handshake and discovery calls (initialize, tools/list, prompts/get) are never billed. If you upgrade on the same account later, your existing token immediately picks up the higher allowance with no reconfiguration.
Step 2: Connect Your Coding Agent
Endpoint: https://speedexporter.com/api/mcp (HTTP, JSON-RPC 2.0, MCP spec 2024-11-05).
Claude Code (CLI)
Register the server in a single command:
claude mcp add --transport http pagespeed-exporter \
https://speedexporter.com/api/mcp \
--header "Authorization: Bearer YOUR_ACCOUNT_TOKEN"
See the dedicated Claude Code workflow page for terminal prompts.
Cursor (.cursor/mcp.json)
{
"mcpServers": {
"pagespeed-exporter": {
"url": "https://speedexporter.com/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_ACCOUNT_TOKEN"
}
}
}
}
You can also pair this with our Cursor guide and downloadable rule file (/cursor-rules/pagespeed.mdc).
Windsurf (~/.codeium/windsurf/mcp_config.json)
{
"mcpServers": {
"pagespeed-exporter": {
"serverUrl": "https://speedexporter.com/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_ACCOUNT_TOKEN"
}
}
}
}
VS Code / GitHub Copilot (.vscode/mcp.json)
{
"servers": {
"pagespeed-exporter": {
"type": "http",
"url": "https://speedexporter.com/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_ACCOUNT_TOKEN"
}
}
}
}
Claude Desktop (claude_desktop_config.json)
Add the same mcpServers block to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), then restart Claude Desktop. Full details are on the MCP server documentation page.
Step 3: Run the scorePlan Fix Loop
Once connected, trigger either the built-in fix_all_issues prompt or a direct instruction like:
Call analyze_url on https://staging.example.com with strategy "mobile".
1. Read scorePlan first and list each metric's numericValue, pointsAtRisk, and targetFor90.
2. Edit our project files for every failing issue whose affectsMetrics includes the metric with the largest pointsAtRisk.
3. Use fixLocation, selectors, source modules, and thirdParty/entity ownership so you only edit files we control.
4. Skip passedAuditIds and do not sort by savings.ms.
5. After I deploy the preview branch, call analyze_url again and stop only when every lab metric reaches targetFor90.
Why pointsAtRisk Beats savings.ms
Lighthouse calculates your 0–100 performance score from five weighted lab metrics: TBT (30%), LCP (25%), CLS (25%), FCP (10%), and Speed Index (10%). An opportunity audit reporting savings.ms: 450 does not raise your score if it does not move one of those five metrics. Following scorePlan.pointsAtRisk keeps your agent focused on changes that actually move the score.
Because Lighthouse lab scores naturally vary by roughly ±5 points between runs, verify major fixes on a deployed preview URL rather than guessing from a single local build.
Further Reading
- PageSpeed Exporter MCP Server Docs — full JSON-RPC examples and tool schema
- Lighthouse MCP & JSON for Claude Code — terminal-native workflow
- Lighthouse MCP & JSON for Cline — autonomous VS Code edits
- How to Use Cursor to Fix Core Web Vitals — Cursor MCP + Composer walkthrough
- Plans & Pricing — Free, Starter (\$9/mo), and Pro (\$29/mo)