Gemini CLI can read your Search Console data the same way Claude Code and Cursor do: through a remote MCP server over HTTP. You add the server once with gemini mcp add, pass a bearer token in a header, and the model gets tools such as get-site-overview and get-striking-distance instead of a screenshot you pasted into the prompt.
This page is the Gemini CLI path only. Other clients: Claude Code, Claude Desktop, ChatGPT, Cursor. Full client catalogue: SiteLine MCP setup for agents. Product overview: /mcp.
What you are connecting
There are two different things people mean by "connect Google Analytics to Gemini CLI":
| You want | Use | Notes |
|---|---|---|
| GA4 reports (sessions, events, funnels) | Google's own Google Analytics MCP server | Experimental, runs locally with Python and pipx, uses Application Default Credentials with the analytics.readonly scope. |
| Search Console clicks, queries and pages, with history past 16 months | SiteLine's Search Console MCP server | Hosted HTTPS server, bearer token, ~16 months backfilled on connect and kept while you subscribe. |
| Cookieless pageviews, events and goals (no GA4, no banner) | SiteLine's analytics MCP server | Same token, separate server and separate units. |
You can run Google's GA4 server and SiteLine side by side. They answer different questions. The rest of this guide covers the SiteLine servers.
Before you add the servers
- Register: 7-day trial, no card to start. Pricing starts at $4.99/mo and MCP is on every paid tier.
- Connect Google Search Console with the read-only
webmasters.readonlyscope. Let the ~16-month backfill finish;get-import-statustells you if it is still running. - Optionally add the cookieless tracker to the same domain if you want pageviews beside clicks.
- Open Settings → MCP access (
/settings/api-tokens). Name a token Gemini CLI, pick the team that owns the properties, create it and copy it once.
The token is team-scoped. It cannot see another team's sites, and it does not follow whichever team you have selected in the browser.
Add both servers with gemini mcp add
SiteLine exposes two HTTPS servers. Add both, or the model will guess the half you left out.
| Server name | URL | Units |
|---|---|---|
siteline |
https://siteline.tools/mcp/search-console |
clicks, impressions, CTR, position, query, page |
siteline-analytics |
https://siteline.tools/mcp/analytics |
pageviews, visitor-days, events, goals, realtime |
Gemini CLI's mcp add command takes a transport, a header and a scope. The default scope is project, which writes to .gemini/settings.json inside the repo. Because the token lives in that file, use user scope (~/.gemini/settings.json) unless you are sure the project file is git-ignored:
gemini mcp add -s user --transport http \
--header "Authorization: Bearer YOUR_TOKEN" \
siteline https://siteline.tools/mcp/search-console
gemini mcp add -s user --transport http \
--header "Authorization: Bearer YOUR_TOKEN" \
siteline-analytics https://siteline.tools/mcp/analytics
Flags move between releases, so check gemini mcp add --help on your build before trusting any blog, this one included.
Keep server names hyphenated, not underscored. Gemini CLI names every MCP tool mcp_{serverName}_{toolName} and its policy parser splits on the first underscore after mcp_, so a name like siteline_gsc can break allow and deny rules silently.
Or edit settings.json by hand
The command above writes an mcpServers entry. If you prefer to write it yourself, httpUrl selects the streamable HTTP transport (url would select SSE, which is the wrong one here):
{
"mcpServers": {
"siteline": {
"httpUrl": "https://siteline.tools/mcp/search-console",
"headers": { "Authorization": "Bearer YOUR_TOKEN" },
"timeout": 30000
},
"siteline-analytics": {
"httpUrl": "https://siteline.tools/mcp/analytics",
"headers": { "Authorization": "Bearer YOUR_TOKEN" },
"timeout": 30000
}
}
}
Leave trust off at first. With trust off, Gemini CLI asks before each tool call and lets you allow a tool or a whole server for the session. SiteLine's tools are read-only, so allowing the server is low risk once you have watched a few calls.
Check the connection
From your shell:
gemini mcp list
Both servers should show as connected over http. Inside a session, /mcp shows each server's status and its tool list. You should see list-sites, get-site-overview, get-movers, get-striking-distance, get-queries-for-page and the rest on siteline, and get-analytics-overview and friends on siteline-analytics.
If a server shows as disconnected, prove the token and URL outside the CLI:
curl -X POST https://siteline.tools/mcp/search-console \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
A 401 is a bad or revoked token. A 402 is a lapsed subscription, so fix billing rather than retrying. A 406 usually means the Accept header is missing. If curl works and Gemini CLI still shows nothing, run gemini --debug and look at the MCP connection lines.
First prompts that work
Ask in this order so the model reads real totals before it starts guessing:
- "Call
list-sitesand pick the site for example.com." Site ids are not domain strings. - "Check
get-import-statusand tell medata_through." Google's data runs about two days behind, so empty recent days are lag, not a drop. - "Use
get-site-overviewfor the last 28 days against the previous period." - "Now
get-striking-distancewith positions 4 to 20, and for the top three queries callget-pages-for-query."
That last step is where Gemini CLI earns its place in a repo: it can open the template that owns the page and propose the edit. Query-shaped prompts for every tool: How to query Search Console with MCP. Tool semantics: the Google Search Console MCP guide.
Put the rules in GEMINI.md
Gemini CLI reads GEMINI.md as project context. Put the reporting rules there so you do not repeat them every session:
SiteLine MCP rules:
- Site totals come from get-site-overview only. Never sum query or page rows.
- Never average position or CTR across rows.
- Respect data_through. Empty lag days are not a decline.
- Use the web search type unless I name another. Discover and News have no position.
- Analytics visitors are not Search Console clicks. Report them separately.
- These servers are read-only: no indexing requests, no sitemap submits.
The visitors-versus-clicks rule matters most. The two servers count different things: Search Console clicks vs analytics sessions.
FAQ
Does Gemini CLI support remote HTTP MCP servers?
Yes. Gemini CLI supports stdio, SSE and streamable HTTP transports. SiteLine uses streamable HTTP, which is --transport http on the command line or httpUrl in settings.json.
Can I use OAuth instead of a bearer token?
Gemini CLI can run an OAuth flow for remote servers, but it needs a local browser and a localhost callback, so it fails over SSH and in headless containers. A team-scoped bearer token works everywhere the CLI runs, which is why this guide uses one.
Is this the same as Google's Google Analytics MCP server?
No. Google's server reads GA4 through the Analytics Data and Admin APIs and runs on your machine. SiteLine's servers are hosted and read Search Console history plus SiteLine's own cookieless analytics. If you have left GA4, you only need SiteLine; if you still run GA4, you can add both.
Can Gemini CLI change my Search Console property?
No. The Google scope is webmasters.readonly and every SiteLine tool is read-only. There is no tool to request indexing, submit a sitemap or edit a property.
Why does the model say my traffic dropped yesterday?
Because it read a day Google has not finished publishing. Ask it to check get-import-status first and to stop at data_through. The rule in GEMINI.md above prevents most of these.
Is MCP billed per tool call?
No. MCP is included on every paid plan from $4.99/mo. You pay the subscription and for billable analytics events, not for Search Console rows or MCP calls. Start a 7-day trial.