Skip to main content
Glama
MCP auth bridge for GA4 and Search Console

MCP auth bridge for GA4 and Search Console

by jeffreyvr

MCP auth bridge for GA4 and Search Console

Connect Claude, Cursor, Grok Bot, or any remote MCP client to your Google Analytics 4 and Search Console data.

You deploy your own Cloudflare Worker and Google OAuth client. There is no shared hosted service, and you do not need Google app verification for personal use.

Deploy to Cloudflare


Quick setup

1. Deploy

Easiest: click Deploy to Cloudflare. It creates the KV namespace and asks for:

  • GOOGLE_CLIENT_ID

  • GOOGLE_CLIENT_SECRET

You can leave those blank for a minute and set them after Google Cloud is ready.

Or with Wrangler:

npm install
npx wrangler login
npx wrangler kv namespace create OAUTH_KV

Put the new namespace id into wrangler.jsonc, then:

npx wrangler secret put GOOGLE_CLIENT_ID
npx wrangler secret put GOOGLE_CLIENT_SECRET
npx wrangler deploy

Open your Worker URL. The home page walks through the rest and shows the exact redirect URI to copy.

2. Google Cloud (same project for everything)

  1. Create a Web application OAuth client.

  2. Paste the redirect URI from your Worker home page, for example:

    https://<your-worker>.workers.dev/callback

  3. Add these scopes under Data access:

    • openid

    • https://www.googleapis.com/auth/userinfo.email

    • https://www.googleapis.com/auth/analytics.readonly

    • https://www.googleapis.com/auth/webmasters.readonly

  4. Enable these APIs:

  5. Set the consent screen to In production (audience settings).

    Testing mode expires refresh tokens after 7 days. Google may show an “unverified app” warning for these scopes — choose Advanced and continue. That is normal for a private app. Workspace users can use Internal instead.

  6. Put the client id and secret on the Worker if you have not already:

npx wrangler secret put GOOGLE_CLIENT_ID
npx wrangler secret put GOOGLE_CLIENT_SECRET

Reload /. Both secrets should say Set.

3. Connect an AI client

Copy the MCP URL from the setup page:

https://<your-worker>.workers.dev/mcp

Client

What to do

Claude

Add a custom connector with that URL

Cursor

Add a remote MCP / HTTPS server with that URL

Grok Bot

Add a custom connector → Remote HTTPS → paste the URL → leave Client ID blank

The first connection opens this Worker’s consent page, then Google. Sign in with an account that can view the GA4 property and Search Console property.


Related MCP server: gsc-mcp-connector

What you get

Read-only tools for:

  • GA4 accounts and properties

  • Historical and realtime reports

  • Available dimensions and metrics

  • Search Console sites, performance, sitemaps, and URL inspection

Reports come back compact (short heading + table). Errors say the useful thing: API not enabled, no access to the property, bad field name, or dead refresh token.


Local development

npm install
cp .dev.vars.example .dev.vars

Put a Google client id and secret in .dev.vars, and add http://localhost:8794/callback as a redirect URI.

npm run dev

Then open http://localhost:8794.

npm run typecheck
npm run lint
npm test

Optional knobs

Leave these blank unless you need them:

  • HOSTED_DOMAIN — only allow Google accounts on one Workspace domain

  • MCP_RESOURCE — pin tokens to a public MCP URL that differs from the request host


Want this hosted?

Self-hosted only for now.

Want this hosted?


Notes

  • Unofficial. Not affiliated with Google.

  • The MCP URL is public. A caller still needs a bearer token from this Worker, issued only after the consent screen and Google sign-in. Google refresh tokens stay encrypted in KV. The MCP client never receives them.

  • The home page shows whether the two Google secrets are set. It does not show their values.

  • Leave the Worker URL private if you do not want other people to start a connection. Set HOSTED_DOMAIN to allow only verified accounts on one Workspace domain.

  • Live Google OAuth and live Analytics/Search Console calls are not covered by the unit tests — confirm with your own account after deploy.

  • MIT licensed. Brand icons on the setup/auth pages come from theSVG.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Self-hosted Google Search Console MCP server deployable to Cloudflare Workers in 15 minutes. Enables querying GSC data (sites, search analytics, URL inspection, sitemaps) via natural language through MCP-capable clients like ChatGPT or Claude.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A read-only MCP server exposing Google Analytics 4 and AdSense APIs (reports, metadata, admin reads) via Cloudflare Workers with OAuth authentication.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables querying Google Analytics 4 data from Claude via a secure, read-only Cloudflare Workers MCP server with per-user OAuth sign-in, requiring no local installation.
      -