Skip to main content

Announcing StackOne Defender: leading open-source prompt injection guard for your agent Read More

PostHog MCP Server
for AI Agents

Production-ready PostHog MCP server with 63 extensible actions — plus built-in authentication, security, and optimized execution.

PostHog logo
PostHog MCP Server
Built by StackOne StackOne

Coverage

63 Agent Actions

Create, read, update, and delete across PostHog — and extend your agent's capabilities with custom actions.

Authentication

Agent Tool Authentication

Per-user OAuth in one call. Your PostHog MCP server gets session-scoped tokens with zero credentials stored on your infra.

Agent Auth →

Security

Agent Protection

Every PostHog tool response scanned for prompt injection in milliseconds — 88.7% accuracy, all running on CPU.

Prompt Injection Defense →

Performance

Max Agent Context. Min Cost.

Free up to 96% of your agent's context window to enhance reasoning and reduce cost, on every PostHog call.

Tools Discovery →

What is the PostHog MCP Server?

A PostHog MCP server lets AI agents read and write PostHog data through the Model Context Protocol — Anthropic's open standard for connecting LLMs to external tools. StackOne's PostHog MCP server ships with 63 pre-built actions, fully extensible via the Connector Builder — plus managed authentication, prompt injection defense, and optimized agent context. Connect it from MCP clients like Claude Desktop, Cursor, and VS Code, or from agent frameworks like OpenAI Agents SDK, LangChain, and Vercel AI SDK.

All PostHog MCP Tools and Actions

Every action from PostHog's API, ready for your agent. Create, read, update, and delete — scoped to exactly what you need.

An Actions

  • Retrieve An Action

    Retrieve details of a specific action

  • Update An Action

    Update an action's configuration

  • Delete An Action

    Delete an action (soft delete)

A Dashboards

  • Retrieve A Dashboard

    Retrieve details of a specific dashboard

  • Update A Dashboard

    Update a dashboard's configuration

A Feature Flags

  • Retrieve A Feature Flag

    Retrieve details of a specific feature flag

  • Update A Feature Flag

    Update a feature flag's configuration

Groups Types Metrics

  • Create Groups Types Metrics

    Create a new metric for a group type

  • Retrieve Groups Types Metrics

    Retrieve details of a specific group type metric

  • Update Groups Types Metrics

    Update a group type metric's configuration

  • Delete Groups Types Metrics

    Delete a group type metric

An Insights

  • Retrieve An Insight

    Retrieve details of a specific insight

  • Update An Insight

    Update an insight's configuration

  • Delete An Insight

    Delete an insight (soft delete)

Members

  • Update Members

    Update a member's details

  • Delete Members

    Remove a member from the organization

Organizations

  • Create Organizations

    Create a new organization

  • Retrieve Organizations

    Retrieve a list of organizations

  • Delete Organizations

    Delete an organization

Projects

  • Create Projects

    Create a new project within an organization

  • List Projects

    Retrieve a list of all projects in the organization

  • Delete Projects

    Delete a project

Roles

  • Create Role

    Create a new role

  • Retrieve Role

    Retrieve details of a specific role

  • Update Role

    Update a role's details

  • Delete Role

    Delete a role

Role Memberships

  • Create Role Membership

    Assign a user to a role

  • Retrieve Role Membership

    Retrieve details of a specific role membership

  • Delete Role Membership

    Remove a user from a role

A Session Recordings

  • Update A Session Recording

    Update a session recording's metadata

  • Delete A Session Recording

    Delete a session recording

Users

  • Retrieve Users

    Retrieve details of a specific user

  • Update Users

    Update a user's details

  • Delete Users

    Delete a user

Other (29)

  • Create Actions

    Create a new action

  • Create Dashboards

    Create a new dashboard

  • Create Feature Flags

    Create a new feature flag

  • Create Insights

    Create a new insight

  • List All Actions

    Retrieve a list of all actions

  • List All Activity Log

    Retrieve activity log entries for a project

  • List All Alerts

    Retrieve a list of all alerts

  • List All Dashboards

    Retrieve a list of all dashboards

  • List All Feature Flags

    Retrieve a list of all feature flags

  • List All Groups Types

    Retrieve a list of all group types

  • List All Groups Types Metrics

    Retrieve metrics for a specific group type

  • List All Insights

    Retrieve a list of all insights

  • List All Members

    Retrieve a list of organization members

  • Retrieve An Organization

    Retrieve details of a specific organization

  • List All Integrations

    List all organization-level integrations

  • Retrieve List

    List all projects in an organization

  • Retrieve An Organization Project

    Retrieve details of a specific project

  • List All Roles

    Retrieve a list of all roles

  • List All Role Memberships

    List all memberships for a specific role

  • List All Session Recordings

    Retrieve a list of all session recordings

  • List All Users

    Retrieve a list of all users

  • Update Groups Types Update Metadata

    Update group types metadata

  • Update Partial Organization

    Update an organization's settings

  • Update Partial Organization Project

    Update a project's configuration

  • Update Complete Product Onboarding

    Mark product onboarding as complete

  • Delete Groups Types

    Delete a group type

  • Capture Event

    Send a single event to PostHog

  • Capture Batch Events

    Send multiple events to PostHog in a single request

  • Change Organization

    Move a project to a different organization

