Analytics MCP
Integrates with AWS Secrets Manager to securely store and retrieve Google service account credentials.
Automates Google Analytics 4 property creation, data streams, and optional BigQuery export for tracking.
Automates Google Tag Manager container setup, including GA4 config tags, event tags, publishing, and snippets.
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., "@Analytics MCPShow health status for example.com prod"
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.
Analytics MCP
One-click GA4 + GTM analytics automation for developers, agencies, and AI agents.
Automate Google Analytics 4 and Google Tag Manager setup, apply opinionated tracking blueprints, monitor health, and manage everything via CLI, REST API, MCP tools, or Web UI.
Features • Quickstart • Screenshots • CLI • MCP • API
Features
Feature | Description |
GA4 Automation | Create properties, web data streams, optional BigQuery export |
GTM Automation | Containers, GA4 config tags, event tags, publish & snippets |
Tracking Blueprints | SaaS, ecommerce, content, Web Vitals presets with dataLayer specs |
Site Analyzer | Playwright-based crawling — discover pages, group by business intent, identify tracking opportunities |
GA4 Data Querying | Schema discovery + natural language queries (like surendranb/google-analytics-mcp) |
Consent Presets | none, basic, and advanced consent-gated triggers |
Multi-Environment | Separate dev/stage/prod configurations |
Governance | Audit log, GTM diff, rollback |
Health Monitoring | Scheduled checks, webhook/email alerts, time-series charts |
MCP Integration | 10 tools for Claude, Gemini, and other MCP clients |
Web Dashboard | Create, monitor, and manage sites visually with charts |
Security | KMS/Secrets Manager support (AWS, GCP, Azure) |
Reliability | Automatic retry with exponential backoff for API calls |
Related MCP server: MCP Google Analytics 4 Server
Competitive Landscape
How MCP Metrics Compares
Project | Stars | What They Do | What MCP Metrics Adds |
131 | AI-powered GA4 + GTM event tracking with site analysis | Full property/container lifecycle + governance + health monitoring + integrated dashboard | |
222 | GA4 data querying for AI agents (read-only) | Write/setup side — create properties, GTM containers, blueprints via MCP | |
~50 | CLI for GTM API operations | Full platform — GA4 + GTM + blueprints + UI + health + governance | |
42 | GTM template for Core Web Vitals | Integrated blueprint — Web Vitals as first-class tracking preset |
Key Differentiators
vs jtrackingai/analytics-tracking-automation:
We have full GA4 property creation (they focus on event tracking within existing properties)
We have governance (audit logs, GTM diff, rollback)
We have health monitoring with time-series charts
We have integrated web dashboard (not just CLI skill)
We have consent management and cross-domain tracking
vs surendranb/google-analytics-mcp:
They are read/query only — GA4 data access for analysis
We are write/setup focused — create and configure GA4/GTM from scratch
Complementary pairing: Use MCP Metrics to set up tracking, use their server to query results
vs owntag/gtm-cli:
They provide low-level GTM API access
We provide high-level opinionated platform — one command for full setup
We add GA4 integration, blueprints, health monitoring, web UI
vs Web Vitals GTM Template:
They provide a GTM template gallery entry
We provide Web Vitals as a blueprint integrated into the full automation workflow
We include attribution data and debugging support in the dataLayer
Quickstart
Prerequisites
Docker & Docker Compose
Python 3.11+ (for local dev)
Google Cloud service account with GA4 Admin, GTM, and (optional) BigQuery permissions
1. Clone and configure
git clone https://github.com/abhishekshankar/MCP-Metrics.git
cd MCP-Metrics
cp config/env.example .env
# Edit .env with your GTM account ID and credentials path2. Start services
docker compose up -dAPI available at http://localhost:8000 — health check:
curl http://localhost:8000/health3. Create your first site
pip install -e ".[dev]"
analytics-mcp create \
--domain example.com \
--name "Example Site" \
--env prod \
--blueprint saas \
--pretty4. Web UI
cd web-ui && npm install && npm run devScreenshots
Dashboard
List all your analytics setups with health status at a glance.
┌─────────────────────────────────────────────────────────────┐
│ Sites Dashboard │
├──────────────┬──────────┬─────┬──────────┬────────┬────────┤
│ Domain │ Name │ Env │ Blueprint│ GTM │ Status │
├──────────────┼──────────┼─────┼──────────┼────────┼────────┤
│ example.com │ Example │ prod│ saas │ GTM-ABC│ active │
│ shop.com │ Shop │ prod│ ecommerce│ GTM-DEF│ active │
│ blog.com │ Blog │ prod│ content │ GTM-GHI│ active │
└──────────────┴──────────┴─────┴──────────┴────────┴────────┘Site Detail with Health Charts
View detailed health metrics with time-series charts showing events, sessions, and conversions over time.
┌─────────────────────────────────────────────────────────────┐
│ example.com · prod │
├─────────────────────────────────────────────────────────────┤
│ G-XXXXXXXX │ GTM-XXXX │ saas │ healthy │
├─────────────────────────────────────────────────────────────┤
│ Health Metrics (24h) │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ Events: 1,500 │ Sessions: 800 │ Conversions: 45 ││
│ └─────────────────────────────────────────────────────────┘│
│ │
│ Health Trends (30 Days) │
│ ═══════════════════════════════════════════════════════ │
│ ║ Chart: Events & Sessions over time ║ │
│ ║ Chart: Conversions bar chart ║ │
│ ═══════════════════════════════════════════════════════ │
│ │
│ GTM Configuration Diff │
│ ├─ Tags: +3 added, -1 removed │
│ ├─ Triggers: +2 added │
│ └─ Variables: no changes │
└─────────────────────────────────────────────────────────────┘Blueprint Editor
View, edit, and create custom tracking blueprints with live validation.
┌─────────────────────────────────────────────────────────────┐
│ Blueprint Editor │
│ [saas] [ecommerce] [content] [+ New Blueprint] │
├─────────────────────────────────────────────────────────────┤
│ name: saas │
│ description: SaaS product site tracking │
│ events: │
│ - signup_started │
│ - signup_completed │
│ - trial_started │
│ - pricing_view │
│ │
│ [Apply to Site] [Save Changes] │
└─────────────────────────────────────────────────────────────┘CLI Commands
Command | Description |
| Full GA4 + GTM + blueprint setup |
| Get site status |
| List all sites |
| Apply/update blueprint |
| Run health check |
| Rollback GTM version |
| Human-readable setup summary |
MCP Client Setup
Claude Desktop
Copy config/mcp-claude.example.json into your Claude Desktop MCP config:
{
"mcpServers": {
"analytics": {
"command": "python",
"args": ["/path/to/analytics_mcp_mcp_server.py"],
"env": {
"DATABASE_URL": "postgresql://..."
}
}
}
}Available MCP Tools
Tool | Description |
Setup & Management | |
| Create GA4 + GTM setup for a new site |
| Get current status of a site's analytics |
| Apply a tracking blueprint to a site |
| Get human-readable description of setup |
| Get health status with metrics |
GA4 Data & Schema | |
| Search dimensions/metrics by keyword (like surendranb/google-analytics-mcp) |
| List all GA4 dimension categories |
| List all GA4 metric categories |
| Get dimensions organized by category |
| Get metrics organized by category |
| Query GA4 data with intelligent defaults and row estimation |
Verification & Analysis | |
| Test GTM Preview mode — verify tags fire before publishing |
| Crawl site to discover pages and tracking opportunities |
REST API
Core Endpoints
Method | Endpoint | Description |
GET |
| Service health |
POST |
| Create site |
GET |
| List sites |
GET |
| Site status |
POST |
| Apply blueprint |
GET |
| Health check |
GET |
| Health history (charts data) |
GET |
| Blueprint version history |
GET |
| GTM config diff |
POST |
| Rollback |
GET |
| Audit log |
POST |
| Save custom blueprint |
POST |
| Site analyzer — crawl and analyze site structure (Playwright) |
POST |
| Preview verification — test GTM tags before publishing |
OpenAPI docs: http://localhost:8000/docs
Authentication
Pass X-API-Key header with admin or readonly key (configured in .env):
curl -H "X-API-Key: admin-key-change-me" http://localhost:8000/sitesArchitecture
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ CLI │ │ Web UI │ │ MCP Client │
│ (Typer) │ │ (React) │ │ (FastMCP) │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└────────────────┼────────────────┘
│
┌─────────▼──────────┐
│ FastAPI REST │
│ + MCP Server │
└─────────┬──────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌───────▼───────┐ ┌─────▼─────┐ ┌──────▼──────┐
│ GA4Service │ │ GTMService│ │HealthService│
│ (w/ retry) │ │ (w/ retry)│ │(w/ scheduler)│
└───────┬───────┘ └─────┬─────┘ └──────┬──────┘
│ │ │
└───────────────┼──────────────┘
│
┌───────────────▼───────────────┐
│ Google APIs (GA4, GTM, BQ) │
└───────────────────────────────┘
│
┌────────▼────────┐
│ PostgreSQL │
│ (Sites, Audit) │
└─────────────────┘Security Features
KMS/Secrets Manager Support
Store Google service account credentials securely:
# AWS Secrets Manager
KMS_PROVIDER=aws
AWS_SECRET_NAME=analytics-mcp/google-credentials
# GCP Secret Manager
KMS_PROVIDER=gcp
GOOGLE_CLOUD_PROJECT=your-project
# Azure Key Vault
KMS_PROVIDER=azure
AZURE_KEY_VAULT_URL=https://your-vault.vault.azure.net/
AZURE_SECRET_NAME=google-credentialsAPI Authentication
Admin and read-only API keys
Role-based access control
Audit logging of all operations
Development
# Install dependencies
pip install -e ".[dev]"
# Install Playwright browsers (required for site analyzer and preview verification)
playwright install chromium
# Run tests
MOCK_GOOGLE_APIS=true pytest backend/tests -v
# Run API locally
DATABASE_URL=postgresql://analytics:analytics@localhost:5432/analytics_mcp \
MOCK_GOOGLE_APIS=true \
PYTHONPATH=backend/src uvicorn main:app --reload
# Run migrations
alembic -c backend/alembic.ini upgrade head
# Web UI development
cd web-ui && npm install && npm run devConfiguration
Environment Variables
Variable | Description | Default |
| Use mock Google APIs (no real credentials needed) |
|
| Path to service account JSON | - |
| GTM account ID |
|
| Secrets manager (aws/gcp/azure) | - |
| Number of retry attempts for API calls |
|
| Health check scheduler interval |
|
See config/env.example for full configuration options.
Mock Mode
Set MOCK_GOOGLE_APIS=true (default in docker-compose) to run without real Google credentials. All GA4/GTM operations use in-memory mocks — ideal for development and CI.
Contributing
Contributions welcome! Please read our contributing guidelines (coming soon).
License
MIT — see LICENSE
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/abhishekshankar/MCP-Metrics'
If you have feedback or need assistance with the MCP directory API, please join our Discord server