Skip to content

connectors: add google-analytics-4 (Admin + Data + Realtime + Funnel)#243

Merged
keysersoft merged 1 commit into
mainfrom
keysersoft/google-analytics-4
May 22, 2026
Merged

connectors: add google-analytics-4 (Admin + Data + Realtime + Funnel)#243
keysersoft merged 1 commit into
mainfrom
keysersoft/google-analytics-4

Conversation

@keysersoft
Copy link
Copy Markdown
Contributor

Summary

New `google-analytics-4` adapter mirroring the 7 tools the upstream googleanalytics/google-analytics-mcp server exposes. Catalog grows 167 → 168.

Tool Endpoint
`ga4_get_account_summaries` Admin v1beta `/accountSummaries`
`ga4_get_property_details` Admin v1beta `/properties/{id}`
`ga4_list_google_ads_links` Admin v1beta `/properties/{id}/googleAdsLinks`
`ga4_list_custom_dimensions` Admin v1beta `/properties/{id}/customDimensions`
`ga4_list_custom_metrics` Admin v1beta `/properties/{id}/customMetrics`
`ga4_run_report` Data v1beta `/properties/{id}:runReport`
`ga4_run_realtime_report` Data v1beta `/properties/{id}:runRealtimeReport`
`ga4_run_funnel_report` Data v1alpha `/properties/{id}:runFunnelReport`

Single adapter, dual host (analyticsadmin + analyticsdata) via the absolute-URL support already in the REST engine.

Auth

User OAuth2 with refresh token against `oauth2.googleapis.com/token`. Already supported by the engine — same flow as Zoho/Pinterest/FreshBooks/Sage.

Service account JWT (RS256) intentionally not supported in v1 — would require new engine code (~1-2 days). Documented in the connector `instructions` with a workaround (dedicated automation Google account). I'll add RS256 to the engine when there's enough demand to justify it; that work unlocks Drive/Sheets/BigQuery/Calendar too.

Vendor-MCP-already-exists situation

Yes — Google ships an official Python MCP server. Same value-add reasoning as our HubSpot / Atlassian audit (PR #232 era):

Their MCP AnythingMCP wrapper
Local `pipx run analytics-mcp` install Zero install, browser-based
gcloud ADC JSON file on disk Encrypted refresh_token in our DB
Per-machine config One MCP key across Claude + ChatGPT + Copilot
No audit log Per-tool-call audit log for governance

Verification

```
$ node scripts/validate-adapters.mjs
Validated 168 adapters: 168 passed, 0 failed.

$ npx jest --testPathPatterns='google-analytics-4|catalog.spec' --silent
Test Suites: 2 passed
Tests: 2143 passed, 2143 total
```

Live spec asserts:

  • baseUrl = analyticsadmin (Admin host)
  • OAuth2 against `oauth2.googleapis.com/token`
  • All 3 report tools route to `analyticsdata.googleapis.com` (absolute URLs)
  • All 5 admin tools route to `analyticsadmin.googleapis.com`
  • Full tool naming + cardinality

Test plan

  • CI green
  • Merge → trigger docker-publish.yml → deploy-cloud.yml
  • Verify `curl https://cloud.anythingmcp.com/api/adapters | jq 'map(select(.slug=="google-analytics-4"))'` returns 1 entry
  • After deploy: follow-up PR on website repo for the EN/DE/IT/ES/JA/RU/ZH guides (auto-generated)

… Funnel)

Mirrors the 7 tools the upstream googleanalytics/google-analytics-mcp
server exposes — split into 8 here because their `get_custom_dimensions
_and_metrics` is two separate Admin endpoints, easier to call as two
distinct tools than to merge in our request shape.

Single adapter, dual-host (analyticsadmin.googleapis.com for metadata
+ analyticsdata.googleapis.com for reports) via the absolute-URL
support already in the REST engine.

Auth: OAuth2 with user refresh_token against the standard Google
token endpoint. Service-account JWT (RS256) NOT supported yet —
documented in the instructions with a workaround (dedicated automation
Google account). Adding RS256 to the engine would unlock all other
Google product APIs (Drive, Sheets, BigQuery, Calendar) — deferring
until we see actual demand for GA4.

Tools:
  ga4_get_account_summaries          (Admin v1beta)
  ga4_get_property_details           (Admin v1beta)
  ga4_list_google_ads_links          (Admin v1beta)
  ga4_list_custom_dimensions         (Admin v1beta)
  ga4_list_custom_metrics            (Admin v1beta)
  ga4_run_report                     (Data v1beta)
  ga4_run_realtime_report            (Data v1beta)
  ga4_run_funnel_report              (Data v1alpha)

Tested: validate-adapters.mjs OK, 2143/2143 jest tests pass including
the new spec that asserts: dual-host routing, OAuth2 token URL,
tool naming, full tool set coverage. Catalog regenerated (168 total).
@keysersoft keysersoft requested a review from D3nisty as a code owner May 22, 2026 08:46
@keysersoft keysersoft merged commit 1e58d1a into main May 22, 2026
11 checks passed
@keysersoft keysersoft deleted the keysersoft/google-analytics-4 branch May 22, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant