Google Analytics MCP Server
Official Google Analytics MCP server that exposes GA4 Admin and Data APIs to LLMs for property metadata, standard, funnel, and realtime reporting.
The Google Analytics MCP server is an experimental, official open-source server maintained under the googleanalytics GitHub organization. It lets an LLM client (Gemini CLI, Gemini Code Assist, Claude, or any other MCP-compatible client) call the Google Analytics Admin API and Data API to inspect account/property configuration and run reports against GA properties.
It exposes seven tools spanning account discovery (get_account_summaries, get_property_details, list_google_ads_links), reporting (run_report, run_funnel_report, get_custom_dimensions_and_metrics), and live data (run_realtime_report). Reports are executed through the GA Data API, so the server is oriented toward GA4 properties (the current Google Analytics standard).
Access is read-only by design (the analytics.readonly scope), which prevents the model from mutating analytics configuration. Authentication uses Application Default Credentials configured with gcloud, supporting both OAuth desktop clients and service account impersonation. The server is distributed as the analytics-mcp Python package and runs via pipx.
Tools
| Tool | Description |
|---|---|
get_account_summaries |
Returns a list of the user's Google Analytics accounts and the properties they contain. |
get_property_details |
Returns metadata for a specific GA property (display name, time zone, currency, industry, etc.). |
list_google_ads_links |
Lists Google Ads accounts linked to a given GA property. |
run_report |
Executes a standard Google Analytics report via the Data API with chosen dimensions, metrics, and date ranges. |
run_funnel_report |
Runs a funnel analysis report against a GA property using the Data API. |
get_custom_dimensions_and_metrics |
Lists the custom dimensions and custom metrics configured on a GA property. |
run_realtime_report |
Queries the realtime endpoint of the GA Data API for live user/event activity. |
Prerequisites
- Python 3.10 or higher
pipxinstalled- A Google Cloud project with the Analytics Admin API and Analytics Data API enabled
- A Google Analytics account/property you have access to
1. Configure Application Default Credentials
Use one of the following gcloud commands.
OAuth desktop client:
gcloud auth application-default login \
--scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform \
--client-id-file=YOUR_CLIENT_JSON_FILE
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/cloud-platform
2. Run the server
pipx run analytics-mcp
3. Register the server with your MCP client
Example configuration (~/.gemini/settings.json from the README; the same structure works for Claude Desktop's claude_desktop_config.json):
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": ["run", "analytics-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
"GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID"
}
}
}
}
Environment variables
GOOGLE_APPLICATION_CREDENTIALS: path to the credentials JSON file produced bygcloud auth application-default login.GOOGLE_PROJECT_ID: the Google Cloud project ID that has the Analytics Admin API and Data API enabled.
- Pull top events, pages, or traffic sources from a GA4 property for the last N days without leaving your chat client.
- Inspect a property's configuration (custom dimensions, custom metrics, linked Google Ads accounts) before building a dashboard or report spec.
- Build ad hoc funnel analyses (e.g. landing page to signup to purchase) by asking the model to compose a
run_funnel_reportcall. - Monitor live activity on a site or app via
run_realtime_reportduring a launch or campaign. - Audit which Google Analytics properties an account has access to and surface key metadata for each.
- "What can the analytics-mcp server do?"
- "Give me details about my Google Analytics property with 'xyz' in the name."
- "What are the most popular events in my Google Analytics property in the last 180 days?"
- "Were most of my users in the last 6 months logged in?"
- "What are the custom dimensions and custom metrics in my property?"
- Official: maintained under the
googleanalyticsGitHub org, so tool semantics track the GA Admin and Data APIs directly. - Read-only by design (analytics.readonly scope), reducing risk of the model mutating analytics configuration.
- Covers the main reporting surface developers actually want: standard reports, funnel reports, realtime, and custom dimension/metric metadata.
- Simple distribution via
pipx run analytics-mcp, no Docker or local build step required.
- Marked experimental by the maintainers; APIs and tool names may change.
- Setup requires a Google Cloud project plus
gcloudADC configuration, which is more involved than a single API key. - Oriented toward GA4 via the Data API; Universal Analytics is not supported (and is sunset by Google anyway).
- No write/admin operations, so it cannot create properties, audiences, or conversions.
- Stape Google Analytics MCP and other community GA MCP servers that wrap the Data API with different tool surfaces.
- Google's BigQuery MCP integrations, useful when GA data is exported to BigQuery and you need SQL-level access.
- Direct use of the Google Analytics Data API from a custom tool/function in your agent framework when you need write or admin capabilities not covered by this server.