IntegrateIntegrate
Integrations

PostHog Integration

Read PostHog organizations, projects, insights, flags, and analytics data

The PostHog integration provides access to read PostHog organizations, projects, insights, flags, and analytics data through the Integrate MCP server.

Installation

The PostHog integration is included with the SDK:

import { posthogIntegration } from "integrate-sdk/server";

Setup

1. Create a PostHog OAuth App

  1. Create an OAuth application for PostHog
  2. Configure your redirect URI
  3. Note your Client ID and Client Secret

2. Configure the Integration on Your Server

Add the PostHog integration to your server configuration. The integration automatically reads POSTHOG_CLIENT_ID and POSTHOG_CLIENT_SECRET from your environment variables:

import { createMCPServer, posthogIntegration } from "integrate-sdk/server";

export const { client: serverClient } = createMCPServer({
  apiKey: process.env.INTEGRATE_API_KEY,
  integrations: [
    posthogIntegration({
      scopes: ["openid", "profile", "email", "organization:read", "project:read", "user:read", "query:read", "insight:read", "dashboard:read", "feature_flag:read", "experiment:read", "annotation:read", "cohort:read", "person:read", "event_definition:read", "property_definition:read", "session_recording:read", "action:read"], // Optional
    }),
  ],
});

You can override the environment variables by passing explicit values:

posthogIntegration({
  clientId: process.env.CUSTOM_POSTHOG_ID,
  clientSecret: process.env.CUSTOM_POSTHOG_SECRET,
      scopes: ["openid", "profile", "email", "organization:read", "project:read", "user:read", "query:read", "insight:read", "dashboard:read", "feature_flag:read", "experiment:read", "annotation:read", "cohort:read", "person:read", "event_definition:read", "property_definition:read", "session_recording:read", "action:read"], // Optional
});

3. Client-Side Usage

The default client automatically includes all integrations. You can use it directly:

import { client } from "integrate-sdk";

await client.authorize("posthog");
const result = await client.posthog.getCurrentUser({});

console.log(result);

If you're using a custom client, add the integration to the integrations array:

import { createMCPClient, posthogIntegration } from "integrate-sdk";

const customClient = createMCPClient({
  integrations: [posthogIntegration()],
});

Configuration Options

Prop

Type

Default Scopes

These defaults are applied unless you override scopes in the integration config:

  • openid
  • profile
  • email
  • organization:read
  • project:read
  • user:read
  • query:read
  • insight:read
  • dashboard:read
  • feature_flag:read
  • experiment:read
  • annotation:read
  • cohort:read
  • person:read
  • event_definition:read
  • property_definition:read
  • session_recording:read
  • action:read

Tools

posthog_get_current_user

Get current user

No parameters.

posthog_list_organizations

List organizations

Prop

Type

posthog_get_organization

Get organization

Prop

Type

posthog_list_projects

List projects

Prop

Type

posthog_get_project

Get project

Prop

Type

posthog_run_hogql_query

Run hogql query

Prop

Type

posthog_list_insights

List insights

Prop

Type

posthog_get_insight

Get insight

Prop

Type

posthog_list_dashboards

List dashboards

Prop

Type

posthog_get_dashboard

Get dashboard

Prop

Type

posthog_list_feature_flags

List feature flags

Prop

Type

posthog_get_feature_flag

Get feature flag

Prop

Type

posthog_list_experiments

List experiments

Prop

Type

posthog_get_experiment

Get experiment

Prop

Type

posthog_list_annotations

List annotations

Prop

Type

posthog_get_annotation

Get annotation

Prop

Type

posthog_list_cohorts

List cohorts

Prop

Type

posthog_get_cohort

Get cohort

Prop

Type

posthog_list_event_definitions

List event definitions

Prop

Type

posthog_get_event_definition

Get event definition

Prop

Type

posthog_list_property_definitions

List property definitions

Prop

Type

posthog_get_property_definition

Get property definition

Prop

Type

posthog_list_persons

List persons

Prop

Type

posthog_get_person

Get person

Prop

Type

posthog_list_session_recordings

List session recordings

Prop

Type

posthog_get_session_recording

Get session recording

Prop

Type

Notes

  • Category: Analytics
  • Authentication mode: OAuth

On this page