Google Analytics MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| GA4_PROPERTY_ID | Yes | Your Google Analytics 4 Property ID (numeric, e.g., 123456789) | |
| GOOGLE_APPLICATION_CREDENTIALS | Yes | Path to your Google Analytics service account key JSON file |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| search_schemaA | Searches for a keyword across all available dimensions and metrics for the property. Returns a short, ranked list of the most relevant fields. This is the most efficient way to discover dimensions and metrics for a specific query. Args: keyword: One or more keywords to search for (e.g., "user", "campaign revenue"). |
| get_property_schemaA | Returns the complete schema for the configured GA4 property, including all available dimensions and metrics (standard and custom). Warning: This can be a very large object (10k+ tokens). Use search_schema for most discovery tasks. |
| list_dimension_categoriesA | List all available GA4 dimension categories based on the property's schema. This is a low-cost way to begin exploring the schema. |
| list_metric_categoriesA | List all available GA4 metric categories based on the property's schema. This is a low-cost way to begin exploring the schema. |
| get_dimensions_by_categoryA | Get all dimensions in a specific category with their descriptions. Args: category: The category name to retrieve dimensions for. |
| get_metrics_by_categoryA | Get all metrics in a specific category with their descriptions. Args: category: The category name to retrieve metrics for. |
| get_ga4_dataA | Retrieve GA4 data with built-in intelligence for better and safer results. CRITICAL WORKFLOW INSTRUCTIONS FOR AI AGENTS: To ensure deterministic and successful data retrieval, you MUST follow this sequence:
Smart Features:
Args: dimensions: List of GA4 dimensions (e.g., ["date", "city"]). MUST be verified via schema tools. metrics: List of GA4 metrics (e.g., ["totalUsers", "sessions"]). MUST be verified via schema tools. date_range_start: Start date in YYYY-MM-DD format or relative date ('7daysAgo'). date_range_end: End date in YYYY-MM-DD format or relative date ('yesterday'). dimension_filter: (Optional) A GA4 FilterExpression dictionary. Both camelCase and snake_case keys are transparently auto-translated and supported. Example simple filter structure: { "filter": { "fieldName": "sessionSource", "stringFilter": {"value": "google", "matchType": "CONTAINS"} } } Example logical group (andGroup, orGroup, notExpression): { "andGroup": { "expressions": [ {"filter": {"fieldName": "deviceCategory", "stringFilter": {"value": "mobile"}}}, {"filter": {"fieldName": "country", "stringFilter": {"value": "United States"}}} ] } } limit: (Optional) Maximum number of rows to return. Defaults to 1000. estimate_only: (Optional) If True, returns only the estimated row count without fetching the full dataset. proceed_with_large_dataset: (Optional) Set to True to bypass the data volume warning and execute the query anyway. enable_aggregation: (Optional) If True, uses server-side aggregation when beneficial. Defaults to True. |
| get_troubleshooting_guideA | Fetches the latest troubleshooting and setup guides Over-The-Air (OTA) from ga4mcp.com. Use this tool whenever you encounter a schema error, dimension_filter parse error, IAM / 403 authorization error, or boot-time setup error. Args: topic: The topic of the guide to fetch. Valid options are "setup", "iam", or "schema". |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| get_setup_guide | Provides instructions to the agent on how to heal the human's MCP setup. |
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/surendranb/google-analytics-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server