Google Analytics 4
Yet another Google Analytics MCP Server that connects your AI assistants with Google Analytics data.
It exposes Google Analytics Admin and Data APIs as callable tools. This allows developers to query account structures, run reports, and retrieve metadata without writing boilerplate API code.
Features
- 📊 Retrieve account, property, and Google Ads link details.
- 📈 Run standard and realtime reports using GA Data API.
- 🔍 Get available dimensions, metrics, and filter hints for accurate queries.
- 🛠️ Auto-hinted parameters reduce errors in report configurations.
- 🔑 Built on Application Default Credentials for secure, local auth.
How to Use It
1. Install pipx via pip:
python -m pip install pipx2. In your Google Cloud project, enable:
- Google Analytics Admin API
- Google Analytics Data API
3. Authenticate using Application Default Credentials (ADC):
gcloud auth application-default login \
--scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform \
--client-id-file=YOUR_CLIENT_JSON_FILEReplace YOUR_CLIENT_JSON_FILE with your OAuth client JSON. The user must have read access to the GA properties.
Alternatively, use service account impersonation:
gcloud auth application-default login \
--impersonate-service-account=SERVICE_ACCOUNT_EMAIL \
--scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform4. Configure your MCP clients like Claude, Gemini CLI, or Cursor:
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": [
"run",
"--spec",
"git+https://github.com/googleanalytics/google-analytics-mcp.git",
"google-analytics-mcp"
]
}
}
}Optional: Pin credentials by adding the GOOGLE_APPLICATION_CREDENTIALS env variable:
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/adc.json"
}5. Open your AI assistant and type /mcp. You should see analytics-mcp listed. Try prompts like:
what can the analytics-mcp server do?run a report for users and sessions last 7 dayslist custom metrics in my property with 'web' in the name
Available Tools
get_account_summaries: Lists all GA accounts and properties accessible to the user.get_property_details: Fetch property settings like timezone, currency, and industry category.list_google_ads_links: Returns linked Google Ads accounts for a given property.run_report: Executes a report with dimensions, metrics, date ranges, and filters.get_dimensions,get_metrics: Retrieve all available dimensions/metrics for a property (including custom ones).get_standard_dimensions,get_standard_metrics: List built-in GA dimensions and metrics.run_report_date_ranges_hints: Suggests valid date range formats for therun_reporttool.run_report_metric_filter_hints,run_report_dimension_filter_hints: Help construct correct filter syntax.run_realtime_report: Pulls live user count, active events, and current platforms.get_realtime_dimensions,get_realtime_metrics: Lists what you can query in real-time.
FAQs
Q: Can I use this without a Google Cloud project?
A: No. You need a Google Cloud project with the Analytics Admin and Data APIs enabled. The server relies on Google’s auth system and API endpoints, which require project-level configuration.
Q: Does this support GA4 only, or Universal Analytics too?
A: GA4 only. The server uses the GA Data API v1, which doesn’t support Universal Analytics. UA properties won’t appear in results.
Q: Why am I getting permission errors even with ADC set up?
A: ADC must include the https://www.googleapis.com/auth/analytics.readonly scope. Also, the authenticated user needs Read permission on the GA property. Double-check IAM roles in Google Cloud and GA account access.
Q: Can I run this server headless in a CI/CD pipeline?
A: Yes, but use a service account key file. Set GOOGLE_APPLICATION_CREDENTIALS to the key path and ensure the service account has the required GA read permissions. Avoid user-based ADC in automated environments.
Q: Is the server stateful or does it make live API calls each time?
A: It makes live API calls. No caching or local storage. Each tool invocation hits Google’s backend, so results are current but subject to rate limits.
Latest MCP Servers
CVE
WebMCP
webmcp is an MCP server that connects MCP clients to web search, page fetching, and local LLM-based extraction. It’s ideal…
Google Meta Ads GA4
Featured MCP Servers
Notion
Claude Peers
Excalidraw
FAQs
Q: What exactly is the Model Context Protocol (MCP)?
A: MCP is an open standard, like a common language, that lets AI applications (clients) and external data sources or tools (servers) talk to each other. It helps AI models get the context (data, instructions, tools) they need from outside systems to give more accurate and relevant responses. Think of it as a universal adapter for AI connections.
Q: How is MCP different from OpenAI's function calling or plugins?
A: While OpenAI's tools allow models to use specific external functions, MCP is a broader, open standard. It covers not just tool use, but also providing structured data (Resources) and instruction templates (Prompts) as context. Being an open standard means it's not tied to one company's models or platform. OpenAI has even started adopting MCP in its Agents SDK.
Q: Can I use MCP with frameworks like LangChain?
A: Yes, MCP is designed to complement frameworks like LangChain or LlamaIndex. Instead of relying solely on custom connectors within these frameworks, you can use MCP as a standardized bridge to connect to various tools and data sources. There's potential for interoperability, like converting MCP tools into LangChain tools.
Q: Why was MCP created? What problem does it solve?
A: It was created because large language models often lack real-time information and connecting them to external data/tools required custom, complex integrations for each pair. MCP solves this by providing a standard way to connect, reducing development time, complexity, and cost, and enabling better interoperability between different AI models and tools.
Q: Is MCP secure? What are the main risks?
A: Security is a major consideration. While MCP includes principles like user consent and control, risks exist. These include potential server compromises leading to token theft, indirect prompt injection attacks, excessive permissions, context data leakage, session hijacking, and vulnerabilities in server implementations. Implementing robust security measures like OAuth 2.1, TLS, strict permissions, and monitoring is crucial.
Q: Who is behind MCP?
A: MCP was initially developed and open-sourced by Anthropic. However, it's an open standard with active contributions from the community, including companies like Microsoft and VMware Tanzu who maintain official SDKs.



