analytics
PostHog MCP Integration for OpenAI Agents SDK
Connect PostHog to OpenAI Agents SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.
Connect PostHog 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.
PostHog MCP Config for OpenAI Agents SDK
Use headless JSON commands for CI-style execution and MCP for agent tool discovery.
{
"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 OpenAI Agents
OpenAI Agents 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. |