Set Up Your PostHog MCP Server in Minutes

One endpoint. Any framework. Your agent is talking to PostHog in under 10 lines of code.

MCP Clients

Agent Frameworks

Claude Desktop
{
  "mcpServers": {
    "stackone": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote@latest",
        "https://api.stackone.com/mcp?x-account-id=<account_id>",
        "--header",
        "Authorization: Basic <YOUR_BASE64_TOKEN>"
      ]
    }
  }
}

More Data & Analytics MCP Servers

Tableau

114+ actions

SurveyMonkey

104+ actions

Microsoft Excel

101+ actions

Qlik

100+ actions

Snowflake

80+ actions

Amplitude

53+ actions

Gong

34+ actions

PostHog MCP Server FAQ

PostHog MCP server vs direct API integration — what's the difference?
A PostHog MCP server and direct API integration serve different use cases. Direct API integration is for software-to-software — backend code calling PostHog. A PostHog MCP server is for AI agents — MCP clients like Claude and Cursor, plus framework agents built with OpenAI, LangChain, or Vercel AI — discovering and calling PostHog at runtime. StackOne provides both.
How does PostHog authentication work for AI agents?
PostHog authentication for AI agents works through a StackOne Connect Session. Create one via the dashboard or the SDK — you get an auth link and ready-to-paste config for Claude Desktop, Cursor, and other MCP clients. Your user authenticates their own PostHog account; StackOne handles token exchange, storage, and refresh. Credentials never reach the LLM, and each user is isolated via origin_owner_id.
Are PostHog MCP tools vulnerable to prompt injection?
Yes — PostHog MCP tools can be vulnerable to indirect prompt injection. Any tool that reads user-written content — documents, messages, tickets, records, or free-text fields — is a potential vector. StackOne Defender scans every tool response before it enters the agent's context — regex patterns in ~1ms, then a MiniLM classifier in ~4ms. 88.7% accuracy, CPU-only.
What is the context bloat of a PostHog agent and how do I avoid it?
Context bloat happens when PostHog tool schemas and API responses eat your PostHog agent's memory, preventing it from reasoning effectively. A single PostHog query can return a massive JSON response, and connecting multiple tools compounds the problem. Tools Discovery and Code Mode reduce context bloat — loading only relevant tools per query and keeping raw responses out of the agent's context.
Can I limit which actions my PostHog agent can access?
Yes — you can limit which actions your PostHog agent can access directly from the StackOne dashboard. Toggle actions on or off, or restrict them to specific accounts, with no code changes to your agent. Session tokens can be scoped to exact actions so if one leaks, exposure stays contained.
Can I create custom agent actions for my PostHog MCP server?
Yes — you can create custom agent actions for your PostHog MCP server using Connector Builder. It's an integration agent your coding assistant (Claude Code, Cursor, or Copilot) can invoke to research PostHog's API, generate production-ready connector YAML, test against the live API, and validate before you ship.
When should I NOT use a PostHog MCP server?
Skip a PostHog MCP server if your integration is purely software-to-software — direct PostHog API integration is simpler when no AI agent is involved. For deterministic, compliance-critical operations (financial transactions, regulatory reporting), direct API gives you predictable behavior without agent-driven decision-making. MCP shines when AI agents need to dynamically discover and call PostHog actions at runtime.
What AI frameworks and AI clients does the StackOne PostHog MCP server support?
The StackOne PostHog MCP server supports both. MCP clients (paste-and-go apps): Claude Desktop, Claude Code, Cursor, VS Code, Goose. Agent frameworks (code SDKs you build with): OpenAI Agents SDK, Anthropic, Vercel AI, Google ADK, CrewAI, Pydantic AI, LangChain, LangGraph, Azure AI Foundry.

Put your AI agents to work

All the tools you need to build and scale AI agent integrations, with best-in-class connectivity, execution, and security.