PageSpeed Insights MCP Server
Allows running Google PageSpeed Insights analysis on a public URL, returning Lighthouse category scores and Core Web Vitals (LCP, FCP, CLS, TBT, TTI) with MOBILE/DESKTOP strategies and summary/scores/metrics filter presets.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PageSpeed Insights MCP Server run a mobile PageSpeed analysis for https://example.com"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PageSpeed Insights MCP Server
An MCP server that gives LLMs the ability to run Google PageSpeed Insights analysis. Exposes a single
purpose-built analyze_pagespeed tool plus a sandboxed jq_query helper for inspecting saved responses.
Setup
git clone https://github.com/sixees/mcp-pagespeed.git
cd mcp-pagespeed && npm installnpm install triggers a prepare script that builds dist/ automatically.
Run npm run build again any time you edit src/ or configs/.
Related MCP server: MCP Server Pagespeed
MCP Configuration
Claude Code
claude mcp add pagespeed -- npx tsx /absolute/path/to/mcp-pagespeed/configs/pagespeed.tsOr add to .mcp.json:
{
"mcpServers": {
"pagespeed": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/mcp-pagespeed/configs/pagespeed.ts"],
"env": {
"PAGESPEED_API_KEY": "your-api-key"
}
}
}
}Claude Desktop
Add to your config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"pagespeed": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/mcp-pagespeed/configs/pagespeed.ts"],
"env": {
"PAGESPEED_API_KEY": "your-api-key"
}
}
}
}Other MCP Clients
Run the server directly on stdio:
npx tsx configs/pagespeed.tsAny MCP client that supports stdio transport can connect by spawning npx tsx /path/to/configs/pagespeed.ts.
Tool: analyze_pagespeed
Analyzes a URL with Google PageSpeed Insights API v5. Returns Lighthouse category scores and Core Web Vitals. Analysis typically takes 15-45 seconds.
Parameters
Parameter | Type | Required | Description |
| string | yes | The URL to analyze (publicly accessible) |
| string | no |
|
| string | no |
|
Filter Presets
scores — Category scores as 0-100 integers:
{
"performance": 87,
"accessibility": 95,
"best_practices": 100,
"seo": 92
}metrics — Core Web Vitals as value/display pairs (value is the raw numericValue from Lighthouse, or
null if Lighthouse omitted the audit; display is Lighthouse's pre-formatted string or "N/A"):
{
"lcp": { "value": 1842.5, "display": "1.8 s" },
"fcp": { "value": 982, "display": "1.0 s" },
"cls": { "value": 0.003, "display": "0" },
"tbt": { "value": 150, "display": "150 ms" },
"tti": { "value": 2100, "display": "2.1 s" }
}summary (default) — Both scores and metrics, plus analyzed_url and strategy. If the trust-boundary
helper had to substitute analyzed_url because the API echoed a different value, a warnings array is
appended (the warnings array is added to every preset shape when present).
Example
{
"url": "https://example.com",
"strategy": "MOBILE",
"filter_preset": "scores"
}Trust boundary
analyze_pagespeed re-validates the URL Google echoes back (data.id) against the URL you submitted on
origin, pathname, and canonicalised search string. On mismatch the tool returns the input URL and appends
a warnings entry ("analyzed_url substituted with the URL you submitted; the API echoed a different value (echo content withheld).") instead of forwarding the API echo. Response bodies are also sanitised
for known prompt-injection patterns before reaching the LLM. See CLAUDE.md ## Security for
the full trust model.
Tool: jq_query
Query saved PageSpeed response files without making new API calls. Provided by the vendored library at
src/lib/; sandboxed to the OS temp directory, the library's output directory, and the current working
directory. Useful when a large response triggers auto-save to file (the analyze_pagespeed handler raises
the inline cap to 2 MB so this is rare in practice).
Environment Variables
Variable | Description |
| Google API key (optional, higher rate limits) |
| When set to |
| When set to |
Without an API key, the PageSpeed API is rate-limited to ~25 queries per 100 seconds.
Security
The server enforces SSRF protection, DNS rebinding prevention, rate limiting, input validation, file access
controls, and resource limits. The general-purpose curl_execute tool is disabled — it still appears in
tools/list (an MCP convention from the vendored library) but returns an error at call time, so only the
purpose-built analyze_pagespeed tool can make HTTP requests.
The server also includes prompt-injection defenses: response sanitisation, detection logging, and a trust-
boundary helper that re-validates the API-echoed URL against the input. See CLAUDE.md
## Security for the full trust model and CHANGELOG.md for version history.
Documentation
Internal library reference:
docs/internal/— for contributors extending the vendored request/security infrastructure undersrc/lib/.
Acknowledgements
This project began as a fork of sixees/mcp-curl and vendored its
HTTP, security, and schema-generation code. The two projects have since diverged and this repository is
independent — src/lib/ is now an internal-only library tracked here. Thanks to the original mcp-curl
contributors for the foundation.
License
MIT
Available Tools
2 toolscurl_executeExecute cURL RequestA
Execute an HTTP request using cURL with structured parameters.
This tool provides a safe, structured way to make HTTP requests with common cURL options. It handles URL encoding, header formatting, and response processing automatically.
Args:
url (string, required): The URL to request
method (string): HTTP method - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
headers (object): HTTP headers as key-value pairs
data (string): Request body for POST/PUT/PATCH requests
form (object): Form data as key-value pairs (multipart/form-data)
follow_redirects (boolean): Follow HTTP redirects (default: true)
max_redirects (number): Maximum redirects to follow (0-50)
insecure (boolean): Skip SSL verification (default: false)
timeout (number): Request timeout in seconds (1-300, default: 30)
user_agent (string): Custom User-Agent header (a browser-like default is sent automatically if not set; empty string disables)
basic_auth (string): Basic auth as "username:password"
bearer_token (string): Bearer token for Authorization header
verbose (boolean): Include verbose request/response details
include_headers (boolean): Include response headers in output
compressed (boolean): Request compressed response (default: true)
include_metadata (boolean): Wrap response in JSON with metadata
jq_filter (string): JSON path filter to extract specific data
max_result_size (number): Max bytes to return inline (default: 500KB, max: 1MB). Auto-saves to file when exceeded
save_to_file (boolean): Force save response to temp file. Returns filepath instead of content
output_dir (string): Custom directory to save files (overrides MCP_CURL_OUTPUT_DIR env var)
jq_filter Syntax:
.key - Object property access
.[n] or .n - Array index (non-negative only, e.g., .results.0)
.[n:m] - Array slice from index n to m
.["key"] - Bracket notation for special characters in keys
.a,.b,.c - Multiple comma-separated paths (returns array of values, max 20)
jq_filter Validation:
Unclosed quotes and brackets throw clear errors
Leading zeros in indices rejected (use .0 not .00)
Negative indices not supported (unlike real jq)
Indices must be within safe integer range
Returns: The HTTP response body, or JSON with metadata if include_metadata is true: { "success": boolean, "exit_code": number, "response": string, "stderr": string (if present), "saved_to_file": boolean (if response was saved), "filepath": string (path to saved file) }
Examples:
Simple GET: { "url": "https://api.example.com/data" }
POST JSON: { "url": "https://api.example.com/users", "method": "POST", "headers": {"Content-Type": "application/json"}, "data": "{"name": "John"}" }
With auth: { "url": "https://api.example.com/secure", "bearer_token": "your-token-here" }
Extract field: { "url": "https://api.github.com/repos/octocat/hello-world", "jq_filter": ".name" }
Multiple fields: { "url": "https://api.example.com/user", "jq_filter": ".name,.email,.id" }
Dot notation: { "url": "https://api.example.com/items", "jq_filter": ".results.0.name" }
Array slice: { "url": "https://api.example.com/items", "jq_filter": ".results[0:10]" }
Custom output: { "url": "https://api.example.com/large", "save_to_file": true, "output_dir": "/path/to/dir" }
Error Handling:
Returns error message if cURL fails or times out
Exit code 0 indicates success
Non-zero exit codes indicate various cURL errors
Invalid JSON with jq_filter returns error with response preview
Temp File Lifecycle: Files saved with save_to_file or auto-save are:
Stored in a secure temp directory (owner-only access: 0o700/0o600)
Deleted on graceful server shutdown (SIGINT/SIGTERM)
Orphaned files from crashed sessions are cleaned on next server start
Check mcp-curl-* in system temp dir if files persist after crash
Inputs: url (required), data, form, method, +16 more.
jq_queryQuery JSON FileARead-onlyIdempotent
Query an existing JSON file with a jq-like filter expression.
This tool allows you to extract data from saved JSON files without making new HTTP requests. Useful for:
Extracting different fields from a large saved response
Applying multiple queries to the same data
Processing any local JSON file within allowed directories
Args:
filepath (string, required): Path to a JSON file to query
jq_filter (string, required): JSON path filter expression
max_result_size (number): Max bytes inline (default: 500KB, max: 1MB)
save_to_file (boolean): Force save result to file
output_dir (string): Custom directory to save result files
Filter Syntax:
.key - Get object property
.[n] - Get array element at index n (non-negative only, also .n with dot notation)
.[n:m] - Array slice from n to m
.["key"] - Bracket notation for keys with special chars
.name,.email - Multiple comma-separated paths (returns array of values, max 20)
Note: Negative indices not supported (unlike real jq)
Security:
Only files in these directories can be read:
Our temp directory (files saved by curl_execute)
MCP_CURL_OUTPUT_DIR environment variable path
Current working directory and ALL subdirectories (broad - ensure cwd is safe)
Maximum file size: 10MB
Examples:
Extract name: { "filepath": "/path/to/response.txt", "jq_filter": ".name" }
Multiple fields: { "filepath": "/path/to/data.json", "jq_filter": ".name,.email,.id" }
Array slice: { "filepath": "/path/to/list.json", "jq_filter": ".items[0:5]" }
Inputs: filepath (required), jq_filter (required), output_dir, save_to_file, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have largely separable roles: curl_execute performs HTTP requests while jq_query reads/query already-saved local JSON files. There is mild overlap because jq_filter appears in both and the typical workflow chains one into the other, but an agent can reasonably tell which to pick.
Both names follow the same subject_action snake_case pattern (curl_execute, jq_query), with the subject naming the underlying utility and the verb naming the operation. No mixed conventions or casing styles.
Two tools is thin for a server branded as a PageSpeed Insights integration, and neither tool is PageSpeed-specific. The surface is essentially a generic HTTP+JSON utility pair rather than a scoped API wrapper.
Nothing in the tool set actually exposes PageSpeed Insights operations — no analyze_url, no strategy/mobile-vs-desktop switch, no API key handling. An agent must hand-construct the PSI endpoint URL and parse Lighthouse results itself, which is a significant gap for the stated purpose.
Maintenance
Related MCP Connectors
Analyze web performance and get optimization insights from GTmetrix, directly in your AI workflow.
Run Google Lighthouse audits on any URL — performance, SEO, accessibility scores.
Bulk PageSpeed Insights and Core Web Vitals (LCP, INP, CLS) for many URLs. Runs on Apify.
Lighthouse scores, Core Web Vitals (LCP, CLS, INP/TBT) and top fixes for any URL, mobile or desktop.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceActs as a bridge between AI models and Google's PageSpeed Insights API, enabling detailed performance analysis of websites.13MIT
- AlicenseBqualityDmaintenanceEnables AI models to analyze webpage performance using the Google PageSpeed Insights API, providing real-time performance scores and improvement suggestions.1174 npm12MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI models to perform Google Lighthouse website performance analysis, including Core Web Vitals, accessibility, SEO audits, and actionable optimization recommendations. Provides comprehensive web performance insights through natural language interactions.4MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform comprehensive web performance analysis using Google's PageSpeed Insights API, including metrics, best practices, SEO, and accessibility audits.44 npmMIT