KosmoKrator

analytics

PostHog MCP Integration for Claude Code

Connect PostHog to Claude Code through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

15 functions 11 read 4 write API token auth

Connect PostHog to Claude Code

Connect local KosmoKrator integrations to Claude Code through one scoped MCP gateway entry.

Add KosmoKrator as a stdio MCP server in the Claude Code project config and select the integrations that should be visible. The gateway is local, scoped to this integration, and starts with --write=deny so Claude Code can inspect read-capable tools without receiving write access by default.

PostHog MCP Config for Claude Code

Claude Code can launch the local kosmo binary directly from the project MCP config.

{
  "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

Scoped tools

Expose only PostHog 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.

PostHog Tools Visible to Claude Code

Claude Code sees stable MCP tool names generated from the PostHog integration catalog.

MCP toolSource functionTypeDescription
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.

Related PostHog Pages