Model Context Protocol

Connect AI Agents to
Lighthouse Audits

PageSpeed Exporter exposes an MCP server so Claude Desktop, LangChain, AutoGen, and any MCP-compatible client can run live Google Lighthouse audits on any URL — directly inside your AI workflow.

What the analyze_url tool returns

One tool call returns the stripped AIReport and a score-plan summary. The connected agent edits the project, calls analyze_url again, and stops when every lab target is met. The fix_all_issues prompt starts that loop. strategy: "both" is Starter and Pro and counts as two reports.

  • ✓Scores (0–100) — Performance, Accessibility, Best Practices, SEO
  • ✓Core Web Vitals — LCP, FCP, CLS, TBT, Speed Index, TTI — with exact timings and pass/fail status
  • ✓Real-user data — CrUX field data (p75 LCP, FID, CLS) with Fast / Moderate / Slow rating
  • ✓Score plan — Lab metrics ranked by points at risk, with the value that scores about 90
  • ✓Exact culprits — Selectors, source modules, LCP subparts, and third-party ownership for each failing issue
  • ✓Fix loop — Edit the project, call analyze_url again, and stop only when the targets are met

Add to Claude Desktop

Sign in and create a token on your account page. Claude Desktop supports MCP servers natively. Add the token to your claude_desktop_config.json:

macOS / Linux

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%\Claude\claude_desktop_config.json

Configuration

{
  "mcpServers": {
    "pagespeed-exporter": {
      "url": "https://speedexporter.com/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_ACCOUNT_TOKEN"
      }
    }
  }
}

Create the token on your account page. Audits count against that plan's monthly report allowance, the same allowance the website uses. Restart Claude Desktop after saving.

Example prompts for Claude

Once connected, try prompts like:

Use fix_all_issues on https://mysite.com and keep auditing until every Lighthouse issue is fixed
Audit https://mysite.com on mobile, edit the highest points-at-risk metric, then run the audit again
Run strategy both on https://example.com and fix the issues that fail on either device
Why is my LCP so high? Audit https://mysite.com and change the LCP element in this project

Programmatic / Agent frameworks

The MCP endpoint is a standard HTTP JSON-RPC 2.0 server. Use it with LangChain, AutoGen, CrewAI, or any framework that supports OpenAPI or direct HTTP tool calls.

Step 1 — Initialise the session

POST https://speedexporter.com/api/mcp

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {},
    "clientInfo": { "name": "my-agent", "version": "1.0" }
  }
}

Step 2 — Call the tool

POST https://speedexporter.com/api/mcp

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "analyze_url",
    "arguments": {
      "url": "https://example.com",
      "strategy": "mobile"
    }
  }
}

Tool schema

Retrieve the full tool definition at any time with tools/list:

{
  "name": "analyze_url",
  "inputSchema": {
    "type": "object",
    "required": ["url"],
    "properties": {
      "url":      { "type": "string" },
      "strategy": { "type": "string", "enum": ["mobile", "desktop", "both"], "default": "mobile" }
    }
  }
}

Further reading