Announcing Dome Managed Agents.

Try it now

How to set up the PostHog MCP server

Configure PostHog MCP with OAuth or a project-scoped personal API key, and restrict the connection to read-only analytics when appropriate.
Tu Nguyen

PostHog is a product-analytics platform for events, users, feature flags, and session data. Its hosted MCP server supports OAuth and a personal API key created with the MCP Server preset.

This guide prepares PostHog for an MCP client. The PostHog agent template is a separate Dome deployment.

Choose a connection method

Choose OAuth for an interactive connection; it is PostHog's recommended path. Choose a personal API key with the MCP Server preset for a shared, non-interactive connection. Both can be pinned to a project and restricted to read-only MCP tools. See the PostHog MCP FAQ.

OAuth avoids copying a long-lived key and follows the authorizing member's PostHog access.

  1. Add https://mcp.posthog.com/mcp?readonly=true to an OAuth-capable MCP client.
  2. Complete browser sign-in as a dedicated test member and select the intended organization and project.
  3. When the connection will always serve one project, pin it with project_id or x-posthog-project-id.
  4. Query a known test event or insight and verify that another project is unavailable.

Alternative: Personal API key

Use this path for a shared, non-interactive connection.

  • Create a personal API key using PostHog's MCP Server preset; do not use an ingestion key.
  • Send it as Authorization: Bearer <personal API key>.
  • Add readonly=true and pin a project for the same upstream protections used by OAuth.

Verify PostHog MCP

Use this checklist to confirm the MCP server is connected with the intended access.

  • Connect the MCP client using the newly created authorization.
  • Confirm that PostHog MCP tools are discovered.
  • Read one known test resource that the authorized identity is allowed to access.
  • Attempt to read a resource outside the approved PostHog boundary; it should be unavailable or denied.
  • Confirm that no write capability beyond the reviewed setup is available.

Troubleshooting

Do not use a project API key for server-to-server query access; it is intended for event ingestion. If analytics are missing, verify the project ID and regional host before broadening membership.

Next steps

Deploy the PostHog agent template to create a governed agent in Dome that can work with the approved analytics project, with the template's included model, tools, and rules.

More from the blog.

Audit schema v2
Existing detectorPass
New fieldactor_scope
CompatibilityChecked
decision_id dec_42tool_call call_8fbackend_req req_91
MCP setup

Next perspective,straight to your inbox.

Subscribe

Each new perspective and field guide, the week it publishes. Nothing else.

Product updates

Release notes and platform changes live on the updates page.

Every agent you run,under one system of control.