Lets an AI client discover GA4 account structures, explore schemas, run reports, and manage property configurations through a standardized interface.
Also known as mindstone/mcp-servers, mcp-server-google-analytics, @mindstone/mcp-server-google-analytics
- Stars
- 14
- Tools
- 34
- Downloads, 30 days
- —
- Latest version
- 0.2.1
- Last commit
- Nov 16, 2026
- License
- —
What is Google Analytics 4 MCP?
Google Analytics 4 lets an AI client discover GA4 account structures, explore schemas, run reports, and manage property configurations through a standardized interface. It exposes 34 tools, such as ga_list_account_summaries, ga_list_properties, ga_get_property_details.
Summary generated from the project's README
About Google Analytics 4 MCP server
Analyzing website traffic and managing property configurations through an AI client is what this server enables for data analysts and marketing teams. It provides a standardized interface to discover account structures, explore live schemas, and run various reports, including real-time activity and funnel analysis. Users can interact with their data using 91 specialized tools designed for reporting, schema discovery, and administrative oversight.
Setup requires Node.js 20+ and authentication via Google Application Default Credentials using either a service account JSON or OAuth. While the server is read-only by default, users can enable administrative changes by setting the GA4_ALLOW_WRITES environment variable to true. This allows the AI to perform tasks like creating custom dimensions, managing key events, or updating data retention settings. The server handles large datasets through asynchronous report tasks and audience exports to avoid synchronous timeouts.
What you can do with it
- 1Analyze user conversion funnelsAsk the AI to generate a step-by-step report showing where users drop off in a specific conversion path.
- 2Export massive datasetsRequest a large-scale data export that runs in the background to avoid connection timeouts.
Written from the project's README. Every use case is checked against a quote from it.
How to install Google Analytics 4 MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall Google Analytics 4 MCP in Claude Code
$ claude mcp add --env 'GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS>' mcp-server-google-analytics -- npx -y @mindstone/mcp-server-google-analyticsInstall Google Analytics 4 MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"mcp-server-google-analytics": {
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-google-analytics"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>"
}
}
}
}Install Google Analytics 4 MCP in VS Code
.vscode/mcp.json
{
"servers": {
"mcp-server-google-analytics": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-google-analytics"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>"
}
}
}
}Install Google Analytics 4 MCP in VS Code CLI
$ code --add-mcp '{"name":"mcp-server-google-analytics","type":"stdio","command":"npx","args":["-y","@mindstone/mcp-server-google-analytics"],"env":{"GOOGLE_APPLICATION_CREDENTIALS":"<GOOGLE_APPLICATION_CREDENTIALS>"}}'Install Google Analytics 4 MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"mcp-server-google-analytics": {
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-google-analytics"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>"
}
}
}
}Install Google Analytics 4 MCP in Codex
$ codex mcp add mcp-server-google-analytics --env 'GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS>' -- npx -y @mindstone/mcp-server-google-analyticsInstall Google Analytics 4 MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.mcp-server-google-analytics] command = "npx" args = ["-y", "@mindstone/mcp-server-google-analytics"] [mcp_servers.mcp-server-google-analytics.env] GOOGLE_APPLICATION_CREDENTIALS = "<GOOGLE_APPLICATION_CREDENTIALS>"
Install Google Analytics 4 MCP in Gemini CLI
$ gemini mcp add -s user -e 'GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS>' mcp-server-google-analytics npx -- -y @mindstone/mcp-server-google-analyticsInstall Google Analytics 4 MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"mcp-server-google-analytics": {
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-google-analytics"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>"
}
}
}
}Started by HostedMCP on 16 Nov 2026
We ran this command for @mindstone/mcp-server-google-analytics 0.2.1 in an isolated container with no network and no keys. It answered and listed 34 tools.
Google Analytics 4 MCP tools 34
Read from the server with tools/listga_list_account_summariesRead-onlyList Google Analytics accounts and their property summaries available to the authenticated user. Use this first to discover available property IDs before calling other tools.
ga_list_propertiesRead-onlyList GA4 properties visible to the authenticated user, optionally filtered by account_id or property_id. Returns a flat list — easier to consume than ga_list_account_summaries when you just want property IDs.
ga_get_property_detailsRead-onlyGet details for a single GA4 property — display name, currency code, configured time zone, industry category, service level, and timestamps.
ga_get_metadataRead-onlyGet the live GA4 metadata for the property, including all available dimensions and metrics. Use this when you need the raw schema; prefer ga_search_schema for keyword lookups.
ga_get_property_schemaRead-onlyReturn the full GA4 property schema, including dimension count and metric count. Same data as ga_get_metadata with summary counts.
ga_search_schemaRead-onlySearch dimensions and metrics by keyword across the live GA4 property schema. Use this to discover the exact apiName for a concept (e.g. "session", "revenue", "country").
ga_list_dimension_categoriesRead-onlyList available dimension categories for the property schema.
ga_list_metric_categoriesRead-onlyList available metric categories for the property schema.
ga_get_dimensions_by_categoryRead-onlyGet dimensions for a given category name (from ga_list_dimension_categories).
ga_get_metrics_by_categoryRead-onlyGet metrics for a given category name (from ga_list_metric_categories).
ga_check_compatibilityRead-onlyCheck whether a set of dimensions and metrics can be used together in a GA4 report. Useful before running a complex report to avoid INCOMPATIBLE errors.
ga_run_reportRead-onlyRun a GA4 report with configurable dimensions, metrics, date range, ordering, and safe dataset controls. Estimates row count first; returns a warning above row_warning_threshold (default 2500). Use ga_search_schema to discover dimension/metric apiNames.
Show all 34 toolsShow fewer tools
ga_run_pivot_reportRead-onlyRun a GA4 pivot report. Pivots are useful for cross-tabulating dimensions (e.g. country x device).
ga_batch_run_reportsRead-onlyRun multiple GA4 reports (max 5) in a single batch request. Each report shares the row-volume safety net of ga_run_report.
ga_run_realtime_reportRead-onlyRun a GA4 realtime report with configurable dimensions and metrics. Realtime data covers the last 30 minutes by default.
ga_get_property_quotas_snapshotRead-onlyReturn a fresh property quota snapshot using a lightweight GA4 report call. Use this to check remaining tokens / requests before kicking off a large batch.
ga_get_custom_dimensions_and_metricsRead-onlyList all custom dimensions and custom metrics configured on a GA4 property.
ga_list_google_ads_linksRead-onlyList all Google Ads links configured on a GA4 property.
ga_list_key_eventsRead-onlyList all key events (formerly conversions) configured on a GA4 property.
ga_list_data_streamsRead-onlyList all data streams (web, Android app, iOS app) on a GA4 property.
ga_list_audiencesRead-onlyList all audiences configured on a GA4 property, including membership duration, ads-personalization flag, and filter clauses. Uses the v1alpha Admin API (audiences are not yet promoted to v1beta); structure may evolve over time.
ga_list_channel_groupsRead-onlyList all channel groups configured on a GA4 property, including the grouping rules that define channels such as "Organic Social". Uses the v1alpha Admin API (channel groups are not yet promoted to v1beta); structure may evolve over time.
ga_get_global_site_tagRead-onlyGet the gtag.js / global site tag snippet for the first web data stream on a GA4 property.
ga_list_bigquery_linksRead-onlyList all BigQuery export links configured on a GA4 property.
ga_get_data_retention_settingsRead-onlyGet the configured event data retention settings for a GA4 property.
ga_list_firebase_linksRead-onlyList all Firebase project links configured on a GA4 property.
ga_search_change_history_eventsRead-onlySearch the change history (created/updated/deleted) for a GA4 property. Follows all result pages automatically, so large histories are returned in full. Uses the v1alpha admin API; structure may evolve over time.
ga_create_audience_exportActionCreate an audience export — a server-side snapshot of the users in a GA4 audience for later retrieval. Charges audience-export quota tokens and takes seconds-to-minutes to become ACTIVE; poll with ga_get_audience_export, then page users with ga_query_audience_export. Does not modify property configuration.
ga_get_audience_exportRead-onlyGet the configuration metadata and state of an audience export. Poll this after ga_create_audience_export until state is ACTIVE before querying rows.
ga_list_audience_exportsRead-onlyList all audience exports for a GA4 property. Useful to find and reuse an existing export rather than creating a new one.
ga_query_audience_exportRead-onlyRetrieve users from an ACTIVE audience export, with offset/limit pagination. Rows contain user-level identifiers (user IDs / device IDs) — treat them as privacy-sensitive. The export must be ACTIVE; poll ga_get_audience_export first.
ga_create_report_taskActionStart an asynchronous report task for a large GA4 export. Unlike ga_run_report this has no synchronous timeout and no row-volume warning gate — the task materialises up to `limit` rows server-side. Poll ga_get_report_task until state is ACTIVE, then page rows with ga_query_report_task. Uses the v1alpha Data API; structure may evolve over time.
ga_get_report_taskRead-onlyGet the metadata and state of a report task. Poll this after ga_create_report_task until state is ACTIVE before querying rows. Uses the v1alpha Data API.
ga_query_report_taskRead-onlyRetrieve rows from an ACTIVE report task with offset/limit pagination (up to 250,000 rows per page). The task must be ACTIVE; poll ga_get_report_task first. Uses the v1alpha Data API.
Configuration
GOOGLE_APPLICATION_CREDENTIALSRequiredAbsolute path to ADC or service-account JSON file
GA4_PROPERTY_IDDefault GA4 property ID (e.g. 123456789)
Automated checks
Ran Nov 16, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work · What to fix for more points
- Source repository linked and reachablemindstone/mcp-servers is public and reachablegithub.com/mindstone/mcp-servers ↗Pass
- Package names this repository as its source@mindstone/mcp-server-google-analytics names mindstone/mcp-servers as sourcenpmjs.com/package/@mindstone/mcp-server-google-analytics ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for @mindstone/mcp-server-google-analyticsnpmjs.com/package/@mindstone/mcp-server-google-analytics/v/0 ↗Pass
- Open source license (OSI)No licenseFinding
- Commit or release in the last yearLast commit or release 2026-11-16github.com/mindstone/mcp-servers ↗Pass
- OpenSSF ScorecardOpenSSF Scorecard 6.3 / 10; weakest: Code-Review 0, SAST 0, Dependency-Update-Tool 0scorecard.dev/viewer/?uri=github.com/mindstone/mcp-servers ↗Partial 9/15
- Package name not close to a popular packageNo popular package one edit away from @mindstone/mcp-server-google-analyticsPass
- No critical advisory in the package or its dependencies121 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model34 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHub@mindstone/mcp-server-google-analytics
Google Analytics 4 MCP server for Model Context Protocol hosts. Discover account/property structure, explore the live schema, run reports (with row-volume safety), create large asynchronous exports, and inspect admin configuration through a standardised MCP interface. With writes explicitly enabled, it can also set up and change property configuration: key events, custom dimensions and metrics, audiences, channel groups, data streams, enhanced measurement, event create and edit rules, calculated metrics, annotations, attribution, Measurement Protocol secrets, product links, and data retention.
Status
- Version: 0.2.1 · npm
- Auth: OAuth via Google ADC (
GOOGLE_APPLICATION_CREDENTIALS) - Tools: 91 (accounts, schema, reporting, admin, admin writes)
- Surface: cloud-api
- Machine-readable:
STATUS.json
Requirements
- Node.js 20+
- npm
- Google Application Default Credentials (ADC) with the
analytics.readonlyscope, or a service account JSON with access to the GA4 property - For write tools:
GA4_ALLOW_WRITES=true, credentials with theanalytics.editscope, and the Editor role on the property
One-click install
After clicking the button, your host will prompt you to fill: GOOGLE_APPLICATION_CREDENTIALS.
{
"mcpServers": {
"Google Analytics 4": {
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-google-analytics"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": ""
}
}
}
}
Quick Start
Install & build
cd <path-to-repo>/connectors/google-analytics
npm install
npm run build
npx (once published)
npx -y @mindstone/mcp-server-google-analytics
Local
node dist/index.js
Authentication
This server uses Google Application Default Credentials (ADC). Mint ADC for a user account by installing the Google Cloud CLI and running:
gcloud auth application-default login \
--scopes=https://www.googleapis.com/auth/analytics.readonly \
--client-id-file=/absolute/path/to/oauth-client-secret.json
The --client-id-file is optional but strongly recommended — using your own OAuth client avoids the shared gcloud quota and gives you a stable verification footprint. You'll need a Google Cloud project with the Google Analytics Admin API and Google Analytics Data API enabled.
For service accounts, set GOOGLE_APPLICATION_CREDENTIALS to the absolute path of the service-account JSON. The service account must be granted access to the GA4 property in the GA4 Admin UI.
Enabling writes
Write tools are registered but refuse to run (WRITES_DISABLED) unless GA4_ALLOW_WRITES=true. To use them, mint ADC with the edit scope instead:
gcloud auth application-default login \
--scopes=https://www.googleapis.com/auth/analytics.edit \
--client-id-file=/absolute/path/to/oauth-client-secret.json
The account (or service account) also needs the Editor role on the GA4 property. Service-account credentials request the edit scope automatically when writes are enabled; user ADC keeps whatever scope it was minted with.
Configuration
Environment variables
GOOGLE_APPLICATION_CREDENTIALS— required. Absolute path to ADC or service-account JSON. Node does not expand~or%APPDATA%— provide a fully-resolved path.GA4_PROPERTY_ID— optional. Default GA4 property ID (e.g.123456789). Tools fall back to this whenproperty_idis not passed in the call.GA4_ALLOW_WRITES— optional. Set totrue(or1) to allow the write tools to change GA4 configuration. Any other value, or unset, keeps the connector read-only.
Host configuration examples
Claude Desktop / Cursor
{
"mcpServers": {
"GoogleAnalytics": {
"command": "npx",
"args": ["-y", "@mindstone/mcp-server-google-analytics"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/Users/you/.config/gcloud/application_default_credentials.json",
"GA4_PROPERTY_ID": "123456789"
}
}
}
}
Local development (no npm publish needed)
{
"mcpServers": {
"GoogleAnalytics": {
"command": "node",
"args": ["<path-to-repo>/connectors/google-analytics/dist/index.js"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/credentials.json",
"GA4_PROPERTY_ID": "123456789"
}
}
}
}
Tools (91)
Account & property
ga_list_account_summaries— discover available accounts and propertiesga_list_properties— flat list of GA4 properties with optional filteringga_get_property_details— currency, time zone, industry category, service level
Schema discovery
ga_get_metadata— live property schemaga_get_property_schema— same data with summary countsga_search_schema— keyword search across dimensions and metricsga_list_dimension_categories,ga_list_metric_categoriesga_get_dimensions_by_category,ga_get_metrics_by_categoryga_check_compatibility— verify dimension/metric combinations before reporting
Reporting
ga_run_report— core report with row-volume safety (estimate, opt-in to large datasets, automatic aggregation suggestions)ga_run_pivot_report— cross-tabulated reportsga_batch_run_reports— up to 5 reports in one callga_run_realtime_report— last 30 minutes of activityga_get_property_quotas_snapshot— remaining tokens / requestsga_run_funnel_report— step-by-step completion and drop-off, with optional breakdown, next action, and trended view (v1alpha)
Large exports
ga_create_report_task— start an asynchronous report task for large exports (no synchronous timeout, no row-volume gate)ga_get_report_task— poll task state untilACTIVEga_query_report_task— page task rows (up to 250,000 per page)ga_create_audience_export— snapshot the users in an audience (incl. predictive segments); charges audience-export quota tokensga_get_audience_export— poll export state untilACTIVEga_list_audience_exports— find and reuse existing exportsga_query_audience_export— page user-level rows from anACTIVEexport
Admin visibility
ga_list_audiences— audiences configured on the property, with filter clausesga_list_channel_groups— channel groups and their grouping rulesga_get_custom_dimensions_and_metricsga_list_google_ads_linksga_list_key_eventsga_list_data_streamsga_get_global_site_tag— gtag.js snippet for the first web streamga_list_bigquery_linksga_get_data_retention_settingsga_list_firebase_linksga_search_change_history_eventsga_get_enhanced_measurement_settings— automatic events on a web streamga_list_event_create_rules— rules that derive new events on a streamga_list_measurement_protocol_secrets— secret values are returned; treat as sensitivega_list_annotations— chart annotations (v1alpha)ga_get_attribution_settings— attribution model and lookback windows (v1alpha)ga_list_calculated_metrics— formula metrics (v1alpha)ga_list_event_edit_rules— rules that rename or modify events on a stream (v1alpha)ga_get_google_signals_settings(v1alpha)ga_get_data_sharing_settings— account-level
Admin writes (require GA4_ALLOW_WRITES=true)
Every write is annotated readOnlyHint: false, destructiveHint: true. Archive, delete, acknowledgement, and data-retention tools also require confirm: true. Update tools change only the fields you pass (the update mask is built from them) and fail with NOTHING_TO_UPDATE if you pass none.
- Key events:
ga_create_key_event,ga_update_key_event,ga_delete_key_event - Custom dimensions:
ga_create_custom_dimension,ga_update_custom_dimension,ga_archive_custom_dimension - Custom metrics:
ga_create_custom_metric,ga_update_custom_metric,ga_archive_custom_metric - Audiences (v1alpha):
ga_create_audience,ga_update_audience,ga_archive_audience - Channel groups (v1alpha):
ga_create_channel_group,ga_update_channel_group,ga_delete_channel_group - Event create rules (v1alpha):
ga_create_event_create_rule,ga_update_event_create_rule,ga_delete_event_create_rule - Property:
ga_create_property,ga_update_property,ga_delete_property(moves to trash for 35 days),ga_acknowledge_user_data_collection - Data streams:
ga_create_web_data_stream,ga_update_data_stream,ga_delete_data_stream - Enhanced measurement (v1alpha):
ga_update_enhanced_measurement_settings - Measurement Protocol secrets:
ga_create_measurement_protocol_secret,ga_delete_measurement_protocol_secret - Google Ads links:
ga_create_google_ads_link,ga_update_google_ads_link,ga_delete_google_ads_link - Firebase links:
ga_create_firebase_link,ga_delete_firebase_link - BigQuery links (v1alpha):
ga_create_bigquery_link,ga_update_bigquery_link,ga_delete_bigquery_link - Data retention:
ga_update_data_retention_settings - Annotations (v1alpha):
ga_create_annotation,ga_update_annotation,ga_delete_annotation - Attribution (v1alpha):
ga_update_attribution_settings - Calculated metrics (v1alpha):
ga_create_calculated_metric,ga_update_calculated_metric,ga_delete_calculated_metric - Event edit rules (v1alpha):
ga_create_event_edit_rule,ga_update_event_edit_rule,ga_delete_event_edit_rule
Explorations, saved reports, and report layouts have no Google API, so they cannot be created or changed by this connector.
Notes
- Read-only by default. Without
GA4_ALLOW_WRITES=true, the only tools that create anything arega_create_report_taskandga_create_audience_export, which materialise server-side snapshots and charge quota without modifying property configuration. The admin write tools refuse withWRITES_DISABLEDbefore any request is sent. All of these are annotatedreadOnlyHint: false,destructiveHint: true, so hosts can gate them behind explicit user approval. - Alpha endpoints. Audiences, channel groups, BigQuery links, enhanced measurement, event create and edit rules, annotations, attribution, calculated metrics, Google Signals, the global site tag, change history (Admin API), and report tasks and funnel reports (Data API) are only exposed on Google's
v1alphasurfaces today; the corresponding tools note this in their descriptions. - Untrusted content. Text authored inside the GA4 property — report dimension values (page titles, campaign names, custom-dimension values), audience/display names, descriptions, definition blobs, data-stream stream-data blobs, the global site tag snippet, custom-metadata expressions, vendor-echoed header/dimension names, and vendor error messages — is returned inside
<untrusted-content source="…">envelopes so hosts treat it as data, not instructions. Metric values and resource identifiers stay raw so agents can compose follow-up calls. Resource IDs passed to tools are constrained to the ID charset before URL interpolation (INVALID_RESOURCE_IDon anything else). - Response validation. Every Google API response is validated against a Zod schema at the boundary; a shape mismatch fails closed with an
INVALID_API_RESPONSEerror rather than propagating malformed data. Paginated lists follownextPageTokenin full and fail withPAGINATION_LIMIT_EXCEEDEDif the API does not stop paging after a generous safety cap — never a silent truncation.
Licence
FSL-1.1-MIT — Functional Source License, Version 1.1, with MIT future licence. The software converts to MIT licence on the second anniversary of release.
Google Analytics 4 MCP questions
How do I add Google Analytics 4 MCP to Claude Code?
Run claude mcp add --env 'GOOGLE_APPLICATION_CREDENTIALS=<GOOGLE_APPLICATION_CREDENTIALS>' mcp-server-google-analytics -- npx -y @mindstone/mcp-server-google-analytics in your terminal. Add --scope user to make it available in every project.
How do I add Google Analytics 4 MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
What tools does Google Analytics 4 MCP provide?
It exposes 34 tools, including ga_list_account_summaries, ga_list_properties, ga_get_property_details, ga_get_metadata, ga_get_property_schema.
How do I enable write access for Google Analytics 4?
You must set the environment variable GA4_ALLOW_WRITES to true and use credentials with the analytics.edit scope and the Editor role on the property.
What authentication method does this server use?
The server uses Google Application Default Credentials (ADC) via OAuth.
Is the server read-only by default?
Yes, the server is read-only unless you explicitly enable writes using the GA4_ALLOW_WRITES environment variable.
Can I run large data exports without timing out?
Yes, you can use asynchronous report tasks for large exports to avoid synchronous timeouts.