<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Karthik Varma, KKV Labs</title>
    <description>The latest articles on DEV Community by Karthik Varma, KKV Labs (@kkvlabs).</description>
    <link>https://dev.to/kkvlabs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4268481%2F6df7b3e5-41db-4cf3-aec0-ab6517e1c2fb.png</url>
      <title>DEV Community: Karthik Varma, KKV Labs</title>
      <link>https://dev.to/kkvlabs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kkvlabs"/>
    <language>en</language>
    <item>
      <title>How to connect Google Analytics 4 and Search Console to Claude Code (free, local, 15 minutes)</title>
      <dc:creator>Karthik Varma, KKV Labs</dc:creator>
      <pubDate>Fri, 27 Nov 2026 08:32:57 +0000</pubDate>
      <link>https://dev.to/kkvlabs/how-to-connect-google-analytics-4-and-search-console-to-claude-code-free-local-15-minutes-2i0j</link>
      <guid>https://dev.to/kkvlabs/how-to-connect-google-analytics-4-and-search-console-to-claude-code-free-local-15-minutes-2i0j</guid>
      <description>&lt;p&gt;I run a few websites. Every week I opened Google Analytics 4 (GA4) in one tab and Google Search Console (GSC) in another, then tried to match the numbers by hand. Which page lost clicks? Did that page also lose sign-ups? It was slow and I made mistakes.&lt;/p&gt;

&lt;p&gt;So we built an open-source MCP server that lets Claude Code read both. It is called &lt;strong&gt;ga4-gsc-mcp&lt;/strong&gt;. It is free, MIT licensed, read-only, and it runs on your own machine with your own Google credentials. Disclosure up front: I'm Karthik Varma, founder of KKV Labs, and KKV Labs made this. I tested it live on my own sites before release.&lt;/p&gt;

&lt;p&gt;This guide takes you from zero to asking Claude Code "why did my Google traffic drop?" The one slow part is creating a Google Cloud OAuth client. That takes about 10 to 15 minutes the first time and you only do it once.&lt;/p&gt;

&lt;h3&gt;
  
  
  What you get
&lt;/h3&gt;

&lt;p&gt;The server adds 36 read-only tools to Claude Code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Google Search Console (GSC):&lt;/strong&gt; top queries, top pages, quick wins, traffic drops, why traffic dropped (with Google ranking updates in the window), keyword cannibalization, content decay, top movers, URL inspection and sitemaps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Analytics 4 (GA4):&lt;/strong&gt; traffic sources, which platform sent fewer visitors, attribution, AI assistant traffic (ChatGPT, Perplexity, Claude, Gemini, Copilot), funnels, realtime, and raw GA4 reports.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PageSpeed Insights:&lt;/strong&gt; Core Web Vitals and a Lighthouse score.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bing Webmaster Tools:&lt;/strong&gt; clicks, queries, pages, crawl issues and backlinks, if you add your own Bing API key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some tools join the sources. &lt;code&gt;top_pages&lt;/code&gt; puts GSC clicks next to GA4 landing page data, so you can see search clicks and on-site results in one row.&lt;/p&gt;

&lt;p&gt;It works in Claude Code, Claude Desktop and Cursor, plus any MCP client that runs a local stdio server. It does not work in claude.ai or ChatGPT on the web, because those cannot start a process on your computer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 0: try it with fake data first
&lt;/h3&gt;

&lt;p&gt;You need Node.js 20 or newer. Before you touch Google Cloud, check that the server runs. Demo mode uses built-in fake data for example.com and makes no network calls:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;GA4_GSC_MCP_DEMO&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 npx -y ga4-gsc-mcp check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If that prints a list of properties and sites, Node and npx are fine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shortcut:&lt;/strong&gt; &lt;code&gt;npx ga4-gsc-mcp setup&lt;/code&gt; walks you through steps 1 to 4 in the terminal. It opens each Google Cloud page in order, signs you in, checks access and offers to write the config for Claude Desktop or Cursor (it backs up your config first and asks before writing). The manual steps below show what it does.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: enable three Google APIs
&lt;/h3&gt;

&lt;p&gt;Pick a Google Cloud project you own, or create a new one. Then enable the Google Analytics Admin API, the Google Analytics Data API and the Google Search Console API. You can click them on in the &lt;a href="https://console.cloud.google.com/apis/library" rel="noopener noreferrer"&gt;API library&lt;/a&gt;, or use gcloud:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud services &lt;span class="nb"&gt;enable&lt;/span&gt; analyticsadmin.googleapis.com analyticsdata.googleapis.com searchconsole.googleapis.com --project=YOUR_PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Admin API lists your properties. The Data API runs reports. The Search Console API covers search analytics and URL inspection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: create a desktop OAuth client
&lt;/h3&gt;

