MCP Server for Google Analytics Data API
Project description
Syne Google Analytics MCP Server
A Model Context Protocol (MCP) server for Google Analytics 4 data.
Overview
This server provides an MCP interface to Google Analytics 4 data, allowing AI assistants to query GA4 data through a standardized protocol.
Features
The server exposes the following tools via the MCP call_tool endpoint:
run_ga4_report: Runs a standard report using the Google Analytics Data API v1beta. Allows specifying metrics, optional dimensions, date range, and row limit.run_realtime_report: Runs a realtime report using the Google Analytics Data API v1beta. Allows specifying metrics, optional dimensions, and row limit.get_metadata: Gets metadata about available metrics and dimensions (or all) for the configured GA4 property.
It also handles authentication using Google service account credentials provided in the configuration.
tools = [
types.Tool(
name="run_ga4_report",
description="Runs a report using the Google Analytics Data API v1beta.",
inputSchema={
"type": "object",
"properties": {
"metrics": {
"type": "array",
"items": {"type": "string"},
"description": "Required. List of metric names (e.g., ['activeUsers', 'sessions']). See GA4 documentation for valid metrics."
},
"dimensions": {
"type": "array",
"items": {"type": "string"},
"description": "Optional. List of dimension names (e.g., ['country', 'city']). See GA4 documentation for valid dimensions.",
"optional": True
},
"date_range": {
"type": "string", # Could also be an object, handled by ga_handler
"description": "Optional. Date range alias ('today', 'yesterday', 'last7days', 'last30days') or an object like {'start_date': 'YYYY-MM-DD', 'end_date': 'YYYY-MM-DD'}.",
"default": "last30days"
},
"limit": {
"type": "integer",
"description": "Optional. The maximum number of rows to return in the report.",
"default": 10
}
},
"required": ["metrics"]
},
),
types.Tool(
name="run_realtime_report",
description="Runs a realtime report using the Google Analytics Data API v1beta.",
inputSchema={
"type": "object",
"properties": {
"metrics": {
"type": "array",
"items": {"type": "string"},
"description": "Required. List of metric names (e.g., ['activeUsers', 'screenPageViews']). See GA4 realtime documentation for valid metrics."
},
"dimensions": {
"type": "array",
"items": {"type": "string"},
"description": "Optional. List of dimension names (e.g., ['country', 'city']). See GA4 realtime documentation for valid dimensions.",
"optional": True
},
"limit": {
"type": "integer",
"description": "Optional. The maximum number of rows to return in the report.",
"default": 10
}
},
"required": ["metrics"]
},
),
types.Tool(
name="get_metadata",
description="Gets metadata about available metrics and dimensions for the configured property.",
inputSchema={
"type": "object",
"properties": {
"metadata_type": {
"type": "string",
"description": "Optional. Specifies the type of metadata to retrieve: 'metrics', 'dimensions', or 'all'.",
"default": "all",
"enum": ["metrics", "dimensions", "all"] # Adding enum for clarity
}
}
},
),
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file syne_ga_mcp-0.0.1.tar.gz.
File metadata
- Download URL: syne_ga_mcp-0.0.1.tar.gz
- Upload date:
- Size: 34.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b4be469311c9725e0ba47ac548b3a2a214b8ad879b4ac9b899a21d9b26af2ee
|
|
| MD5 |
0b71bf3f8b98d5acde6133ae677ca3f7
|
|
| BLAKE2b-256 |
0256889e464daf84e4a8ff4db269843e856542427c53193335f7b82f9cb53bc4
|
File details
Details for the file syne_ga_mcp-0.0.1-py3-none-any.whl.
File metadata
- Download URL: syne_ga_mcp-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e179325d786358daaf68e9c0d06fe8902a9e3a3dfd1b6c79347d690d9e2f31f
|
|
| MD5 |
ecad6513914983554ba38f1beb32e46e
|
|
| BLAKE2b-256 |
f27e6b8fcee54e45af7c9aee357fafc6a2ffbc486abe00fec9a7306593359b8d
|