Getting Started
This guide will help you set up the PageSpeed Insights MCP server and connect it to your MCP client (like Claude Desktop).
Prerequisites
Before you begin, ensure you have the following:
- Node.js: Version 18 or higher.
- Google API Key: Required to access the PageSpeed Insights API.
Obtaining a Google API Key
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to APIs & Services > Library.
- Search for "PageSpeed Insights API" and enable it.
- Go to APIs & Services > Credentials.
- Click Create Credentials > API Key.
- Copy the generated key.
Installation
You can run the server using npx (recommended), install it globally via npm, or use Docker.
Option 1: Using npx (Recommended)
You can run the server directly without installation:
Option 2: Global Installation
Install the package globally using npm:
Then run it:
Option 3: Docker
Build and run the container:
docker build -t pagespeed-insights-mcp .
docker run -e GOOGLE_API_KEY=your-key pagespeed-insights-mcp
Configuration
The server requires the GOOGLE_API_KEY environment variable.
| Variable | Description | Required | Default |
|---|---|---|---|
GOOGLE_API_KEY |
Your Google PageSpeed Insights API Key | Yes | - |
LOG_LEVEL |
Logging level (trace, debug, info, warn, error) | No | info |
MAX_CONCURRENCY |
Max concurrent requests | No | 3 |
REQUEST_TIMEOUT |
Request timeout in ms | No | 30000 |
CACHE_TTL |
Cache time-to-live in seconds | No | 3600 |
Connecting to Claude Desktop
To use this server with Claude Desktop, you need to configure the claude_desktop_config.json file.
File Location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
Configuration:
Add the following to your configuration file:
{
"mcpServers": {
"pagespeed-insights": {
"command": "npx",
"args": [
"-y",
"pagespeed-insights-mcp"
],
"env": {
"GOOGLE_API_KEY": "your-google-api-key-here"
}
}
}
}
Windows Users
If you are on Windows, make sure to use the full path to the executable if npx is not in your PATH, or use the Docker method.
After updating the configuration, restart Claude Desktop. You should now see the PageSpeed tools available in the interface.
Usage Examples
Once connected, you will see a list of available tools in your MCP client.

You can ask Claude to analyze a website, and it will use these tools to provide a comprehensive report.
