analytics-mcp
Provides a tool to list Google Ads links associated with a Google Analytics property.
Provides tools to retrieve account and property information, run core and realtime reports, and manage custom dimensions and metrics via the Google Analytics Data and Admin APIs.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@analytics-mcpwhat were the top pages by views yesterday?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Analytics MCP Server — adtechnacity fork (Experimental)
This is a fork. It is based on
googleanalytics/google-analytics-mcp(Apache-2.0) and maintained atadtechnacity/ga-mcp. It adds Google Analytics Admin API write tools —create_custom_dimensionandcreate_key_event— on top of the upstream read-only server, and broadens the requested OAuth scope to includeanalytics.editso those tools can run.Everything from upstream still works unchanged. The Python package/module is still
analytics_mcpand the entry point is stillpython -m analytics_mcp.server, so it's a drop-in replacement. This fork is not published to PyPI — run it from source (see Setup).⚠️ The write tools make permanent property-configuration changes. Beyond the
analytics.editscope, the authenticated principal must also hold an Editor / Administrator role on the target GA4 property, or the Admin API returnsPERMISSION_DENIED.
This repo runs a local MCP server that interacts with APIs for Google Analytics.
Tools 🛠️
The server uses the Google Analytics Admin API and Google Analytics Data API to provide several Tools for use with LLMs.
Retrieve account and property information 🟠
get_account_summaries: Retrieves information about the user's Google Analytics accounts and properties.get_property_details: Returns details about a property.list_google_ads_links: Returns a list of links to Google Ads accounts for a property.list_property_annotations: Returns the annotations configured on a property.
Run core reports 📙
run_report: Runs a Google Analytics report using the Data API.run_funnel_report: Runs a Google Analytics funnel report using the Data API.run_conversions_report: Runs a Google Analytics conversions report using the Data API.get_custom_dimensions_and_metrics: Retrieves the custom dimensions and metrics for a specific property.
Run realtime reports ⏳
run_realtime_report: Runs a Google Analytics realtime report using the Data API.
Write / configure a property (fork addition) ✍️
Not in the upstream read-only server. These make permanent changes and require the
analytics.editscope and an Editor / Administrator role on the target property.
create_custom_dimension: Creates a custom dimension on a GA4 property — permanently registers an event/user/item parameter so it becomes reportable.create_key_event: Marks an event as a Key Event / conversion on a GA4 property.
Related MCP server: Google Analytics MCP Server
Setup instructions 🔧
Setup involves the following steps:
Install a runner (
uvrecommended).Get the fork (clone it).
Enable the Google Analytics APIs in your Google Cloud project.
Configure credentials for Google Analytics.
Configure your MCP client (Gemini, Claude Code, …).
Install a runner 🐍
Install uv (used to
run the server from source). pipx
also works if you prefer to run a branch straight from GitHub.
Get the fork ⬇️
git clone https://github.com/adtechnacity/ga-mcp.gitNote the absolute path to the clone — you'll reference it as PATH_TO_REPO
below.
Enable APIs in your project ✅
Follow the instructions to enable the following APIs in your Google Cloud project:
Configure credentials 🔑
Configure your Application Default Credentials (ADC). Make sure the credentials are for a principal with access to your Google Analytics accounts or properties.
This fork requests two scopes — the read scope used by all read tools, and the edit scope required by the write tools:
https://www.googleapis.com/auth/analytics.readonly
https://www.googleapis.com/auth/analytics.editIf you only intend to use the read tools, the edit scope is harmless (it's still requested, but unused). To actually create custom dimensions / key events, the principal must also hold an Editor / Administrator role on the target GA4 property — the scope alone is not enough.
Check out Manage OAuth Clients for how to create an OAuth client.
Here are some sample gcloud commands you might find useful:
Set up ADC using user credentials and an OAuth desktop or web client after downloading the client JSON to
YOUR_CLIENT_JSON_FILE.gcloud auth application-default login \ --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/analytics.edit,https://www.googleapis.com/auth/cloud-platform \ --client-id-file=YOUR_CLIENT_JSON_FILESet up ADC using service account impersonation.
gcloud auth application-default login \ --impersonate-service-account=SERVICE_ACCOUNT_EMAIL \ --scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/analytics.edit,https://www.googleapis.com/auth/cloud-platform
When the gcloud auth application-default command completes, copy the
PATH_TO_CREDENTIALS_JSON file location printed to the console. You'll need it
for the next step.
Using a service account (e.g. for headless / CI use)? Set
GOOGLE_APPLICATION_CREDENTIALSto the key file in your MCP clientenv(see below). Remember the service account still needs the Editor / Administrator property role for writes.
Configure Gemini
Install Gemini CLI or Gemini Code Assist.
Create or edit
~/.gemini/settings.json, adding the server to themcpServerslist. ReplacePATH_TO_REPOwith the path to your clone andYOUR_PROJECT_IDwith your project ID. SetGOOGLE_APPLICATION_CREDENTIALSonly if you're using a service-account key file rather than ADC.{ "mcpServers": { "analytics-mcp": { "command": "uv", "args": [ "--directory", "PATH_TO_REPO", "run", "python", "-m", "analytics_mcp.server" ], "env": { "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID" } } } }
Configure Claude Code
Add the MCP server, running it from your clone with uv. Replace PATH_TO_REPO
with the path to your clone and YOUR_PROJECT_ID with your
project ID.
claude mcp add analytics-mcp \
--scope user \
-e "GOOGLE_PROJECT_ID=YOUR_PROJECT_ID" \
-- uv --directory PATH_TO_REPO run python -m analytics_mcp.serverAdd -e "GOOGLE_APPLICATION_CREDENTIALS=PATH_TO_CREDENTIALS_JSON" if you're
authenticating with a service-account key file instead of ADC.
Try it out 🥼
Launch your MCP client and list the available servers (e.g. /mcp in Gemini or
Claude Code). You should see analytics-mcp with 11 tools.
Here are some sample prompts to get you started:
Ask what the server can do:
what can the analytics-mcp server do?Ask about a Google Analytics property
Give me details about my Google Analytics property with 'xyz' in the namePrompt for analysis:
what are the most popular events in my Google Analytics property in the last 180 days?Ask about property configuration:
what are the custom dimensions and custom metrics in my property?Use a write tool (needs the edit scope + an Editor role on the property):
create an event-scoped custom dimension named "Respin Genre" for the parameter fs_respin_genre on property 123456789
Relationship to upstream 🔗
This fork tracks
googleanalytics/google-analytics-mcp
as upstream. The only additions are the two Admin-API write tools and the
analytics.edit scope; the read tools are unchanged. Source-file copyright
headers from upstream are retained (Apache-2.0). Generally-useful fixes are
welcome here, but consider sending broadly-applicable changes upstream too — see
CONTRIBUTING.md.
Contributing ✨
Contributions welcome! See the Contributing Guide.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityFmaintenanceAn MCP server implementation for accessing Google Analytics 4 (GA4) data, built using the Model Context Protocol TypeScript SDK.Last updated52,33072MIT
- -license-quality-maintenanceAn experimental MCP server that enables interaction with Google Analytics APIs, allowing users to retrieve account information, run core reports, and access realtime analytics data through natural language queries.Last updated
- AlicenseAqualityCmaintenanceA local MCP server for Google Analytics 4 that provides tools for SEO and paid reporting, enabling queries on organic and paid search performance, landing pages, channels, campaigns, and real-time data.Last updated1013MIT
- Alicense-qualityDmaintenanceA powerful Model Context Protocol (MCP) server that provides comprehensive Google Analytics 4 (GA4), Google Search Console (GSC), and Google Merchant Center (GMC) integration for Claude Desktop and other MCP clients.Last updatedApache 2.0
Related MCP Connectors
MCP server for Google search results via SERP API
MCP server for interacting with the Supabase platform
An MCP server giving access to Grafana dashboards, data and more.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/adtechnacity/ga-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server