crux-mcp
v1.0.0
Published
An MCP (Model Context Protocol) server for the [Chrome UX Report (CrUX) API](https://developer.chrome.com/docs/crux/api). This server allows your AI coding agents, editors, and chat interfaces to retrieve real-world performance metrics (Core Web Vitals) f
Readme
crux-mcp
An MCP (Model Context Protocol) server for the Chrome UX Report (CrUX) API. This server allows your AI coding agents, editors, and chat interfaces to retrieve real-world performance metrics (Core Web Vitals) for specific URLs and origins.
Requirements
You must obtain a CrUX API Key from the Google Cloud Console. Provide it to the server via the CRUX_API_KEY environment variable.
How to get a CrUX API Key
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to APIs & Services > Library and search for Chrome UX Report API.
- Click Enable to enable the API for your project.
- Go to APIs & Services > Credentials.
- Click + Create Credentials and select API key.
- Important: It is highly recommended to click Edit API key, scroll down to API restrictions, select Restrict key, and choose the Chrome UX Report API to scope your key securely.
- Copy the generated API key.
Installation
Automated Installation (CLI Agents)
Gemini CLI
gemini mcp add crux-mcp npx -y crux-mcp -e CRUX_API_KEY="YOUR_CRUX_API_KEY"Claude Code
claude mcp add crux-mcp npx -y crux-mcp
# Claude Code will prompt you to configure any required environment variables.Manual Configuration (Editors & Desktop Apps)
Claude Desktop
Add the following to your claude_desktop_config.json (usually found at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"crux-mcp": {
"command": "npx",
"args": ["-y", "crux-mcp"],
"env": {
"CRUX_API_KEY": "YOUR_CRUX_API_KEY"
}
}
}
}Note: If running from source locally, change the command to node and args to the absolute path of build/index.js.
Cursor
(Note: Cursor currently requires manual GUI configuration and does not support automated CLI installation)
- Open Cursor Settings (
Cmd/Ctrl + ,) - Navigate to Features > MCP Servers
- Click + Add new MCP server
- Configure the server:
- Type:
command - Name:
crux-mcp - Command:
npx -y crux-mcp(or point to your local build path) - Environment Variables: Add
CRUX_API_KEYwith your API key value.
- Type:
- Click Save and wait for the connection indicator to show it's active.
Windsurf
Add the following configuration to your ~/.windsurf/mcp_config.json file:
{
"mcpServers": {
"crux-mcp": {
"command": "npx",
"args": ["-y", "crux-mcp"],
"env": {
"CRUX_API_KEY": "YOUR_CRUX_API_KEY"
}
}
}
}Restart Windsurf for the changes to take effect.
Local Development
If you'd like to build and run this server from the source code:
- Clone the repository and navigate into it.
- Install dependencies:
npm install - Build the TypeScript files:
npm run build - Run the server locally (or configure your MCP client to point to this local build):
CRUX_API_KEY="YOUR_CRUX_API_KEY" npm start
Adding Local Build to CLI Agents
If you are developing locally and want to test the server with your CLI agents, use the local build/index.js path instead of npx:
Gemini CLI
gemini mcp add -e CRUX_API_KEY="YOUR_CRUX_API_KEY" crux-mcp node $(pwd)/build/index.jsClaude Code
claude mcp add crux-mcp node $(pwd)/build/index.jsAvailable Tools
The server provides the following tools to interact with the CrUX API:
get_url_metrics: Evaluate the performance of a specific page.- Required params:
url - Optional params:
formFactor(DESKTOP,PHONE,TABLET),metrics
- Required params:
get_origin_metrics: Evaluate the aggregate performance of an entire website origin.- Required params:
origin - Optional params:
formFactor,metrics
- Required params:
get_url_history: Get 6-month historical data for a specific page.- Required params:
url - Optional params:
formFactor,metrics(Tip: Request only 1-2 metrics to avoid context token limits)
- Required params:
get_origin_history: Get 6-month historical data for an entire website origin.- Required params:
origin - Optional params:
formFactor,metrics
- Required params:
Supported Metrics
cumulative_layout_shiftfirst_contentful_paintinteraction_to_next_paintlargest_contentful_paintexperimental_time_to_first_bytelargest_contentful_paint_resource_typenavigation_typesround_trip_time
License
ISC
