Skip to main content
Glama
Core Web Vitals MCP Server

Core Web Vitals MCP Server

by surendranb

Core Web Vitals MCP Server (core-web-vitals-mcp)

FastMCP server exposing Google Chrome User Experience Report (CrUX) and PageSpeed Insights APIs for real-user Core Web Vitals (LCP, INP, CLS), 28-day field history trends, and Lighthouse lab performance audits.

The definitive Core Web Vitals diagnostics engine for AI coding agents (Claude, Cursor, Copilot, Antigravity).


1. Quickstart

Run directly without installing via uvx (Python) or npx (Node):

Via Python (uvx)

uvx core-web-vitals-mcp

Via Node (npx)

npx -y core-web-vitals-tools-mcp

Related MCP server: @pulspeed/mcp-server

2. MCP Client Configuration

Add to your MCP client config (claude_desktop_config.json, cursor.json, or Antigravity):

{
  "mcpServers": {
    "core-web-vitals": {
      "command": "uvx",
      "args": ["core-web-vitals-mcp"],
      "env": {
        "GOOGLE_API_KEY": "your_google_api_key_here"
      }
    }
  }
}

Or using npx:

{
  "mcpServers": {
    "core-web-vitals": {
      "command": "npx",
      "args": ["-y", "core-web-vitals-tools-mcp"],
      "env": {
        "GOOGLE_API_KEY": "your_google_api_key_here"
      }
    }
  }
}

3. Google API Authentication & Keyless Mode

  • Works Keyless Out-of-the-Box: PageSpeed Insights lab audits (audit_pagespeed) run with zero API keys and zero configuration.

  • Chrome UX Report (CrUX): 28-day field data requires a free Google Cloud API key (up to 150 requests/minute). When running keyless, the server gracefully returns synthetic lab metrics and instructs your AI agent how to enable field data.

  • Built-in Client Throttling: Automatically throttles requests (1.5s for keyless PageSpeed, 0.5s for keyed PageSpeed, 0.4s for CrUX) and caches repeated queries to strictly honor Google's free usage limits and prevent HTTP 429 errors.

To configure an API key:

  1. Follow the official Google guide: PageSpeed Insights API - Get Started (API Key).

  2. Or call skill_read(name="google-api-setup") directly from your AI agent for step-by-step instructions.

  3. Set your environment variable:

    export GOOGLE_API_KEY="AIzaSy..."
    # or
    export CRUX_API_KEY="AIzaSy..."

4. Tools

Tool

Parameters

Description

get_crux_metrics

url, form_factor="ALL_FORM_FACTORS", api_key

Query Google CrUX API for real-user field metrics: LCP, INP, CLS, FCP, TTFB, and overall Core Web Vitals assessment. Falls back to PageSpeed when keyless.

get_crux_history

url_or_origin, form_factor, api_key

Query Google CrUX History API for 28-day historical field metric trends across 25+ weekly collection periods.

audit_pagespeed

url, strategy="mobile", api_key

Run Google PageSpeed Insights lab audit for Lighthouse performance score (0-100), Speed Index, TBT, LCP, and top savings opportunities (works keyless!).

doctor

api_key

Diagnostic utility verifying Google API key configuration, testing endpoint connectivity, and verifying test bed readiness.

skills_list

(none)

Lists dynamic Core Web Vitals diagnostic, remediation, and setup playbooks.

skill_read

name

Fetches operational engineering playbooks: google-api-setup, lcp-optimization, inp-debugging, or cls-remediation.

check_for_updates

force=False

Queries PyPI for newer versions and upgrade commands.


5. Playbook Skills

The server dynamically dissociates actionable engineering playbooks from the core runtime:

  • google-api-setup: Official setup guide to obtain a free Google Cloud API key, enable CrUX/PageSpeed APIs, and manage free usage limits per developers.google.com.

  • lcp-optimization: 4-phase breakdown (TTFB, Load Delay, Load Duration, Render Delay), image format conversion, preloading, and render blocking mitigation.

  • inp-debugging: Interactive latency breakdown (Input Delay, Processing, Presentation Delay), task chunking with scheduler.yield(), and long task mitigation.

  • cls-remediation: Aspect-ratio reservation, fallback font metric overrides (size-adjust), and layout stability patterns.


6. Telemetry & Privacy

This package includes anonymous usage telemetry to ensure reliability and detect runtime bugs across different client harnesses. Telemetry adheres strictly to Schema v2:

  • Opt-Out: Strictly respects DO_NOT_TRACK=1, DISABLE_TELEMETRY=1, MCP_TELEMETRY_OPT_OUT=1, or CORE_WEB_VITALS_TELEMETRY=false.

  • Zero PII: No user URLs, personal identifiers, or authentication keys are ever captured.