&lt;p&gt;The README offers three ways to sign in. I recommend the one-time browser login, because the saved token holds nothing but two read-only scopes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In Google Cloud, open &lt;strong&gt;Google Auth Platform&lt;/strong&gt; (APIs &amp;amp; Services &amp;gt; OAuth consent screen). Set it up as &lt;strong&gt;External&lt;/strong&gt; and add your own Google account under &lt;strong&gt;Test users&lt;/strong&gt;. On Google Workspace you can pick &lt;strong&gt;Internal&lt;/strong&gt; instead.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Clients&lt;/strong&gt; (APIs &amp;amp; Services &amp;gt; Credentials) &amp;gt; &lt;strong&gt;Create client&lt;/strong&gt; &amp;gt; &lt;strong&gt;Desktop app&lt;/strong&gt;. Download the JSON file.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 3: sign in once
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y ga4-gsc-mcp auth --client-secret ~/Downloads/client_secret_XXXX.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your browser opens. You approve read-only access. A refresh token is saved to &lt;code&gt;~/.config/ga4-gsc-mcp/oauth-token.json&lt;/code&gt; (&lt;code&gt;%APPDATA%\ga4-gsc-mcp&lt;/code&gt; on Windows) with file mode 600.&lt;/p&gt;

&lt;p&gt;One catch. While your consent screen is in &lt;strong&gt;Testing&lt;/strong&gt;, Google expires refresh tokens after 7 days. To keep the login, switch the publishing status to &lt;strong&gt;In production&lt;/strong&gt;. For an app only you use, Google shows a warning screen you can click through. Or just run &lt;code&gt;auth&lt;/code&gt; again each week.&lt;/p&gt;

&lt;p&gt;Now check your real credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx -y ga4-gsc-mcp check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It prints which credentials it used and every GA4 property and GSC site they can see. If your site is missing here, it will be missing in Claude too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: add it to Claude Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add ga4-gsc --scope user -- npx -y ga4-gsc-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start Claude Code and run &lt;code&gt;/mcp&lt;/code&gt;. You should see &lt;code&gt;ga4-gsc&lt;/code&gt; connected.&lt;/p&gt;

&lt;p&gt;Want Bing too? Generate a key in Bing Webmaster Tools under &lt;strong&gt;Settings &amp;gt; API Access&lt;/strong&gt;, then add the server with the key in its environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add ga4-gsc --scope user -e &lt;span class="nv"&gt;BING_WEBMASTER_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-key -- npx -y ga4-gsc-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;bing_&lt;/code&gt; tools only appear when that key is set.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: ask questions
&lt;/h3&gt;

&lt;p&gt;Here are five questions from the README and what comes back. Every answer starts with a &lt;code&gt;receipt&lt;/code&gt;: the GA4 property, the GSC site, the exact dates, the comparison range and any caveats. So you always know what the numbers cover.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. "How is example.com doing compared with last month?"&lt;/strong&gt;&lt;br&gt;
This runs &lt;code&gt;site_overview&lt;/code&gt;. You get sessions, users, key events and engagement from GA4, plus clicks, impressions, CTR and average position from GSC. Each comes with its change. It also flags possible bot or spam traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. "Why did my Google traffic drop last month? Was there a Google update?"&lt;/strong&gt;&lt;br&gt;
This runs &lt;code&gt;why_did_it_drop&lt;/code&gt;. It splits the clicks change into impressions and CTR, finds the start date, lists the cause per page and query, checks index status, and shows Google ranking updates from the Search Status Dashboard that fall in the window.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. "Give me 10 SEO quick wins for example.com with the page to fix."&lt;/strong&gt;&lt;br&gt;
This runs &lt;code&gt;quick_wins&lt;/code&gt;. It finds queries at positions 4 to 20 with real impressions, ranks them by the extra clicks you could gain, and shows your CTR by position against a benchmark.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. "Which of my pages compete for the same keywords?"&lt;/strong&gt;&lt;br&gt;
This runs &lt;code&gt;find_cannibalization&lt;/code&gt;. It lists queries split between two or more of your pages and suggests which page to keep.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. "How many visits came from ChatGPT, Perplexity, Claude, Gemini and Copilot in the last 90 days, and where did they land?"&lt;/strong&gt;&lt;br&gt;
This runs &lt;code&gt;ai_traffic&lt;/code&gt; on GA4 and returns visits by AI assistant with their landing pages.&lt;/p&gt;

