Files
our-claude-skills/ga-agent-skills/01-mcp-setup/README.md
Andrew Yim 236be6c580 directory changes and restructuring
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 02:01:41 +09:00

3.0 KiB

Component 1: MCP Setup

Type: Infrastructure Priority: P0 Status: Not Started

Goal

Install and configure GA4 + BigQuery MCP servers for Claude Code.

Prerequisites

  • Google Cloud account
  • GA4 property access
  • gcloud CLI installed

Setup Steps

Step 1: Google Cloud Project

# Authenticate
gcloud auth login

# Set project (create if needed)
gcloud config set project YOUR_PROJECT_ID

# Enable APIs
gcloud services enable \
  analyticsdata.googleapis.com \
  analyticsadmin.googleapis.com \
  bigquery.googleapis.com

Step 2: Service Account

# Create service account
gcloud iam service-accounts create ga-mcp-agent \
  --display-name="GA MCP Agent"

# Get email
SA_EMAIL="ga-mcp-agent@YOUR_PROJECT_ID.iam.gserviceaccount.com"

# Grant BigQuery roles
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
  --member="serviceAccount:$SA_EMAIL" \
  --role="roles/bigquery.dataViewer"

gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
  --member="serviceAccount:$SA_EMAIL" \
  --role="roles/bigquery.jobUser"

# Download key
gcloud iam service-accounts keys create \
  ../config/service-account.json \
  --iam-account=$SA_EMAIL

Step 3: GA4 Property Access

  1. Go to GA4 Admin
  2. Property → Property Access Management
  3. Add user: ga-mcp-agent@YOUR_PROJECT_ID.iam.gserviceaccount.com
  4. Role: Viewer

Step 4: Install GA4 MCP Server

# Clone official server
git clone https://github.com/googleanalytics/google-analytics-mcp.git
cd google-analytics-mcp

# Setup Python environment
python -m venv venv
source venv/bin/activate
pip install -e .

# Test
export GOOGLE_APPLICATION_CREDENTIALS="../config/service-account.json"
python -m google_analytics_mcp --help

Step 5: Install BigQuery MCP Server

# Test with npx (no install needed)
npx -y @ergut/mcp-bigquery-server \
  --project-id YOUR_PROJECT_ID \
  --location us-central1 \
  --key-file ../config/service-account.json

Step 6: Configure Claude Code

Add to ~/.claude/mcp_servers.json:

{
  "mcpServers": {
    "google-analytics": {
      "command": "python",
      "args": ["-m", "google_analytics_mcp"],
      "cwd": "/path/to/google-analytics-mcp",
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
      }
    },
    "bigquery": {
      "command": "npx",
      "args": [
        "-y",
        "@ergut/mcp-bigquery-server",
        "--project-id", "YOUR_PROJECT_ID",
        "--location", "us-central1",
        "--key-file", "/path/to/service-account.json"
      ]
    }
  }
}

Step 7: Verify

# Restart Claude Code, then:
mcp-cli servers
# Should show: google-analytics, bigquery

mcp-cli tools google-analytics
mcp-cli tools bigquery

Checklist

  • GCP project configured
  • APIs enabled
  • Service account created
  • GA4 access granted
  • GA4 MCP installed
  • BigQuery MCP installed
  • Claude Code configured
  • Connection verified