Agents and MCP

GA4 answers in Gemini CLI, no Cloud setup.

Reading GA4 from Gemini CLI usually starts in the Google Cloud console. With LopeBase you connect with Google once, run one command, and Gemini CLI can read traffic, channels, landing pages, and conversions for every property you run.

Read only. Nothing to paste into settings.json.

What it looks like in Gemini CLI

One question, one tool call, and an answer built on your own GA4 numbers.

gemini · lopebase

How did traffic change this week compared with last week, for all my sites?

get_digest

propertythis weeklast weekchange
acme.com18,42016,990+8%
acme.shop6,2107,480−17%
acme.dev3,1053,020+3%

Two sites are steady or up. acme.shop fell 17%. Want me to read its traffic sources and see which channel dropped?

No Google Cloud console

No project, no enabled APIs, no credentials file. Connect with Google in LopeBase covers it.

Every property, one sign in

Compare all your GA4 properties in one answer, with the digest or per property.

Check it with /mcp

Type /mcp in Gemini CLI to see LopeBase and its tools listed.

Add LopeBase to Gemini CLI

Three steps. The first is the same for every app; the rest is specific to Gemini CLI.

  1. 01

    Connect GA4 to LopeBase. Start free, add your site, press Connect with Google, and pick the GA4 property. You need no Google Cloud project and no API key. Google is only asked for read access.

  2. 02

    Run npx lopebase in your project folder. It signs this computer in and registers LopeBase with Gemini CLI, so you never paste a token into settings.json.

  3. 03

    Start Gemini CLI and check. Type /mcp to see LopeBase and its tools listed, then ask your question.

$ npx lopebase

Works on macOS, Linux, and Windows with Node 18 or later. The same command can also set up Claude Code, Codex, opencode, or Cursor Agent if you use more than one.

GA4 prompts that work well in Gemini CLI

Quick checks that fit in a terminal between other work.

Week over week

Compare this week's traffic with last week's for every site.

One table across properties.

get_digestweb_analytics

Find the dropped channel

acme.shop traffic fell. Which channel lost the most visitors?

Narrow a drop to its source.

traffic_sources

Today's top pages

What were the ten most viewed pages in the last 7 days?

A quick look before you write or ship.

top_paths

Goal check

List the goal events and how many people triggered each in the last 7 days.

Make sure tracking still works after a deploy.

goal_events

What Gemini CLI can read from GA4

Seven datasets per GA4 property. Breakdowns cover the last 28 days and the trend up to 90. Pass any event as a goal to count conversions.

  • web_analyticsPageviews for 7 and 28 days, plus weekly and monthly users.pageviews_7d · pageviews_28d · wau · mau
  • daily_pageviewsPageviews and visitors per day.day · pageviews · visitors
  • top_pathsThe most viewed pages over the last 7 days.url · views · visitors
  • goal_eventsEvents that may count as a conversion, now and before.event · people_28d · people_prev_28d · people_7d
  • traffic_sourcesVisitors and sessions per channel. Add a goal for conversions.source · visitors · sessions · converters
  • landing_pagesVisitors and bounce rate per landing page.path · visitors · converters · bounce_rate
  • devicesVisitors per device. Add a goal for conversions.device · visitors · converters

More on each dataset: Google Analytics MCP. Connecting in the console: the GA4 connector.

Other ways to get GA4 into Gemini CLI

LopeBase is not the only route. Here is how it compares with the usual one.

TopicGoogle's Analytics MCP serverLopeBase
SetupPython and pipx, a Google Cloud project, two Analytics APIs, local credentials, and an entry in settings.json.npx lopebase and Connect with Google.
CredentialsA credentials path and project ID in your settings.Kept by LopeBase, encrypted.
FlexibilityAny GA4 report you describe, including custom dimensions.Seven shaped datasets, with goals built in.
Other dataGA4 only.Search Console, Bing, PostHog, Stripe, and uptime too.
Best whenYou already work in Google Cloud and need custom reports.You want GA4 in Gemini CLI in a few minutes.

Google's server is described from its own README, checked October 2026. It is labeled experimental there, and its README covers Gemini CLI setup.

GA4 and Gemini CLI questions

Something else? Contact us.

Can I run Google's server and LopeBase together?

Yes. They are separate MCP servers. Use Google's for custom reports and LopeBase for the everyday questions and your other sources.

Where does npx lopebase register the server?

With Gemini CLI's own MCP settings, as npx lopebase mcp. No token goes in settings.json.

Does it work with the Gemini app?

This page is about Gemini CLI. LopeBase works in any client that can add a remote MCP server with sign in.

Can Gemini CLI see individual visitors?

No. It gets counts and rates, never a visitor, an IP address, or a user ID.

Do I need my GA4 property ID?

No. You pick the property when you connect with Google, and Gemini CLI asks by name.

Ask Gemini CLI about your traffic.

Free for one product. No card. Agent access is on every plan.