&lt;p&gt;When the ready-made tools don't fit, ask for something specific, like "Sessions by country and device for October." Claude will use &lt;code&gt;run_ga4_report&lt;/code&gt; or &lt;code&gt;search_console_query&lt;/code&gt;, which expose the full GA4 Data API and Search Analytics API. Tables can come back as CSV.&lt;/p&gt;

&lt;h3&gt;
  
  
  Troubleshooting
&lt;/h3&gt;

&lt;p&gt;Run &lt;code&gt;npx -y ga4-gsc-mcp check&lt;/code&gt; first. Most problems show up there. The common ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"API has not been used in project ... or it is disabled":&lt;/strong&gt; enable the three APIs from Step 1 in the project your credentials belong to. Wait a minute and retry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Access blocked: ... has not completed the Google verification process":&lt;/strong&gt; add your account under &lt;strong&gt;Test users&lt;/strong&gt; on the consent screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;invalid_grant&lt;/code&gt; after about a week:&lt;/strong&gt; the consent screen is in Testing, so the token expired. Publish it to In production, or run &lt;code&gt;auth&lt;/code&gt; again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;403 "User does not have sufficient permissions":&lt;/strong&gt; the signed-in account is not a user on that GA4 property or GSC site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"No Search Console site matches ...":&lt;/strong&gt; use the exact site from &lt;code&gt;list_properties&lt;/code&gt;. Domain properties look like &lt;code&gt;sc-domain:example.com&lt;/code&gt;. URL-prefix properties look like &lt;code&gt;https://www.example.com/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"No GA4 property's web stream matches ...":&lt;/strong&gt; pass &lt;code&gt;ga4_property&lt;/code&gt; (the numeric ID from GA4 Admin &amp;gt; Property details), or set &lt;code&gt;GA4_PROPERTY_ID&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Numbers differ from the Search Console UI:&lt;/strong&gt; the UI includes the last 2 to 3 unsettled days. This server ends on settled days by default. Pass &lt;code&gt;end_date&lt;/code&gt; to match the UI exactly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Honest limits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local only.&lt;/strong&gt; It runs as a stdio process on your computer. It does not work in claude.ai or ChatGPT on the web.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You need a Google Cloud project.&lt;/strong&gt; That OAuth client setup is the slow part, and Testing mode tokens expire after 7 days unless you publish the consent screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search Console lags.&lt;/strong&gt; GSC data settles 2 to 3 days late, and GA4 about 1 day late. Default ranges end on settled days, so "last 7 days" will not include today.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Query tables don't add up to the total.&lt;/strong&gt; Search Console leaves anonymized queries out of query and page tables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quotas apply.&lt;/strong&gt; GA4 and Search Console have per-project quotas. URL Inspection allows about 2,000 a day and 600 a minute per site.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bing keeps about 6 months of history&lt;/strong&gt; and reports queries and pages by week.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Funnels are beta.&lt;/strong&gt; &lt;code&gt;ga4_funnel&lt;/code&gt; uses Google's v1alpha funnel API, which can change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool output is untrusted text.&lt;/strong&gt; Search queries and backlink anchor text are written by other people. Keep Claude Code's confirmation prompts on for tools that reach other hosts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  On security
&lt;/h3&gt;

&lt;p&gt;Calls go only to Google's and Bing's APIs over HTTPS, through one guard with a fixed host allow list. There is no telemetry. Tokens and API keys are redacted from errors and logs. The full list is in the README.&lt;/p&gt;

&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;p&gt;The code, issues and changelog are on GitHub: &lt;a href="https://github.com/kkvlabs/ga4-gsc-mcp" rel="noopener noreferrer"&gt;https://github.com/kkvlabs/ga4-gsc-mcp&lt;/a&gt;. Version 0.3.0 adds a &lt;code&gt;npx ga4-gsc-mcp setup&lt;/code&gt; wizard and a one-click Claude Desktop install (download &lt;code&gt;ga4-gsc-mcp.mcpb&lt;/code&gt; from the latest GitHub release). Issues and pull requests are welcome.&lt;/p&gt;

&lt;p&gt;If you'd rather skip the Google Cloud setup, or you want this in claude.ai or ChatGPT on the web, the same team runs a hosted version: &lt;a href="https://www.kkvlabs.com/site-insights?utm_source=devto&amp;amp;utm_medium=tutorial&amp;amp;utm_campaign=oss" rel="noopener noreferrer"&gt;Site Insights by KKV Labs&lt;/a&gt;. You sign in with Google. The free plan covers 1 site and 20 lookups a day.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>mcp</category>
      <category>seo</category>
      <category>googleanalytics</category>
    </item>
  </channel>
</rss>
