analytics
PostHog MCP Integration for Vercel AI SDK
Connect PostHog to Vercel AI SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.
Connect PostHog 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.
PostHog MCP Config for Vercel AI SDK
Prefer CLI JSON calls when a workflow only needs one deterministic integration operation.
{
"mcpServers": {
"kosmokrator-posthog": {
"type": "stdio",
"command": "kosmo",
"args": [
"mcp:serve",
"--integration=posthog",
"--write=deny"
]
}
}
} Run the Gateway Manually
kosmokrator mcp:serve --integration=posthog --write=deny Why Use KosmoKrator Here
Expose only PostHog 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.
PostHog Tools Visible to Vercel AI SDK
Vercel AI SDK sees stable MCP tool names generated from the PostHog integration catalog.
| MCP tool | Source function | Type | Description |
|---|---|---|---|
integration__posthog__posthog_capture_event | posthog.posthog_capture_event | Write | Send (capture) a custom event to PostHog for a specific user. The event will appear in the PostHog events stream and can be used in insights and funnels. |
integration__posthog__posthog_list_events | posthog.posthog_list_events | Read | List events from PostHog with optional filtering by event name, user, date range, and pagination. |
integration__posthog__posthog_get_event | posthog.posthog_get_event | Read | Get details of a specific PostHog event by its unique ID, including all event properties and metadata. |
integration__posthog__posthog_list_persons | posthog.posthog_list_persons | Read | List persons (users) from PostHog. Optionally search by name, email, or distinct ID to find specific users. |
integration__posthog__posthog_get_person | posthog.posthog_get_person | Read | Get details of a specific PostHog person (user) by their unique ID, including properties and event history metadata. |
integration__posthog__posthog_list_feature_flags | posthog.posthog_list_feature_flags | Read | List all feature flags in the PostHog project, including their status, rollout percentages, and filter conditions. |
integration__posthog__posthog_get_feature_flag | posthog.posthog_get_feature_flag | Read | Get details of a specific PostHog feature flag by its ID, including rollout configuration and filter conditions. |
integration__posthog__posthog_create_feature_flag | posthog.posthog_create_feature_flag | Write | Create a new feature flag in PostHog with a name, key, and optional rollout configuration. |
integration__posthog__posthog_update_feature_flag | posthog.posthog_update_feature_flag | Write | Update an existing PostHog feature flag — change its active state, filters, or rollout percentage. |
integration__posthog__posthog_delete_feature_flag | posthog.posthog_delete_feature_flag | Write | Delete a feature flag from PostHog. This action is permanent and cannot be undone. |
integration__posthog__posthog_list_insights | posthog.posthog_list_insights | Read | List saved insights in the PostHog project. Optionally filter by insight type (e.g., TRENDS, FUNNELS, RETENTION, PATHS). |
integration__posthog__posthog_get_insight | posthog.posthog_get_insight | Read | Get details of a specific PostHog insight by its ID, including its query configuration and cached results. |
integration__posthog__posthog_list_dashboards | posthog.posthog_list_dashboards | Read | List dashboards in the PostHog project. Dashboards contain collections of insights organized for monitoring. |
integration__posthog__posthog_get_dashboard | posthog.posthog_get_dashboard | Read | Get details of a specific PostHog dashboard by its ID, including its layout and contained insights. |
integration__posthog__posthog_list_cohorts | posthog.posthog_list_cohorts | Read | List cohorts in the PostHog project. Cohorts are dynamic groups of users defined by behavioral or property conditions. |