Available Tools

7 tools
audit_pagespeedB

Run a Google PageSpeed Insights lab audit for synthetic Lighthouse performance scores and diagnostics.

Returns overall performance score (0-100), Speed Index, Total Blocking Time (TBT), Largest Contentful Paint (LCP), and prioritized remediation opportunities.

Args: url: URL of the web page to audit (e.g. 'https://surendranb.com'). strategy: Analysis strategy ('mobile' or 'desktop'). Defaults to 'mobile'. api_key: Optional Google API Key. If omitted, checks GOOGLE_API_KEY or PAGESPEED_API_KEY.

Inputs: url (required), api_key, strategy. Returns: result

check_for_updatesC

Check PyPI for the latest version of core-web-vitals-mcp.

Inputs: force. Returns: result

doctorB

Validate Google Cloud API credentials, test endpoint reachability, and check test beds.

Args: api_key: Optional Google API Key to test directly.

Inputs: api_key. Returns: result

get_crux_historyA

Query Google Chrome UX Report History API for 28-day historical field metric trends.

Provides timeseries percentiles for LCP, INP, CLS, FCP, and TTFB across 25+ weekly collection periods.

Args: url_or_origin: Web page URL or origin domain (e.g. 'https://surendranb.com'). form_factor: Optional device filter ('ALL_FORM_FACTORS', 'PHONE', 'DESKTOP', 'TABLET'). api_key: Optional Google API Key. If omitted, checks GOOGLE_API_KEY or CRUX_API_KEY environment variables.

Inputs: url_or_origin (required), api_key, form_factor. Returns: result

get_crux_metricsA

Query Google Chrome User Experience Report (CrUX) API for real-user field metrics.

Returns 75th percentile ratings for LCP, INP, CLS, FCP, TTFB, and overall Core Web Vitals assessment.

Args: url: Page URL (e.g. 'https://surendranb.com/blog/article') or root origin ('https://surendranb.com'). form_factor: Device form factor filter ('ALL_FORM_FACTORS', 'PHONE', 'DESKTOP', 'TABLET'). Defaults to ALL_FORM_FACTORS. api_key: Optional Google API Key. If omitted, checks GOOGLE_API_KEY or CRUX_API_KEY environment variables.

Inputs: url (required), api_key, form_factor. Returns: result

skill_readA

Read a specialized Core Web Vitals optimization playbook (e.g. 'lcp-optimization', 'inp-debugging', 'cls-remediation').

Args: name: Name of the skill to read. Call skills_list to view available playbooks.

Inputs: name (required). Returns: result

skills_listA

List available Core Web Vitals diagnostic and remediation playbooks (LCP, INP, CLS).

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 7 tools

    Disambiguation4/5

    The core analysis tools are clearly separated by data source and shape: lab vs. field (audit_pagespeed vs. get_crux_metrics) and snapshot vs. timeseries (get_crux_metrics vs. get_crux_history). The two CrUX tools share a prefix and domain, which could cause a mild misselection, but descriptions make the distinction explicit. The remaining operational tools (doctor, check_for_updates) are unambiguous.

    Naming Consistency3/5

    Most tools follow verb_noun (get_crux_history, get_crux_metrics, audit_pagespeed, check_for_updates), but skill_read and skills_list invert to noun_verb and 'doctor' is a bare noun with no action verb. The pattern is readable but not uniform, so an agent cannot reliably predict a name from an intended action.

    Tool Count4/5

    Seven tools is a well-scoped size for a Core Web Vitals server, and no tool is redundant. Two of the seven (doctor, check_for_updates) serve the package itself rather than CWV analysis, which makes the analytical surface slightly thinner than the count suggests.

    Completeness4/5

    Coverage spans both major data planes (CrUX field metrics snapshot plus history timeseries) and lab diagnostics, with playbooks for remediation guidance and a credential/connectivity check. Gaps are minor: no batch or multi-URL comparison, no explicit mapping between audit opportunities and the referenced skills, and no export of raw percentile data beyond what the two CrUX tools return.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to perform comprehensive web performance analysis using Google's PageSpeed Insights API, including metrics, best practices, SEO, and accessibility audits.
      44 npm
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Connects LLMs to Google PageSpeed Insights to analyze web performance, accessibility, SEO, and best practices, enabling AI assistants to audit and improve any web page.
      10
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to analyze public websites, follow progress, retrieve shareable reports, compare multiple URLs, list checks and recent activity, and surface fixes ranked by impact.
      Apache 2.0