KosmoKrator

analytics

Google Analytics MCP Integration for OpenAI Agents SDK

Connect Google Analytics to OpenAI Agents SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

4 functions 4 read 0 write OAuth browser flow auth

Connect Google Analytics to OpenAI Agents SDK

Attach KosmoKrator integration tools to OpenAI Agents SDK workflows through a local MCP gateway.

Start the KosmoKrator MCP gateway locally and point the OpenAI Agents SDK MCP tool at that process or wrapper. The gateway is local, scoped to this integration, and starts with --write=deny so OpenAI Agents can inspect read-capable tools without receiving write access by default.

Google Analytics MCP Config for OpenAI Agents SDK

Use headless JSON commands for CI-style execution and MCP for agent tool discovery.

{
  "mcpServers": {
    "kosmokrator-google_analytics": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=google_analytics",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=google_analytics --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Google Analytics instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Google Analytics Tools Visible to OpenAI Agents

OpenAI Agents sees stable MCP tool names generated from the Google Analytics integration catalog.

MCP toolSource functionTypeDescription
integration__google_analytics__google_analytics_list_properties google_analytics.google_analytics_list_properties Read List all accessible GA4 properties with their IDs and names. Use this first to discover the propertyId needed for other Analytics tools.
integration__google_analytics__google_analytics_metadata google_analytics.google_analytics_metadata Read List all available dimensions and metrics for a GA4 property, including custom ones. Use this to discover what data can be queried in reports.
integration__google_analytics__google_analytics_realtime google_analytics.google_analytics_realtime Read Run a GA4 realtime report showing activity in the last 30 minutes. Common dimensions: country, city, deviceCategory, unifiedScreenName (page/screen), platform. Common metrics: activeUsers, screenPageViews, eventCount, conversions.
integration__google_analytics__google_analytics_report google_analytics.google_analytics_report Read Run a GA4 analytics report. Returns rows of dimension/metric data for the specified date range. Common dimensions: sessionSource, sessionMedium, sessionDefaultChannelGroup (traffic source); pagePath, pageTitle, landingPage (pages); country, city (geo); deviceCategory, browser, operatingSystem (device); date, dateHour, month (time); newVsReturning (user); eventName (events). Common metrics: sessions, totalUsers, newUsers, activeUsers (traffic); screenPageViews, bounceRate, averageSessionDuration, engagementRate, sessionsPerUser (engagement); eventCount, conversions (events); purchaseRevenue, totalRevenue (e-commerce). Dates: YYYY-MM-DD or relative: "today", "yesterday", "7daysAgo", "28daysAgo", "30daysAgo", "90daysAgo", "365daysAgo". Filter operators: exact, contains, begins_with, ends_with, regex, in_list. Metric filter operators: equal, less_than, greater_than, less_than_or_equal, greater_than_or_equal.

Related Google Analytics Pages