Skip to main content

Overview

Integrate AgentCat with PostHog for product analytics. Events are sent as capture events via the PostHog /batch API, giving you full visibility into MCP tool usage within your existing PostHog dashboards.

Prerequisites

  1. A PostHog project with an API key (starts with phc_...)
  2. Your PostHog host URL (default: https://us.i.posthog.com)

Configuration

Configuration Fields

Field Mapping

Event Names

AgentCat events are sent as PostHog capture events. Standard MCP event types are mapped to PostHog-friendly names. Any unmapped event types fall back to replacing colons and slashes with underscores.

Distinct ID

PostHog’s distinct_id is set using the following priority:
  1. Identified user ID — if the user was identified via the identify callback
  2. Session ID — falls back to the AgentCat session ID
  3. "anonymous" — if neither is available

Event Properties

Each event includes the following properties:

Person Properties

When a user is identified, PostHog person properties are set via $set:
  • name — the identified user’s name
  • Any additional fields from identifyActorData are merged in

Error Events

When is_error is true, AgentCat sends two events to PostHog:
  1. Regular capture event — the standard event with all properties above
  2. $exception event — a native PostHog exception event with:
This ensures errors appear in PostHog’s native error tracking and can trigger alerts.