Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

Pi

MCP server by PostHog Verified · npm:@posthog

Connects the pi coding agent to the PostHog MCP server and sends pi's LLM calls and tool runs to PostHog LLM Analytics. Built for developers who use pi and PostHog.

  • Score 80
  • 8 stars
  • 751 a week
  • MIT
  • Updated

Install Pi

Built from the published package, never by AI.

claude mcp add pi -- npx -y @posthog/pi

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install Pi in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the pi block.

About

@posthog/pi is an extension package for the pi coding agent. It has two parts. The MCP bridge connects pi to the PostHog MCP server at https://mcp.posthog.com/mcp and registers PostHog MCP tools inside pi, so they can be called like other pi tools. The LLM analytics part captures generations, tool executions, and traces as $ai_* events in PostHog.

Setup needs a PostHog personal API key for the MCP bridge and a project API key for tracing. Either part can be turned off with environment variables. Tool access can be narrowed by feature or by an exact tool allowlist, and large MCP responses can be saved to a temp file to keep them out of context. It is aimed at developers who use pi and PostHog.

Written from the project's README and checked against it.

Tools it gives your assistant

  • execute-sqlExample tool name given in the source for the POSTHOG_MCP_TOOLS allowlist.
  • dashboard-getExample tool name given in the source for the POSTHOG_MCP_TOOLS allowlist.
  • feature-flag-get-allExample tool name given in the source for the POSTHOG_MCP_TOOLS allowlist.
  • /posthog-mcp-statusShows the MCP connection and config status.
  • /posthog-mcp-reloadReconnects to PostHog MCP and refreshes the MCP tools.
  • $ai_generationCaptures each LLM call with model, tokens, latency, cost, and stop reason.
  • $ai_spanCaptures each tool execution with its name, latency, input, and output.
  • $ai_traceCaptures a completed agent run, one per user prompt.

What you need

  • PostHog personal API key for the MCP bridge
  • PostHog project API key for LLM analytics tracing
  • pi coding agent

Try asking

  • Use PostHog MCP to run a SQL query on my events
  • Show me the status of the PostHog MCP connection
  • List all my PostHog feature flags and their state

Good to know

  • Tracing sends LLM input and output to PostHog unless POSTHOG_PRIVACY_MODE is true.
  • Tracing requires a project API key set separately from the MCP key.
  • Only the tools allowed by POSTHOG_MCP_FEATURES or POSTHOG_MCP_TOOLS are exposed when those filters are set.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to Pi

All alternatives →
World Monitor koala73
98

World Monitor is a real-time global intelligence dashboard covering conflict, markets, energy, trade, shipping and cyber. Its MCP server gives AI assistants access to that data, and it is aimed at analysts, agents and scripts.

ACA Remote 91k
Power BI Authoring MCP Server (Local) microsoft
95

Lets AI agents create and change Power BI semantic models through a local MCP server. Built for developers who want natural language modeling in Power BI Desktop, Fabric workspaces and PBIP files.

AAA Local 9.7k/wk
Seal Open Data ariacom
95

Seal Open Data serves French public datasets from data.gouv.fr to AI assistants. It covers topics such as territories, companies, housing and population. It is aimed at users who want to query French open data from clients like Claude.

AAA Remote 1.7k
OpenMetadataopen-metadata
94

OpenMetadata MCP server lets MCP-compatible assistants search metadata, inspect lineage, and manage data quality tests. It is for data teams and AI agents that need governed context about enterprise data.

AAA Remote 16k
Flint Chart MCP microsoft
94

Compiles, validates and renders semantic chart specs for AI assistants through the Model Context Protocol. It is for agents that need reliable, good-looking and interactive charts across several chart libraries.

AAA Local 4.6k
PostHog PostHog
94

Query PostHog analytics, manage feature flags and experiments, and investigate errors from your AI assistant. It suits product teams and developers who already use PostHog for analytics, replays, and error tracking.

AFA Remote 41k

Compare with World Monitor, Power BI Authoring MCP Server (Local) or Seal Open Data

Pi: common questions

How do I turn off the PostHog MCP bridge?

Set POSTHOG_MCP_ENABLED to false. The source says this disables the MCP bridge.

What does the LLM analytics part capture?

It captures $ai_generation events for each LLM call, $ai_span events for each tool execution, and $ai_trace events when an agent run completes. Content fields are redacted when privacy mode is on.

How is the distinct_id chosen for events?

If POSTHOG_DISTINCT_ID is set, it is used. Otherwise the extension tries to discover the identity from the personal API key, and falls back to a session ID starting with pi:.

How do I install Pi?

In Claude Code run claude mcp add pi -- npx -y @posthog/pi. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is Pi the official server?

Pi is published by npm:@posthog from its verified domain in the official MCP Registry.

Is Pi free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is Pi safe to use?

It scores 80 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to Pi?

Similar MCP servers: World Monitor, Power BI Authoring MCP Server (Local), Seal Open Data, OpenMetadata.

Does Pi work with ChatGPT?

Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.

Add to stack

Loading.