Google Analytics MCP Server
A Model Context Protocol (MCP) server for Google Analytics integration. This server provides tools for interacting with Google Analytics, including running reports, querying accounts and properties, and accessing metadata.
Features
- Run Reports: Get analytics data with specified metrics and dimensions
- Account Management: List accounts and properties
- Metadata Access: Get information about available metrics and dimensions
- Resources: Access Google Analytics accounts, properties, and metadata
- Prompts: Templates for common Google Analytics workflows
Installation
pip install mcp-google-analytics
Configuration
Set the following environment variables:
export GOOGLE_ANALYTICS_CLIENT_ID="your_client_id"
export GOOGLE_ANALYTICS_CLIENT_SECRET="your_client_secret"
export GOOGLE_ANALYTICS_REFRESH_TOKEN="your_refresh_token"
export GOOGLE_ANALYTICS_PROPERTY_ID="your_property_id"
OAuth Setup
To get the required OAuth credentials:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Analytics Data API and Google Analytics Admin API
- Create OAuth 2.0 credentials
- Use the OAuth 2.0 Playground to get a refresh token:
- Go to https://developers.google.com/oauthplayground/
- Configure the OAuth 2.0 Playground to use your client ID and secret
- Select the required Google Analytics scopes
- Click "Authorize APIs"
- Exchange the authorization code for tokens
- Save the refresh token
Usage
Starting the server directly
mcp-google-analytics
Using with Claude Desktop
Add the following to your claude_desktop_config.json file:
"mcp-google-analytics": {
"command": "uvx",
"args": [
"mcp-google-analytics"
],
"env": {
"GOOGLE_ANALYTICS_CLIENT_ID": "your_client_id",
"GOOGLE_ANALYTICS_CLIENT_SECRET": "your_client_secret",
"GOOGLE_ANALYTICS_REFRESH_TOKEN": "your_refresh_token",
"GOOGLE_ANALYTICS_PROPERTY_ID": "your_property_id"
}
}
Replace the environment variables with your actual Google Analytics credentials.
Available Tools
- run_report: Run a basic report with specified metrics and dimensions
- get_accounts: List all Google Analytics accounts
- get_properties: List all properties within an account
- get_metadata: Get metadata about available metrics and dimensions
Available Resources
- google_analytics://accounts: List of all accounts
- google_analytics://properties/{account_id}: List properties for a specific account
- google_analytics://metadata: Metadata about available metrics and dimensions
Available Prompts
- create_basic_report: Template for creating a basic report
- analyze_traffic_sources: Template for analyzing traffic sources
- track_conversions: Template for tracking conversions
Version
0.0.1
Metadata
Release files for mcp-google-analytics 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_google_analytics-0.0.3.tar.gz | 5.0 kB | Without provenance | Details for mcp_google_analytics-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_google_analytics-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for mcp_google_analytics-0.0.3-py3-none-any.whl |
Total release size: 11.0 kB
Release files / mcp_google_analytics-0.0.3.tar.gz
| Download URL | mcp_google_analytics-0.0.3.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e9ded88c579ca17c4811cbfb68273f41350470c18a86e1bd63be2374d7edefa
|
|
BLAKE2b-256 checksum How to use checksums |
ead57027d657b01c638fe7997534502e99b67e9462f3be13b93335058afc89de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Release files / mcp_google_analytics-0.0.3-py3-none-any.whl
| Download URL | mcp_google_analytics-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44a2b0bfd4f352154004791d029e29c61fcd2e1a204686f1282f0d513c263344
|
|
BLAKE2b-256 checksum How to use checksums |
c43f60fb7a089aa281c82820096d24f9b0963020a7a9c0709b13bd6782582205
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Security for mcp-google-analytics 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.