Blog Logo
TAGS

Google Analytics MCP Server

Connect Google Analytics 4 data to Claude, Cursor and other MCP clients. Query your website traffic, user behavior, and analytics data in natural language with access to 200+ GA4 dimensions and metrics. Compatible with: Claude, Cursor and other MCP clients. I also built a Google Search Console MCP that enables you to mix & match the data from both sources. Prerequisites Check your Python setup: Check Python version (need 3.10+) python --version python3 --version Check pip pip --version pip3 --version Required: Python 3.10 or higher Google Analytics 4 property with data Service account with Analytics Reporting API access Step 1: Setup Google Analytics Credentials Create Service Account in Google Cloud Console 1. Go to Google Cloud Console 2. Create or select a project: New project: Click New Project Enter project name Create Existing project: Select from dropdown 3. Enable the Analytics APIs: Go to APIs & Services Library Search for Google Analytics Reporting API Click Enable Search for Google Analytics Data API Click Enable 4. Create Service Account: Go to APIs & Services Credentials Click Create Credentials Service Account Enter name (e.g., ga4-mcp-server) Click Create and Continue Skip role assignment Click Done 5. Download JSON Key: Click your service account Go to Keys tab Add Key Create New Key Select JSON Click Create Save the JSON file - youll need its path Add Service Account to GA4 Get service account email: Open the JSON file Find the client_email field Copy the email (format: [email protected]) Add to GA4 property: Go to Google Analytics Select your GA4 property Click Admin (gear icon at bottom left) Under Property Click Property access management Click Add users Paste the service account email Select Viewer role Uncheck Notify new users by email Click Add Find Your GA4 Property ID In Google Analytics Select your property Click Admin (gear icon) Under Property Click Property details Copy the Property ID (numeric, e.g., 123456789) Note: This is different from the Measurement