google-measurement-mcp

v0.1.0
google-measurement-mcp Checked 6 hours ago Published 3 months ago

MCP server for the Google measurement stack — GA4, Search Console, and Tag Manager in one server.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

ga4_run_report

Runs a Google Analytics 4 report and returns rows as flat objects. Requires the NUMERIC GA4 propertyId (e.g. 123456789), not the G-XXXXXXX measurement ID. If the user does not know it, it appears in any GA4 URL as the digits after 'p' (analytics.google.com/analytics/web/#/a<account>p<property>/...), or under GA4 Admin -> Property details -> PROPERTY ID. Returns at most 25 rows unless `limit` is raised; prefer narrowing the date range or dimensions over raising it. Read-only.

ParameterTypeDescription
endDate *stringEnd of the range, inclusive. Same formats as startDate.
metrics *arrayGA4 metric API names, e.g. ['activeUsers','sessions','conversions']. At least one is required.
propertyId *stringGA4 numeric property ID, with or without the 'properties/' prefix. Call ga4_list_account_summaries to discover it. This is NOT the G-XXXXXXX measurement ID.
startDate *stringStart of the range. Accepts YYYY-MM-DD, 'today', 'yesterday', or 'NdaysAgo' (e.g. '28daysAgo').
dimensionsarrayGA4 dimension API names, e.g. ['date','sessionSource','country']. Omit for totals only.
keepEmptyRowsbooleanWhen true, returns rows whose metrics are all zero. Defaults to false.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
offsetintegerZero-based row offset, for paging through a large report.

ga4_run_realtime_report

Returns activity from roughly the last 30 minutes. Requires the NUMERIC GA4 propertyId (call ga4_list_account_summaries to find it). IMPORTANT: the realtime schema is a SUBSET of the standard reporting schema — 'date', 'sessionSource' and most session-scoped fields are unavailable and will error. Common realtime dimensions: country, city, deviceCategory, unifiedScreenName, eventName. Common realtime metrics: activeUsers, screenPageViews, eventCount. For anything older than 30 minutes use ga4_run_report instead. Read-only.

ParameterTypeDescription
metrics *arrayRealtime metric API names, e.g. ['activeUsers','screenPageViews'].
propertyId *stringNumeric GA4 property ID, with or without the 'properties/' prefix. Not the G-XXXXXXX measurement ID.
dimensionsarrayRealtime dimension API names, e.g. ['country','unifiedScreenName','deviceCategory']. Note the realtime schema is a SUBSET of the standard reporting schema — 'date' and most session-scoped dimensions…
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.

ga4_list_account_summaries

Lists every Google Analytics account the authenticated user can see, with the properties under each. Use this FIRST to discover the numeric propertyId that other GA4 tools require. Returns account name, display name, and for each property its ID and display name. Read-only.

ParameterTypeDescription
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.

ga4_list_custom_dimensions

Lists custom dimensions configured on a GA4 property, with parameter name, display name, and scope (EVENT/USER/ITEM). Useful for discovering which custom dimensions exist before referencing them in ga4_run_report. Read-only.

ParameterTypeDescription
propertyId *stringNumeric GA4 property ID, with or without the 'properties/' prefix. Call ga4_list_account_summaries to discover it.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.

ga4_list_key_events

Lists key events (formerly 'conversions') on a GA4 property, with counting method and whether each is deletable. Read-only.

ParameterTypeDescription
propertyId *stringNumeric GA4 property ID, with or without the 'properties/' prefix. Call ga4_list_account_summaries to discover it.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.

gsc_list_sites

Lists every Search Console property the authenticated user can access, with their permission level. Use this FIRST to get the exact siteUrl string other Search Console tools need — the format is significant ('https://example.com/' for URL-prefix properties, 'sc-domain:example.com' for Domain properties). Read-only.

ParameterTypeDescription
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.

gsc_search_analytics_query

Returns clicks, impressions, CTR and average position from Search Console, grouped by the dimensions you choose. This is the primary SEO analysis tool. siteUrl must be the exact string from gsc_list_sites. Dates are YYYY-MM-DD only — relative forms like '28daysAgo' are NOT supported here (unlike the GA4 tools). Data lags roughly 2-3 days; use dataState='all' to include fresh partial data. Returns at most 25 rows by default while the API itself allows up to 25,000, so do not assume you are seeing everything — raise `limit` deliberately or narrow with filters. Page with `startRow`. Read-only…

ParameterTypeDescription
endDate *stringYYYY-MM-DD, inclusive.
siteUrl *stringExact property string from Search Console: 'https://example.com/' (URL-prefix) or 'sc-domain:example.com' (Domain). Call gsc_list_sites for valid values.
startDate *stringYYYY-MM-DD. Relative dates are NOT supported.
aggregationTypestringDefaults to 'auto'. Cannot be 'byProperty' when grouping or filtering by page.
dataStatestring'final' (default) excludes incomplete data. 'all' includes fresh partial data. 'hourly_all' enables the 'hour' dimension.
dimensionFilterGroupsarrayFilter groups: [{ groupType: 'and', filters: [{ dimension, operator, expression }] }]. Operators: contains, equals, notContains, notEquals, includingRegex, excludingRegex (RE2 syntax). You may filter…
dimensionsarrayGroup by these. 'hour' requires dataState='hourly_all'. Results are keyed in the order supplied.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
startRowintegerZero-based offset for paging. Search Console uses an offset, not a page token.
typestringSearch surface. Defaults to 'web'. Replaces the deprecated `searchType`.

gsc_list_sitemaps

Lists sitemaps submitted for a Search Console property, with last-downloaded time, warning and error counts, and per-type indexed counts. Useful for diagnosing indexing problems. Read-only.

ParameterTypeDescription
siteUrl *stringExact property string from Search Console. Call gsc_list_sites for valid values.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.

gsc_inspect_url

Returns Google's index status for a single URL: coverage verdict, last crawl time, Google-selected vs user-declared canonical, mobile usability, and rich-results verdict. QUOTA: 2,000 queries per day and 600 per minute PER PROPERTY. Do not loop this over a list of URLs without checking the quota budget first — inspect specific URLs the user asked about, and prefer gsc_search_analytics_query for anything aggregate. Read-only.

ParameterTypeDescription
inspectionUrl *stringFully-qualified URL to inspect. Must belong to the siteUrl property.
siteUrl *stringThe Search Console property that owns the URL being inspected.
languageCodestringBCP-47 code for localized result text, e.g. 'en-US'. Optional.

gtm_list_accounts

Lists every Google Tag Manager account the authenticated user can access. Use this FIRST to discover accountId, then gtm_list_containers, then gtm_list_workspaces. Read-only.

ParameterTypeDescription
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.

gtm_list_containers

Lists containers in a Tag Manager account. Call gtm_list_accounts first to get the accountId. NOTE the response has two different IDs: `containerId` is the numeric internal ID that every other GTM tool needs, while `publicId` is the GTM-XXXXXXX string shown in the UI. Pass the numeric one. Read-only.

ParameterTypeDescription
accountId *stringGTM account ID, with or without the 'accounts/' prefix. Call gtm_list_accounts to discover it.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.

gtm_list_workspaces

Lists workspaces in a container. Workspaces are the safe editing surface — all writes in this server operate on a workspace, never the live container. Accepts either a full container `path` or accountId + containerId (numeric internal ID). Read-only.

ParameterTypeDescription
accountIdstringGTM account ID. Ignored if `path` is supplied.
containerIdstringGTM container ID — the NUMERIC internal ID from gtm_list_containers, not the GTM-XXXXXXX public ID.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.
pathstringFull container path 'accounts/{a}/containers/{c}'. Alternative to supplying accountId and containerId separately.

gtm_list_tags

Lists tags in a Tag Manager workspace with their type, firing triggers and parameters. Accepts a full workspace `path` or accountId + containerId + workspaceId. Parameters are condensed to key/value pairs for readability. Read-only.

ParameterTypeDescription
accountIdstringGTM account ID. Ignored if `path` is supplied.
containerIdstringNumeric internal container ID, not GTM-XXXXXXX.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.
pathstringFull workspace path 'accounts/{a}/containers/{c}/workspaces/{w}'. Alternative to the three IDs.
workspaceIdstringWorkspace ID from gtm_list_workspaces.

gtm_list_triggers

Lists triggers in a Tag Manager workspace with their type and firing conditions. Accepts a full workspace `path` or accountId + containerId + workspaceId. Read-only.

ParameterTypeDescription
accountIdstringGTM account ID. Ignored if `path` is supplied.
containerIdstringNumeric internal container ID, not GTM-XXXXXXX.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.
pathstringFull workspace path 'accounts/{a}/containers/{c}/workspaces/{w}'. Alternative to the three IDs.
workspaceIdstringWorkspace ID from gtm_list_workspaces.

gtm_list_variables

Lists user-defined variables in a Tag Manager workspace with their type and parameters. Note this returns user-defined variables only — built-in variables are a separate collection. Accepts a full workspace `path` or accountId + containerId + workspaceId. Read-only.

ParameterTypeDescription
accountIdstringGTM account ID. Ignored if `path` is supplied.
containerIdstringNumeric internal container ID, not GTM-XXXXXXX.
limitintegerMaximum rows to return. Defaults to 25 to protect the context window. Prefer narrowing the query over raising this.
pageTokenstringOpaque token from a previous response's `nextPageToken`, to fetch the following page. Paging is manual so the caller controls cost.
pathstringFull workspace path 'accounts/{a}/containers/{c}/workspaces/{w}'. Alternative to the three IDs.
workspaceIdstringWorkspace ID from gtm_list_workspaces.