Skip to main content
Glama
Google Analytics MCP Server

Google Analytics MCP Server

Google Analytics MCP

Google Analytics 4용 로컬 MCP 서버입니다. SEO 및 유료 광고 보고에 중점을 둔 도구들을 통해 GA4 Data API를 래핑합니다.

도구

도구

목적

ga4_organic_search_performance

SEO: 랜딩 페이지, 소스, 국가 또는 기기별 오가닉 검색 세션/사용자/참여도/전환

ga4_paid_search_performance

유료 광고: 캠페인, 랜딩 페이지, 키워드 또는 소스별 유료 검색 세션/전환/비용/CPC

ga4_all_paid_performance

유료 광고: 비용 및 ROAS를 포함한 모든 유료 채널(검색 + 소셜 + 동영상 + 디스플레이)

ga4_google_ads_performance

유료 광고: Google Ads 캠페인 × 광고 그룹 × 키워드 (GA4 ↔ Google Ads 연결 필요)

ga4_landing_page_performance

세션/참여도/전환 기준 상위 랜딩 페이지 (채널 필터 선택 가능)

ga4_channel_performance

기본 채널 그룹 롤업

ga4_campaign_performance

캠페인 × 소스 × 매체 분석

ga4_conversions_by_source

소스/매체/채널별 전환 및 주요 이벤트

ga4_realtime_active_users

최근 30분간 활성 사용자

ga4_run_report

유연한 확장 도구 — 모든 측정기준 + 측정항목

설정

git clone https://github.com/ZLeventer/google-analytics-mcp-server.git
cd google-analytics-mcp-server
npm install
npm run build

자격 증명

.env.example을 .env로 복사하고 다음을 채우십시오:

  • GA4_PROPERTY_ID — GA4 관리자 → 속성 설정에서 확인 가능한 숫자 속성 ID (예: 123456789). 측정 ID(G-XXXXXXX)가 아닙니다.

  • GOOGLE_APPLICATION_CREDENTIALS — 서비스 계정 JSON 키 파일의 절대 경로.

서비스 계정 생성

  1. console.cloud.google.com으로 이동 → 프로젝트 선택/생성

  2. API 및 서비스 → 라이브러리 → Google Analytics Data API 활성화

  3. IAM 및 관리자 → 서비스 계정 → 서비스 계정 만들기 (ga4-mcp 등으로 이름 지정)

  4. 생성된 계정 → 키 → 키 추가 → 새 키 만들기 → JSON → 다운로드

  5. JSON을 이 디렉토리에 service-account.json으로 저장 (이미 .gitignore에 포함됨)

  6. GA4 → 관리자 → 속성 액세스 관리에서 + 클릭 → 서비스 계정 이메일(ga4-mcp@project-id.iam.gserviceaccount.com) 붙여넣기 → 뷰어 권한 할당

Google SDK는 GOOGLE_APPLICATION_CREDENTIALS를 자동으로 읽으므로 코드 변경이 필요 없습니다.

Claude Code에 설치

claude mcp add google-analytics \
  --env-file "/absolute/path/to/google-analytics-mcp-server/.env" \
  -- node "/absolute/path/to/google-analytics-mcp-server/dist/index.js"

또는 ~/.claude.json에 수동으로 추가:

{
  "mcpServers": {
    "google-analytics": {
      "command": "node",
      "args": ["/absolute/path/to/google-analytics-mcp-server/dist/index.js"],
      "env": {
        "GA4_PROPERTY_ID": "123456789",
        "GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/google-analytics-mcp-server/service-account.json"
      }
    }
  }
}

설치 후 Claude Code를 재시작하십시오.

날짜 형식

모든 날짜 인수는 GA4 형식을 지원합니다:

  • YYYY-MM-DD (예: 2026-04-01)

  • NdaysAgo (예: 28daysAgo, 90daysAgo)

  • yesterday, today

기본값: 28daysAgo → yesterday.

확인

