Google Analytics MCP Server
Provides tools for interacting with Google Analytics 4 (GA4) data, including listing accounts and properties, running historical reports with custom metrics and dimensions, and fetching real-time user activity.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Analytics MCP ServerHow many users did my site have yesterday?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Analytics MCP Server
🚀 MCP Server para Google Analytics 4 (GA4) - Permite a agentes de IA consultar datos de Analytics en tiempo real.
✨ Características
📊 Listar cuentas de Google Analytics
🌐 Listar propiedades (sitios web) por cuenta
📈 Reportes históricos con métricas y dimensiones personalizables
⚡ Reportes en tiempo real - usuarios activos ahora mismo
Related MCP server: Google Analytics MCP Server
📋 Requisitos Previos
Node.js v18 o superior
Proyecto en Google Cloud con las siguientes APIs habilitadas:
Google Analytics Admin API
Google Analytics Data API
Credenciales OAuth 2.0 (Client ID y Client Secret)
🔧 Instalación
1. Clonar el repositorio
git clone https://github.com/TU_USUARIO/google-analytics-mcp.git
cd google-analytics-mcp
npm install2. Configurar Google Cloud
Ve a Google Cloud Console
Crea un proyecto o selecciona uno existente
Habilita las APIs:
Ve a APIs & Services > Credentials
Crea credenciales OAuth 2.0 Client ID (tipo: Desktop App)
Descarga el archivo JSON
3. Obtener Refresh Token
Edita get-refresh-token.js con tu Client ID y Client Secret, luego:
```bash
node get-refresh-token.jsNota: El script solicitará permisos de edición (
analytics.edit) para permitir la creación de nuevas propiedades.
Esto abrirá el navegador para autenticarte y generará google-analytics.yaml.
4. Crear credentials.json
Crea un archivo credentials.json con este formato:
{
"type": "authorized_user",
"client_id": "TU_CLIENT_ID",
"client_secret": "TU_CLIENT_SECRET",
"refresh_token": "TU_REFRESH_TOKEN",
"quota_project_id": "TU_PROJECT_ID"
}5. Verificar conexión
node test-connection.js🔌 Integración con Antigravity/Claude
Añade a tu mcp_config.json:
{
"mcpServers": {
"google-analytics": {
"command": "node",
"args": ["C:/ruta/a/google-analytics-mcp/mcp-server.js"]
}
}
}🛠️ Herramientas Disponibles
Herramienta | Descripción |
| Lista todas las cuentas de Analytics |
| Lista propiedades de una cuenta |
| Ejecuta un reporte con métricas/dimensiones |
| Usuarios activos en tiempo real |
Ejemplos de uso
"¿Cuántos usuarios tuvo mi sitio ayer?"
"Dame un reporte de países de los últimos 7 días"
"¿Cuánta gente hay navegando ahora?"📁 Estructura del Proyecto
google-analytics-mcp/
├── mcp-server.js # Servidor MCP principal
├── get-refresh-token.js # Script para obtener credenciales
├── test-connection.js # Test de conexión
├── credentials.json # (No subir) Credenciales OAuth
├── google-analytics.yaml # (No subir) Configuración
└── package.json🔒 Seguridad
⚠️ IMPORTANTE: Nunca subas
credentials.jsonogoogle-analytics.yamla Git.
Estos archivos contienen tokens de acceso a tus cuentas de Analytics.
📄 Licencia
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/creativedesignseo/google-analytics-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server