Google Analytics 4 MCP

io.scalably由 scalably.io 發布v1.0.1更新於 Oct 24, 2026

Google Analytics 4 MCP: reports, realtime, funnels, pivots, metadata, admin lists. 17 tools.

已驗證STDIO僅桌面資料與分析商業與電商

概覽

AI 產生的概覽

唯讀的 MCP 伺服器,讓助理查詢 Google Analytics 4 報表,並列出服務帳戶可存取的資源的 Admin API 設定。

可以做什麼
在 GA4 資源上執行標準、批次、樞紐、即時與漏斗報表,支援維度與指標篩選,並可對照中繼資料目錄檢查相容性。列出帳戶與資源、資源詳細資料、資料串流、自訂維度與指標、關鍵事件、目標對象、Google Ads 連結與註解。稽核過去 12 個月內誰讀取了該資源的哪些資料。回傳含狀態、配額與資料品質提示的結構化 JSON,部分結果附分頁位移量。
適用情境
適合讓助理取得 GA4 的流量、事件或漏斗數據,檢視資源設定,或在不開啟 GA4 介面的情況下稽核存取情形。適用於已有 Google Cloud 專案與服務帳戶的分析師與開發者。
執行需求
以 Python 套件透過 uvx 在本機執行,或作為 Claude Desktop 安裝包使用。需要已啟用 Analytics Data API 與 Admin API 的 Google Cloud 專案、服務帳戶 JSON 金鑰,以及指向該檔案的 GOOGLE_APPLICATION_CREDENTIALS 環境變數。服務帳戶須在每個 GA4 資源上被加入為檢視者。可選 GA4_LOG_LEVEL。
安裝前請注意
需要由 GOOGLE_APPLICATION_CREDENTIALS 指向的服務帳戶私密金鑰檔案,應視為機密。存取為唯讀,但存取報表會顯示誰讀取了資源的哪些資料。結果可能被取樣、設閾值或將高基數列合併為 (other),配額依資源共用,頻繁查詢可能觸及上限。漏斗報表為 v1alpha,可能變動。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Google Analytics 4 MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Google Analytics 4 MCP

Read-only MCP server for Google Analytics 4. Seventeen tools cover the read surface of both the Data API and the Admin API: standard, batch, pivot, realtime and funnel reports; the metadata catalog and compatibility check; and admin lists for properties, streams, custom dimensions and metrics, key events, audiences, Google Ads links, annotations and access reports. We run this server in production for every analytics client.

Install

Claude Code:

bash
claude mcp add ga4 -e GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json -- uvx scalably-ga4-mcp

Codex:

bash
codex mcp add ga4 --env GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json -- uvx scalably-ga4-mcp

Claude Desktop: download ga4-mcp.mcpb from the latest GitHub release and open it.

Setup

  1. In Google Cloud, create or pick a project and enable the Google Analytics Data API and the Google Analytics Admin API on it (APIs and Services, Library).
  2. Create a service account in that project and download its JSON key.
  3. Add the service account's email as a Viewer on each GA4 property you want to query (Admin, Property access management).

No OAuth consent screen is needed; the server authenticates as the service account with the analytics.readonly scope. One service account can read any property that grants it access, so there is no per-client configuration beyond step 3 above.

Call ga4_list_account_summaries first to discover which property_id values the service account can see, then pass one into the reporting or admin tools.

Tools (17)

ToolWhat it does
ga4_list_account_summariesList every GA4 account and its child properties accessible to this service account
ga4_get_property_detailsFull metadata for a single GA4 property
ga4_list_data_streamsList all data streams (web, iOS, Android) on a GA4 property
ga4_list_custom_dimensionsList custom dimensions configured on a GA4 property
ga4_list_custom_metricsList custom metrics configured on a GA4 property
ga4_list_key_eventsList key events (formerly conversions) on a GA4 property
ga4_list_audiencesList audiences defined on a GA4 property
ga4_list_google_ads_linksList Google Ads links attached to a GA4 property
ga4_list_property_annotationsList reporting annotations on a GA4 property
ga4_run_access_reportAudit log of who read what on a GA4 property, last 12 months
ga4_get_metadataFetch the full GA4 dimension and metric catalog for a property
ga4_run_reportRun a GA4 standard report, the workhorse tool
ga4_batch_run_reportsRun up to 5 GA4 reports in a single round trip
ga4_run_pivot_reportRun a GA4 pivot report
ga4_run_realtime_reportRun a GA4 real-time report covering the last 30 minutes
ga4_check_compatibilityValidate whether a dimension and metric combo can be queried together
ga4_run_funnel_reportRun a GA4 funnel report (v1alpha, drop-off analysis)

Configuration

VariableRequiredPurpose
GOOGLE_APPLICATION_CREDENTIALSyesPath to a Google service-account JSON file with the analytics.readonly scope; share each property with the service account email
GA4_LOG_LEVELnoINFO (default) or DEBUG

Filter expression shape

Every tool accepting dimension_filter / metric_filter takes a dict:

json
{"filter": {"field_name": "country", "string_filter": {"value": "US"}}}

Compose with boolean groups:

json
{"and_group": {"expressions": [  {"filter": {"field_name": "country", "string_filter": {"value": "US"}}},  {"filter": {"field_name": "deviceCategory", "string_filter": {"value": "mobile"}}}]}}

A raw {"field_name": ..., "string_filter": ...} is auto-wrapped into {"filter": {...}}.

Reply shape

Every tool returns JSON with status (succeeded, partial, no_op), operation, summary, target, result, proof, warnings, recovery. Failures surface as a tool error whose text is ga4_request_failed: <message> <hint>. proof.nextOffset on a partial status means: continue from that offset. proof.propertyQuota carries the property's remaining Data API quota so the caller can self-throttle. proof.dataQualityLimited is true when the response was sampled, thresholded, or collapsed high-cardinality rows into (other); treat such a result as directionally useful, not exact.

Limits

250,000 rows per Data API response (the server caps any higher client-supplied limit). Batch reports: up to 5 per call. Funnel reports: up to 10 steps. Realtime reports use a separate, smaller dimension and metric catalog covering only the last 30 minutes; non-realtime data typically lags 24 to 48 hours. Funnel reporting is v1alpha and its shape can change upstream. Every quota bucket (core reports, realtime, funnel) allows roughly 14,000 quota tokens per project per property per hour (a complex query can cost more than one token); 360 properties get a 10x multiplier. Re-check Google's current quota page before relying on an exact number.

Verify

Each release lists the package version, the .mcpb sha256 and the production commit it was derived from in CHANGELOG.md. CI runs the tests and a clean install of the built wheel on every push.

Privacy Policy

This server runs locally, on your machine, under your own credentials. It collects no personal data, contains no telemetry, stores nothing persistently, and talks only to the vendor API it wraps. No third party, including Scalably, receives your data. Contact: [email protected]. Canonical copy: https://scalably.io/connector-privacy.html

License

MIT. Copyright Scalably.

來源:README.md,提交 90b8c28

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分