자격 증명이 설정된 후:

node -e '
  import("./dist/tools/reports.js").then(m =>
    m.channelPerformance({ start_date: "7daysAgo", end_date: "yesterday", limit: 10 })
  ).then(r => console.log(JSON.stringify(r, null, 2)))
'

행이 반환되면 정상적으로 작동하는 것입니다. 예상되는 오류:

  • GA4_PROPERTY_ID is not set — .env 확인

  • PERMISSION_DENIED — 서비스 계정에 속성 뷰어 권한이 부여되지 않음

  • 403 Google Analytics Data API has not been used — GCP 프로젝트에서 API 활성화

로드맵

  • [ ] 필요 시 관리자 API 도구 (맞춤 측정기준, 전환 이벤트, 잠재고객 목록)

  • [ ] 순위/노출수/CTR 데이터를 위한 보조 서버로서의 Search Console MCP (본 서버 보완)

  • [ ] GA4 트래픽과 기업 정보(계정 수준 기여도)를 결합하기 위한 Demandbase MCP와 연동

Available Tools

10 tools
ga4_all_paid_performanceA

Paid: all paid channels (Search + Social + Video + Display + Other) broken down by channel × campaign × source × medium, with cost and ROAS.

Inputs: start_date, end_date, property_id, limit.

ga4_campaign_performanceB

Campaign × source × medium breakdown with sessions/conversions/revenue. Optional channel filter.

Inputs: start_date, end_date, property_id, limit, +1 more.

ga4_channel_performanceB

Default channel group rollup: sessions/users/conversions/revenue for Organic Search, Paid Search, Email, Direct, Referral, etc.

Inputs: start_date, end_date, property_id, limit.

ga4_conversions_by_sourceB

Conversions and key events broken down by session source × medium × channel group. Sorted by key events desc.

Inputs: start_date, end_date, property_id, limit.

ga4_google_ads_performanceA

Paid: Google Ads campaign × ad group × keyword performance (impressions, clicks, cost, CPC, conversions, ROAS). Requires Google Ads ↔ GA4 link.

Inputs: start_date, end_date, property_id, limit.

ga4_landing_page_performanceA

Top landing pages by sessions/engagement/conversions. Optional channel filter (e.g. 'Organic Search', 'Paid Search').

Inputs: start_date, end_date, property_id, limit, +1 more.

ga4_organic_search_performanceA

SEO: sessions/users/engagement/conversions for Organic Search traffic, broken down by landing page (default), source, country, or device.

Inputs: start_date, end_date, property_id, limit, +1 more.

ga4_paid_search_performanceB

Paid: sessions/conversions/cost/CPC for Paid Search traffic, broken down by campaign (default), landing page, keyword, or source.

Inputs: start_date, end_date, property_id, limit, +1 more.

ga4_realtime_active_usersB

Current active users (last 30 min) broken down by screen/page, country, device, or audience.

Inputs: property_id, breakdown, limit.

ga4_run_reportA

Flexible GA4 Data API runReport. Pass any dimensions + metrics. Use for custom reports the preset tools don't cover.

Inputs: dimensions (required), metrics (required), start_date, end_date, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool targets a distinct area of GA4 data: all paid, specific channels, campaigns, conversions, landing pages, organic/paid search, realtime, and a generic report. No two tools have overlapping purposes that would cause confusion.

    Naming Consistency5/5

    All tool names consistently follow the 'ga4_<descriptive_name>' format using snake_case. The naming pattern is predictable and uniform across the entire set.

    Tool Count5/5

    10 tools is well within the ideal 3-15 range for a focused analytics server. Each tool serves a clear purpose, and the count feels neither excessive nor insufficient for covering core GA4 queries.

    Completeness4/5

    The set covers acquisition, behavior, conversions, and realtime analytics well. Minor gaps exist (e.g., user demographics, event details), but the flexible ga4_run_report tool allows agents to fill these gaps for custom reports.

    Related MCP Connectors