Use endpoints over PostHog MCP

Contents

Open beta

Endpoints is in beta and free to use while it is. Send us feedback in app.

The PostHog MCP server brings endpoints into Claude Code, Cursor, and other AI tools. Because the agent writing the code that calls your endpoint can also create and test that endpoint, you go from "I need this number in my app" to a working request without leaving your editor.

What you can do here

Through MCP tools, your agent can:

  • Create and update endpoints from a SQL or insight query, and list what already exists in the project.
  • Run an endpoint with real variables and read the rows back, to check the response shape before writing client code.
  • Manage versions, listing every saved version with its query snapshot and last execution time.
  • Read execution logs, filtered by level, time range, or text, to work out why a run failed, timed out, or missed cache.
  • Work on materialization, previewing the transform, checking status, and asking PostHog AI for a rewrite when a query isn't eligible.
  • Fetch an endpoint's OpenAPI spec, to generate a typed client.

For example:

GoalAsk your agent
Create an endpointCreate an endpoint called weekly-signups from this SQL query
Test itRun weekly-signups with customer_id set to cust_123 and show me the rows
Debug a failurePull the error logs for weekly-signups from the last hour and tell me what broke
Speed it upweekly-signups can't be materialized – suggest a rewrite that can

Reads need the endpoint:read scope and writes need endpoint:write. Deleting an endpoint is a soft delete, and it cleans up the materialized views behind it.

For the full list of tools and how to scope a session to a subset, see the MCP tools reference.

Set up

Connect the PostHog MCP server to your AI tool, then grant it access to your project. The MCP overview covers install and authentication for each client.

Community questions

Was this page useful?