A structured interface for interacting with Google Analytics APIs, simplifying tasks like querying reports and managing properties.
GA-MCP (Google Analytics Management Control Panel) is a lightweight Node.js package that provides developers with a structured interface to interact with Google Analytics APIs. It simplifies common GA tasks like querying analytics reports, managing properties, audiences, and more—making it ideal for data analysts, developers, and marketing teams looking to automate reporting and analytics workflows. MCP standard.
get_reports
: Get analytics reports data for specified metrics and dimensionslist_accounts
: List all Google Analytics accountslist_properties
: List properties for a Google Analytics accountlist_data_streams
: List data streams for a propertylist_custom_dimensions
: List custom dimensions for a propertylist_custom_metrics
: List custom metrics for a propertylist_conversion_events
: List conversion events for a propertyCreate OAuth2 Credentials:
Go to the Google Cloud Console
Create or select a project
Enable the Google Analytics API
Go to "Credentials" → "Create Credentials" → "OAuth 2.0 Client IDs"
Configure the consent screen and choose the appropriate application type:
Option A: Web Application (Recommended)
http://localhost:3000/auth/callback
to "Authorized redirect URIs"Option B: Desktop Application
Generate Access and Refresh Tokens:
npm run oauth-helper
# 1. Set up environment file
npm run setup-env
# 2. Edit .env with your OAuth2 Client ID and Secret (from step 1 above)
# 3. Generate tokens
npm run oauth-helper
# 4. Copy the generated tokens to your .env file
# 5. Build and start
npm run build
node dist/index.js
Clone this repository and install dependencies:
pnpm install
# or
npm install
pnpm build
# or
npm run build
Option 1: Using .env file (Recommended)
Set up your environment file:
npm run setup-env
# This creates .env from the template
# Edit .env file with your actual credentials
Option 2: Using export commands
Set the following environment variables:
export GOOGLE_CLIENT_ID=your_oauth2_client_id
export GOOGLE_CLIENT_SECRET=your_oauth2_client_secret
export GOOGLE_ACCESS_TOKEN=your_access_token
export GOOGLE_REFRESH_TOKEN=your_refresh_token
Start the MCP server:
node dist/index.js
To use this MCP server with Cursor, add a .cursor/mcp.json
file to your project root:
{
"mcpServers": {
"ga-mcp": {
"command": "npx",
"args": ["-y", "ga-mcp"],
"env": {
"GOOGLE_CLIENT_ID": "your_oauth2_client_id",
"GOOGLE_CLIENT_SECRET": "your_oauth2_client_secret",
"GOOGLE_ACCESS_TOKEN": "your_access_token",
"GOOGLE_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}
To use this MCP server with VSCode, add a .vscode/mcp.json
file to your project root:
{
"servers": {
"ga-mcp": {
"command": "npx",
"args": ["-y", "ga-mcp"],
"env": {
"GOOGLE_CLIENT_ID": "your_oauth2_client_id",
"GOOGLE_CLIENT_SECRET": "your_oauth2_client_secret",
"GOOGLE_ACCESS_TOKEN": "your_access_token",
"GOOGLE_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}
This configuration enables VSCode to recognize and manage the Google Analytics MCP server automatically.
This configuration enables Cursor to recognize and manage the Google Analytics MCP server automatically.
The MCP server automatically handles token refresh using the provided refresh token. If the access token expires, it will be automatically refreshed during API calls.
This error occurs when you have a Web application OAuth client but are using the out-of-band redirect URI. Solutions:
Solution 1: Use Web Application (Recommended)
http://localhost:3000/auth/callback
to "Authorized redirect URIs"GOOGLE_REDIRECT_URI=http://localhost:3000/auth/callback
in your .env
fileSolution 2: Switch to Desktop Application
GOOGLE_REDIRECT_URI=urn:ietf:wg:oauth:2.0:oob
in your .env
fileAST Consulting is a premier digital consulting firm specializing in FinOps, cloud optimization, AI/ML solutions, digital transformation, and performance marketing. With over 100 years of combined leadership experience and a portfolio impacting 50M+ businesses and 500M+ users, AST delivers measurable outcomes by blending strategic vision with deep technical expertise.
We developed ga-mcp as part of our commitment to empower marketers, analysts, and digital teams with tools that drive efficiency, transparency, and actionable insights. Whether optimizing cloud spend or automating analytics intelligence pipelines, AST builds solutions that scale.
👉 Visit us at www.astconsulting.in
An MCP server for processing payments using stdio transport, configured via environment variables.
An MCP server designed to run on Cloudflare Workers, featuring OAuth login support.
Analyze files and extract Indicators of Compromise (IOCs) by interacting with the Joe Sandbox Cloud service.
Exposes Check Point security management data for AI-powered automation and analysis.
A remote MCP server deployable on Cloudflare Workers without authentication.
Get up-to-date EC2 pricing information with one call. Fast. Powered by a pre-parsed AWS pricing catalogue.
A self-hostable MCP server for Cloudflare Workers with OAuth login support, using Cloudflare KV for storage.
Retrieve logs from the Mezmo observability platform.
MCP Server that connects AI agents to Chargebee platform.
Advanced text-to-image generation model using the fal.ai API. Requires a FAL_KEY environment variable.