analytics
Google Analytics MCP Integration for Vercel AI SDK
Connect Google Analytics to Vercel AI SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.
Connect Google Analytics to Vercel AI SDK
Use KosmoKrator as a local integration gateway for Vercel AI SDK agents and scripts.
Create an MCP client that starts or connects to the KosmoKrator gateway for the selected integration. The gateway is local, scoped to this integration, and starts with
--write=deny so Vercel AI SDK can inspect read-capable tools without receiving write access by default.
Google Analytics MCP Config for Vercel AI SDK
Prefer CLI JSON calls when a workflow only needs one deterministic integration operation.
{
"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
Expose only Google Analytics instead of a broad multi-service tool list.
Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.
Start read-only, then opt into ask or allow for trusted workspaces.
Google Analytics Tools Visible to Vercel AI SDK
Vercel AI SDK sees stable MCP tool names generated from the Google Analytics integration catalog.
| MCP tool | Source function | Type | Description |
|---|---|---|---|
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. |