MCP server for Google Analytics integration
Project description
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
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 mcp_google_analytics-0.0.2.tar.gz.
File metadata
- Download URL: mcp_google_analytics-0.0.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5db2f77347a2504b05f0b88dfd514ccb1da3d637ac4c818c7c104ae802d0cd4e
|
|
| MD5 |
5556022ce4c41de417ac31060a499e26
|
|
| BLAKE2b-256 |
e2818d6041b0ed8696b86eebb5806d1ed76e02962fb16d5a012196e3ef8e13a0
|
File details
Details for the file mcp_google_analytics-0.0.2-py3-none-any.whl.
File metadata
- Download URL: mcp_google_analytics-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b88a48ebf7a929c2ea1efc4218f5c71f0735f59f95b45c84b6c8c769c4ca33b5
|
|
| MD5 |
a996833c578930d9ccab244d5bfc2892
|
|
| BLAKE2b-256 |
7ab6959ed3d10d4a6a89684161605047c8c775b95ad4988ead83988a75e1fa76
|