---
title: "How I Connected PageSpeed Insights to Claude with MCP"
description: "Hands-on: connecting PageSpeed Insights to Claude through an MCP server. Google API key, install, the potholes and what the first test found on a live site."
url: "https://www.it-deweloper.pl/en/blog/pagespeed-insights-mcp"
date: "2026-10-25T08:50:56+00:00"
language: "en-GB"
---

[Skip to main content](#tm-main)

- [ Home](https://www.it-deweloper.pl/en "IT Deweloper web studio home page")
- [Contact](https://www.it-deweloper.pl/en/contact "Contact the IT Deweloper web studio")
    - [ +48 731 190 041](tel:+48731190041 "Phone")
    - [ office<!---->&#64;<!---->it-deweloper.pl](mailto:office<!---->&#64;<!---->it-deweloper.pl "E-mail")
    - [ Nowogródzka 4A, Białystok, Poland](https://maps.app.goo.gl/BNjvryytwRyv4omA7 "Address")
    - [ WhatsApp](https://wa.me/48731190041 "WhatsApp")
    - [ Telegram](https://t.me/+48731190041 "Telegram")
- [Solutions](https://www.it-deweloper.pl/en/web "IT Deweloper's web development solutions")
    - [How we workStages of work](https://www.it-deweloper.pl/en/web/process "Website development stages and timelines")
    - [SEOSearch engine optimization](https://www.it-deweloper.pl/en/web/seo "SEO promotion: optimization, links, positions in Google")
    - [GEOWebsite promotion in AI](https://www.it-deweloper.pl/en/web/geo "GEO optimization: website promotion in ChatGPT, Gemini and Perplexity answers")
    - [AIArtificial intelligence on the website](https://www.it-deweloper.pl/en/web/ai)
    - [JoomlaWebsite management system](https://www.it-deweloper.pl/en/web/joomla "Joomla website development")
    - [GoogleGoogle services setup](https://www.it-deweloper.pl/en/web/google "Google services setup for your website")
- [Cost](https://www.it-deweloper.pl/en/cost "Rates and cost of services")
    - [PricingIndicative website development prices](https://www.it-deweloper.pl/en/cost/pricing "Website development prices")
    - [CalculatorSelf-service online estimate](https://www.it-deweloper.pl/en/cost/calculator "Calculate your website cost online")
    - [BriefGet an accurate project quote](https://www.it-deweloper.pl/en/cost/brief "Fill out the website development brief")
- [Portfolio](https://www.it-deweloper.pl/en/portfolio "Portfolio and examples of our work")
- [About us](https://www.it-deweloper.pl/en/about "About the founder — Victor Parhimchik")
- [FAQ](https://www.it-deweloper.pl/en/faq "Frequently asked questions about website development")
- [Blog](https://www.it-deweloper.pl/en/blog "Articles on website development and promotion")
- [ Русский ](https://www.it-deweloper.pl/ru/blog/pagespeed-insights-mcp)
- [ Polski ](https://www.it-deweloper.pl/pl/blog/pagespeed-insights-mcp)
- [ Беларуская ](https://www.it-deweloper.pl/be/blog/pagespeed-insights-mcp)
- [ English ](https://www.it-deweloper.pl/en/blog/pagespeed-insights-mcp)

  <a class="uk-search-toggle uk-display-block" href="/" uk-search-icon=""></a>

- <a href="/"> ![](https://www.it-deweloper.pl/templates/yootheme/assets/images/language.svg)  English  </a>
    - [ Русский ](https://www.it-deweloper.pl/ru/blog/pagespeed-insights-mcp)
    - [ Polski ](https://www.it-deweloper.pl/pl/blog/pagespeed-insights-mcp)
    - [ Беларуская ](https://www.it-deweloper.pl/be/blog/pagespeed-insights-mcp)
    - [ English ](https://www.it-deweloper.pl/en/blog/pagespeed-insights-mcp)

 [ ![IT-Deweloper](https://www.it-deweloper.pl/images/Faviocon.svg)![IT-Deweloper](https://www.it-deweloper.pl/images/Logo-light.svg)](https://www.it-deweloper.pl/en) [ Menu

 ](#tm-dialog)

- [ Home](https://www.it-deweloper.pl/en "IT Deweloper web studio home page")
- [Contact](https://www.it-deweloper.pl/en/contact "Contact the IT Deweloper web studio")
    - [ +48 731 190 041](tel:+48731190041 "Phone")
    - [ office<!---->&#64;<!---->it-deweloper.pl](mailto:office<!---->&#64;<!---->it-deweloper.pl "E-mail")
    - [ Nowogródzka 4A, Białystok, Poland](https://maps.app.goo.gl/BNjvryytwRyv4omA7 "Address")
    - [ WhatsApp](https://wa.me/48731190041 "WhatsApp")
    - [ Telegram](https://t.me/+48731190041 "Telegram")
- [Solutions](https://www.it-deweloper.pl/en/web "IT Deweloper's web development solutions")
    - [How we workStages of work](https://www.it-deweloper.pl/en/web/process "Website development stages and timelines")
    - [SEOSearch engine optimization](https://www.it-deweloper.pl/en/web/seo "SEO promotion: optimization, links, positions in Google")
    - [GEOWebsite promotion in AI](https://www.it-deweloper.pl/en/web/geo "GEO optimization: website promotion in ChatGPT, Gemini and Perplexity answers")
    - [AIArtificial intelligence on the website](https://www.it-deweloper.pl/en/web/ai)
    - [JoomlaWebsite management system](https://www.it-deweloper.pl/en/web/joomla "Joomla website development")
    - [GoogleGoogle services setup](https://www.it-deweloper.pl/en/web/google "Google services setup for your website")
- [Cost](https://www.it-deweloper.pl/en/cost "Rates and cost of services")
    - [PricingIndicative website development prices](https://www.it-deweloper.pl/en/cost/pricing "Website development prices")
    - [CalculatorSelf-service online estimate](https://www.it-deweloper.pl/en/cost/calculator "Calculate your website cost online")
    - [BriefGet an accurate project quote](https://www.it-deweloper.pl/en/cost/brief "Fill out the website development brief")
- [Portfolio](https://www.it-deweloper.pl/en/portfolio "Portfolio and examples of our work")
- [About us](https://www.it-deweloper.pl/en/about "About the founder — Victor Parhimchik")
- [FAQ](https://www.it-deweloper.pl/en/faq "Frequently asked questions about website development")
- [Blog](https://www.it-deweloper.pl/en/blog "Articles on website development and promotion")

  [ IT Deweloper Blog ](https://www.it-deweloper.pl/index.php?option=com_content&view=category&id=29&lang=en-GB "IT Deweloper Blog")

#  How I Connected PageSpeed Insights to Claude with MCP

In September 2026 I connected PageSpeed Insights to Claude through an MCP server. Checking website speed by hand always goes the same way: open the report, wait for the test, wade through a dozen metrics, and a week later forget what the numbers were. I wanted to hand that job to an assistant: let it run the test, compare pages and explain what is slowing the site down. Below is the whole path: the Google key, the installation, registering the server in Claude Code, the first results on our own site and the potholes I hit.

---

![A terminal window and the PageSpeed Insights logo with a speedometer: connecting website speed testing to an AI assistant](https://it-deweloper.pl/images/blog/pagespeed-insights-mcp-cover-2x.webp#joomlaImage://local-images/blog/pagespeed-insights-mcp-cover-2x.webp?width=2400&height=2400)

## What this server is and why bother

MCP (Model Context Protocol) is an open protocol that lets an AI assistant call external tools; I covered it in more detail in the post about [connecting Search Console](https://www.it-deweloper.pl/en/blog/google-search-console-mcp). What matters here is simple: an MCP server is a go-between program on your computer. On one side it talks to the assistant, on the other it queries the Google PageSpeed Insights API, the same Lighthouse engine that powers the report on the PageSpeed website. Claude asks for a test on its own, gets the numbers and interprets them, and all I have to do is ask questions in plain words.

The server also does things the web version does not: it compares two pages, tests up to ten addresses at once, and stores a baseline measurement to check new results against.

## Which server I chose and what I checked before installing

I picked **pagespeed-insights-mcp**, an npm package written in TypeScript, version 2.1.0. Three things decided it:

- **Six clear tools instead of a sprawl.** Page analysis, diagnosis through a single “lens”, real-user data, comparison, batch testing and a cache reset. Nothing extra.
- **Ready-made reports for the task.** Instead of Google’s raw 850 KB response you get a summary, a fix list sorted by importance or a breakdown of render-blocking resources. That is easier for the model and uses fewer tokens.
- **Short, readable code.** You can review it in an evening instead of guessing what someone else’s program does.

I read all of the code before installing, which is my habit with any MCP server. It is licensed under Apache-2.0. The network footprint is two Google addresses only: the PageSpeed Insights service and Chrome UX Report. The API key is stripped from logs and error messages, retries back off with growing pauses, no more than three requests run in parallel, and responses are cached for an hour. Why this kind of review is not a formality is covered in the post [on AI tool security](https://www.it-deweloper.pl/en/blog/ai-tool-security-check).

## Step 1. The Google key: separate and restricted

The service is free but will not run without a key: the shared anonymous quota is used up, and my very first request returned error 429, meaning the request limit was exceeded. You need an API key from a Google Cloud project.

1. In your Google Cloud project, enable the **PageSpeed Insights API**. I already had a project, the same one used for Google Analytics and Search Console, and this API was already enabled in it.
2. Under “Credentials”, create an **API key** and give it a clear name.
3. In the key restrictions, choose “Restrict key” and tick the interfaces you need, instead of leaving “Don’t restrict key”.

I did not extend any of the project’s existing keys: each has its own job, and the key for indexing should not be able to reach speed tests. A separate key is also a separate revocation: if something goes wrong you switch off one key instead of working out which services depend on it. I set no restriction by IP address or website, since the server runs on my computer with a changing address.

One pitfall cost me an extra round: the **Chrome UX Report API**, which provides real-visitor data, is switched off in the project by default, even when PageSpeed already works. Until you enable it and add it to the key restrictions, the real-user tool answers with a 403 and the reason `API_KEY_SERVICE_BLOCKED`. Checking this with a direct request to the API is more reliable than guessing from the server’s message.

## Step 2. Installation

You need Node.js version 20.19 or newer. Check it:

```
node --version
```

Install the package globally:

```
npm install -g pagespeed-insights-mcp
```

The installation took about 20 seconds and pulled in 127 dependency packages. A program called `pagespeed-insights-mcp` appeared on the command line, and that is the server. You do not need to start it by hand: Claude launches it.

## Step 3. Registering it in Claude Code

The key is passed through an environment variable. In PowerShell:

```
$k = "your_google_key"
claude mcp add `
  pagespeed-insights -s user `
  -e "GOOGLE_API_KEY=$k" `
  -e NODE_ENV=production `
  -- pagespeed-insights-mcp
```

The `-s user` flag writes the entry to the user configuration rather than the project file: the project folder syncs to the cloud, and the key has no business being there. `NODE_ENV=production` switches the logs from coloured text to compact JSON, which is easier to analyse if something goes wrong. Now check it:

```
claude mcp list
```

“Connected” appeared next to `pagespeed-insights`. Then came the story familiar from Search Console: an already open session has no new tools, because the list is loaded at start. Also, “Connected” only means the process started and answered the handshake, not that the key works and the API is enabled. So I first tested the key with an ordinary request to the PageSpeed API: a 200 response and a full report for the home page. Only then did I open a new session.

## The six tools in plain words

- **Page analysis.** A full Lighthouse test: scores for speed, accessibility, SEO and best practices. You can ask for a summary, a full breakdown or a fix list by priority.
- **Diagnosis.** One “lens” of your choice: render-blocking resources, images, scripts, third-party code, network, visual loading, page elements.
- **Real-user data.** Metrics from the Chrome UX Report: what live visitors experience, not a lab measurement.
- **Comparison.** Two pages against each other, or a page against its own earlier measurement; the baseline is stored in a file in the user’s home folder.
- **Batch testing.** Up to ten addresses in one call, with a summary for each.
- **Cache reset.** The server keeps responses for an hour; after you change the site, reset the cache or you will get an old measurement.

## What the first run showed on my own site

I tested the studio’s home page with the mobile profile. Scores: performance 66–71 out of 100 (varying between runs), accessibility 90, best practices 100, SEO 100. The weakest spots among Google’s main metrics (Core Web Vitals) were the time until the main block appears (LCP), 5.0–5.3 s against a target of 2.5 s or less, and the layout shift during loading (CLS), around 0.13 against a target of 0.1 or less.

The render-blocking diagnosis named ten files: template styles and scripts the browser must download before it can show the page. Together they delayed rendering by about 1.9 s. The heaviest were the theme’s main stylesheet (about 81 KB) and the UIkit script (about 50 KB). On top of that came unused code, roughly 101 KB of styles and 49 KB of scripts, and, as a separate line, needless redirects costing about 0.75 s. This is the page builder’s template, not my own code, so the fix lies in build and cache settings rather than in editing files.

Testing two pages at once showed a spread that is easy to miss by hand: the home page scored 69 and the SEO page 85 (LCP 3.2 s, no layout shifts). Comparing the Russian and English home pages gave 66 versus 71. The Chrome report returned no real-user data for the domain, only “insufficient traffic”. For a small site that is normal, not a fault: only addresses with enough Chrome visits make it into the report.

## The potholes I hit

- **429 without a key.** Google’s anonymous quota is shared and almost always used up, so “trying it without a key” is not an option.
- **403 on real-user data.** A key restricted to one interface will not let another through: enable the Chrome UX Report API separately and add it to the key restrictions.
- **No new tools in the old session.** After `claude mcp add`, open a fresh session.
- **Scores wander.** The measurement is a lab test on a reference phone, and a few points of difference between runs is normal: I got 66 and 71 on the same page. One run proves nothing. The tools have a “number of runs” parameter (up to five), and the server itself waits about a minute between runs, otherwise Google would return the same result.
- **A one-hour cache.** Fixed the site? Reset the server’s cache before measuring, or you will be comparing yourself with yourself.
- **The “changes data” flag on comparison is about a local file.** It refers only to the baseline file in your home folder. The tool does not touch your site or any Google service.

## What proved useful and what did not

- **Works right away:** finding the causes of slowness, a fix list by importance, comparing pages of one site, batch testing. The assistant picks the right tool for the question and translates the report out of jargon.
- **Needs preparation:** real-user data means enabling one more API and having enough traffic.
- **With caveats:** this is measuring, not treating. The server changes nothing on the site. It shows what slows it down, and fixing it is still up to you or a developer. What you gain is a fix list in a minute instead of half an hour in a report.
- **Always remember:** only public pages are tested. A customer account or anything behind a password is invisible to the service.

## Quick checklist

1. Make sure Node.js 20.19 or newer is installed.
2. Enable the PageSpeed Insights API (and the Chrome UX Report API if you want real-user data).
3. Create a separate API key and restrict it to the interfaces you need.
4. Install the `pagespeed-insights-mcp` package with npm.
5. Register the server with `claude mcp add` in the user scope.
6. Test the key with an ordinary request and open a new Claude session.
7. For a before-and-after comparison, ask for three to five runs instead of one.

If you would rather not walk this path yourself, we can [connect PageSpeed Insights to an AI assistant for you](https://www.it-deweloper.pl/en/web/ai/pagespeed-ai) — on your computer or in your company cloud.

21 September 2026 | [Victor Parhimchik](https://www.it-deweloper.pl/index.php?option=com_contact&view=contact&id=1&catid=4) | [IT Deweloper Blog](https://www.it-deweloper.pl/index.php?option=com_content&view=category&id=29)

 [ ![A database icon in a browser window, a step checklist and a question mark — a guide to first queries on GA4 data in BigQuery](https://www.it-deweloper.pl/images/blog/ga4-bigquery-first-query-cover.webp)

### How to Write Your First Query on GA4 Data in BigQuery

Once Google Analytics 4 is linked to BigQuery, raw events appear in your warehouse every day: every page view, click and enquiry with all its paramet…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=300:ga4-bigquery-first-query&catid=29&lang=en-GB)

 [ ![A gateway arch with an arrow in a browser window, a step checklist and a question mark — an explanation of how Google tag gateway works](https://www.it-deweloper.pl/images/blog/how-google-tag-gateway-works-cover.webp)

### How Google Tag Gateway Works and Whether to Turn It On

Google tag gateway is a feature that lets you load Google tags from your own domain instead of Google’s servers. It’s often described as a way to “by…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=299:how-google-tag-gateway-works&catid=29&lang=en-GB)

 [ ![A speed gauge with a needle in a browser window, a step checklist and a question mark — a guide to checking Core Web Vitals](https://www.it-deweloper.pl/images/blog/check-core-web-vitals-cover.webp)

### How to Check Your Core Web Vitals and Read the Numbers

Core Web Vitals are three metrics Google uses to judge how comfortable a page is to use: how quickly the main content appears, how quickly the page r…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=298:check-core-web-vitals&catid=29&lang=en-GB)

 [ ![An envelope in a browser window, a step checklist and a question mark — a guide to setting up SPF, DKIM and DMARC for Google Workspace](https://www.it-deweloper.pl/images/blog/google-workspace-spf-dkim-dmarc-cover.webp)

### How to Set Up SPF, DKIM and DMARC for Google Workspace

If emails from your domain land in spam or don’t arrive at all, the first thing to check is three DNS records: SPF, DKIM and DMARC. Since 2024, Gmail…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=297:google-workspace-spf-dkim-dmarc&catid=29&lang=en-GB)

 [ ![A shield with a padlock in a browser window, a step checklist and a question mark — a guide to choosing reCAPTCHA and getting keys](https://www.it-deweloper.pl/images/blog/choose-recaptcha-version-cover.webp)

### How to Choose reCAPTCHA for a Form and Get the Keys

reCAPTCHA protects your website forms from spam bots. During 2025, Google moved all reCAPTCHA keys to Google Cloud, so many older guides are out of d…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=296:choose-recaptcha-version&catid=29&lang=en-GB)

 [ ![A map pin in a browser window, a step checklist and a question mark — a guide to embedding a Google map on a website](https://www.it-deweloper.pl/images/blog/embed-google-map-on-website-cover.webp)

### How to Embed a Google Map on Your Website Without an API Key

A map on your Contact page helps customers see where you are and get directions straight away. You don’t need an API key or a payment card in Google…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=295:embed-google-map-on-website&catid=29&lang=en-GB)

 [ ![A target with an arrow in a browser window, a step checklist and a question mark — a guide to checking Google Ads conversions](https://www.it-deweloper.pl/images/blog/check-google-ads-conversions-cover.webp)

### How to Check That Google Ads Conversions Are Tracked

Google Ads learns from conversions: enquiries, calls, purchases. If they’re counted wrongly, the system optimises your campaigns blind — spending bud…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=294:check-google-ads-conversions&catid=29&lang=en-GB)

 [ ![Pie and bar charts in a browser window, a step checklist and a question mark — a guide to building a Data Studio report](https://www.it-deweloper.pl/images/blog/data-studio-first-report-cover.webp)

### How to Build a Data Studio Report from Analytics and GSC

Data Studio is Google’s free tool for reports and dashboards. In April 2026 Google brought back this name; for several years before that it was calle…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=293:data-studio-first-report&catid=29&lang=en-GB)

 [ ![A cookie icon in a browser window, a step checklist and a question mark — a guide to checking Google Consent Mode](https://www.it-deweloper.pl/images/blog/check-consent-mode-v2-cover.webp)

### How to Check If Consent Mode v2 Works on Your Website

Google Consent Mode v2 passes the choice a visitor made in your cookie banner to Google Analytics and Google Ads. A banner can look perfect and still…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=292:check-consent-mode-v2&catid=29&lang=en-GB)

 [ ![A Tag Manager tag icon in a browser window, a step checklist and a question mark — a guide to installing Google Tag Manager](https://www.it-deweloper.pl/images/blog/install-google-tag-manager-cover.webp)

### How to Install Google Tag Manager on Your Website

Google Tag Manager is a “box” for all the tracking codes on your site: Google Analytics, Google Ads conversions, social media pixels. You install the…

 ](https://www.it-deweloper.pl/index.php?option=com_content&view=article&id=291:install-google-tag-manager&catid=29&lang=en-GB)

 [](#)

 [](#)

   ##  Build your website

Find out what your website will cost

 [ Pricing ](https://www.it-deweloper.pl/index.php?Itemid=262&lang=en-GB)

 ![](https://www.it-deweloper.pl/media/yootheme/cache/3c/background-square-01-3c44c74f.png?src=images/yootheme/demo/background-square-01.png&thumbnail=900,900,&hash=72c31958)

 ![](https://www.it-deweloper.pl/media/yootheme/cache/cb/background-square-03-cbb341a0.png?src=images/yootheme/demo/background-square-03.png&thumbnail=600,600,&hash=6e9dde93)

###  [ Contact ](https://www.it-deweloper.pl/index.php?Itemid=277&lang=en-GB)

Web studio IT Deweloper website development, Poland. 5423493188

 SEOAIAdsWebSMM

### Address

Nowogródzka 4A
 Białystok, 15-490, PL

 [

### Phone

+48 731 190 041

 ](tel:+48731190041)

 [

### Email

This email address is being protected from spambots. You need JavaScript enabled to view it.

 ](mailto:office<!---->&#64;<!---->it-deweloper.pl)

 [

### WhatsApp

 ](https://wa.me/48731190041)

 [

### Telegram

 ](https://t.me/+48731190041)

 Opening hours:

- Monday

    0900–1800
- Tuesday

    0900–1800
- Wednesday

    0900–1800
- Thursday

    0900–1800
- Friday

    0900–1800
- Saturday

    0900–1600
- Sunday

    closed

 ![IT Deweloper](https://www.it-deweloper.pl/images/Logo.webp)

Web development can be interesting! Our social media, with content about building websites.

- [](https://www.facebook.com/ITdeweloper)
- [](https://www.linkedin.com/company/it-deweloper)
- [](https://t.me/IT_deweloper)
- [](https://www.instagram.com/it_deweloper/)

**it-deweloper** — a web development studio.
We design and build modern websites and online stores.

© [it-deweloper](https://it-deweloper.pl/en).
All rights reserved.

[Privacy Policy](https://www.it-deweloper.pl/index.php?Itemid=313&lang=en)
