# googleanalytics/google-analytics-mcp architecture

> Architecture diagram of the GitHub repository googleanalytics/google-analytics-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/googleanalytics/google-analytics-mcp
- Repository: https://github.com/googleanalytics/google-analytics-mcp

## Overview

This is an experimental local MCP server that exposes Google Analytics account/property discovery and reporting tools to an MCP client. The workflow is: the client connects over stdio, the server delegates tool listing and calls to the coordinator, and the selected tool builds an Analytics API request, obtains a configured client, and returns serialized results. The README documents account/property details, Ads links, standard, funnel, custom-metadata, and realtime reports. Source excerpts also show annotations and conversion reporting. Some reporting-module internals were only partially sampled, so unverified links are omitted.

Main entry points: [`analytics_mcp/tools/client.py`](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/client.py) (Analytics API clients), [`analytics_mcp/coordinator.py`](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/coordinator.py) (Tool coordinator), [`analytics_mcp/tools/reporting/metadata.py`](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/metadata.py) (Custom metadata), [`analytics_mcp/tools/reporting/core.py`](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/core.py) (Core reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["MCP entry"]
  node_server["stdio server<br/>[server.py]"]
  node_coordinator["Tool coordinator<br/>[coordinator.py]"]
end

subgraph group_admin["Account administration"]
  node_account_tools["Account and property tools<br/>[info.py]"]
end

subgraph group_reporting["Analytics reporting"]
  node_report_core["Core reports<br/>[core.py]"]
  node_report_funnel["Funnel reports<br/>[funnel.py]"]
  node_report_conversion["Conversion reports<br/>[conversions.py]"]
  node_report_realtime["Realtime reports<br/>[realtime.py]"]
  node_report_metadata["Custom metadata<br/>[metadata.py]"]
end

subgraph group_shared["API and serialization"]
  node_api_client["Analytics API clients<br/>[client.py]"]
  node_tool_utils["Request and proto utilities<br/>[utils.py]"]
end

node_mcp_user(("MCP client"))
node_admin_api["Google Analytics Admin API"]
node_data_api["Google Analytics Data API"]

node_mcp_user -->|"connects via stdio"| node_server
node_server -->|"runs app"| node_coordinator
node_coordinator -->|"registers and dispatches"| node_account_tools
node_coordinator -->|"registers and dispatches"| node_report_core
node_coordinator -->|"registers and dispatches"| node_report_funnel
node_coordinator -->|"registers and dispatches"| node_report_conversion
node_coordinator -->|"registers and dispatches"| node_report_realtime
node_coordinator -->|"registers and dispatches"| node_report_metadata
node_account_tools -->|"creates API clients"| node_api_client
node_account_tools -->|"formats requests and results"| node_tool_utils
node_report_core -->|"creates data client"| node_api_client
node_report_core -->|"formats request and result"| node_tool_utils
node_report_core -->|"uses reporting hints"| node_report_metadata
node_report_funnel -->|"creates data client"| node_api_client
node_report_conversion -->|"creates data client"| node_api_client
node_report_realtime -->|"creates data client"| node_api_client
node_report_realtime -->|"formats request and result"| node_tool_utils
node_report_realtime -->|"uses reporting hints"| node_report_metadata
node_report_metadata -->|"creates data client"| node_api_client
node_report_metadata -->|"formats property and results"| node_tool_utils
node_api_client -->|"creates Admin clients"| node_admin_api
node_api_client -->|"creates Data clients"| node_data_api
node_account_tools -->|"requests account data"| node_admin_api
node_report_core -->|"runs reports"| node_data_api
node_report_funnel -->|"runs funnel reports"| node_data_api
node_report_conversion -->|"runs conversion reports"| node_data_api
node_report_realtime -->|"runs realtime reports"| node_data_api
node_report_metadata -->|"retrieves metadata"| node_data_api

click node_server "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/server.py"
click node_coordinator "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/coordinator.py"
click node_account_tools "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/admin/info.py"
click node_report_core "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/core.py"
click node_report_funnel "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/funnel.py"
click node_report_conversion "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/conversions.py"
click node_report_realtime "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/realtime.py"
click node_report_metadata "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/metadata.py"
click node_api_client "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/client.py"
click node_tool_utils "https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_coordinator,node_mcp_user toneBlue
class node_account_tools toneAmber
class node_report_core,node_report_funnel,node_report_conversion,node_report_realtime,node_report_metadata,node_admin_api,node_data_api toneMint
class node_api_client,node_tool_utils toneRose
```

## Components

### MCP entry

- [stdio server](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/server.py): `analytics_mcp/server.py`
- [Tool coordinator](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/coordinator.py): `analytics_mcp/coordinator.py`

### Account administration

- [Account and property tools](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/admin/info.py): `analytics_mcp/tools/admin/info.py`

### Analytics reporting

- [Core reports](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/core.py): `analytics_mcp/tools/reporting/core.py`
- [Funnel reports](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/funnel.py): `analytics_mcp/tools/reporting/funnel.py`
- [Conversion reports](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/conversions.py): `analytics_mcp/tools/reporting/conversions.py`
- [Realtime reports](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/realtime.py): `analytics_mcp/tools/reporting/realtime.py`
- [Custom metadata](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/reporting/metadata.py): `analytics_mcp/tools/reporting/metadata.py`

### API and serialization

- [Analytics API clients](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/client.py): `analytics_mcp/tools/client.py`
- [Request and proto utilities](https://github.com/googleanalytics/google-analytics-mcp/blob/main/analytics_mcp/tools/utils.py): `analytics_mcp/tools/utils.py`

### Other components

- **MCP client**
- **Google Analytics Admin API**
- **Google Analytics Data API**

## Connections

- MCP client → stdio server: connects via stdio (evidence: `analytics_mcp/server.py`)
- stdio server → Tool coordinator: runs app (evidence: `analytics_mcp/server.py`)
- Tool coordinator → Account and property tools: registers and dispatches (evidence: `analytics_mcp/coordinator.py`)
- Tool coordinator → Core reports: registers and dispatches (evidence: `analytics_mcp/coordinator.py`)
- Tool coordinator → Funnel reports: registers and dispatches (evidence: `analytics_mcp/coordinator.py`)
- Tool coordinator → Conversion reports: registers and dispatches (evidence: `analytics_mcp/coordinator.py`)
- Tool coordinator → Realtime reports: registers and dispatches (evidence: `analytics_mcp/coordinator.py`)
- Tool coordinator → Custom metadata: registers and dispatches (evidence: `analytics_mcp/coordinator.py`)
- Account and property tools → Analytics API clients: creates API clients (evidence: `analytics_mcp/tools/admin/info.py`)
- Account and property tools → Request and proto utilities: formats requests and results (evidence: `analytics_mcp/tools/admin/info.py`)
- Core reports → Analytics API clients: creates data client (evidence: `analytics_mcp/tools/reporting/core.py`)
- Core reports → Request and proto utilities: formats request and result (evidence: `analytics_mcp/tools/reporting/core.py`)
- Core reports → Custom metadata: uses reporting hints (evidence: `analytics_mcp/tools/reporting/core.py`)
- Funnel reports → Analytics API clients: creates data client (evidence: `analytics_mcp/tools/reporting/funnel.py`)
- Conversion reports → Analytics API clients: creates data client (evidence: `analytics_mcp/tools/reporting/conversions.py`)
- Realtime reports → Analytics API clients: creates data client (evidence: `analytics_mcp/tools/reporting/realtime.py`)
- Realtime reports → Request and proto utilities: formats request and result (evidence: `analytics_mcp/tools/reporting/realtime.py`)
- Realtime reports → Custom metadata: uses reporting hints (evidence: `analytics_mcp/tools/reporting/realtime.py`)
- Custom metadata → Analytics API clients: creates data client (evidence: `analytics_mcp/tools/reporting/metadata.py`)
- Custom metadata → Request and proto utilities: formats property and results (evidence: `analytics_mcp/tools/reporting/metadata.py`)
- Analytics API clients → Google Analytics Admin API: creates Admin clients (evidence: `analytics_mcp/tools/client.py`)
- Analytics API clients → Google Analytics Data API: creates Data clients (evidence: `analytics_mcp/tools/client.py`)
- Account and property tools → Google Analytics Admin API: requests account data (evidence: `analytics_mcp/tools/admin/info.py`)
- Core reports → Google Analytics Data API: runs reports (evidence: `analytics_mcp/tools/reporting/core.py`)
- Funnel reports → Google Analytics Data API: runs funnel reports (evidence: `analytics_mcp/tools/reporting/funnel.py`)
- Conversion reports → Google Analytics Data API: runs conversion reports (evidence: `analytics_mcp/tools/reporting/conversions.py`)
- Realtime reports → Google Analytics Data API: runs realtime reports (evidence: `analytics_mcp/tools/reporting/realtime.py`)
- Custom metadata → Google Analytics Data API: retrieves metadata (evidence: `analytics_mcp/tools/reporting/metadata.py`)
