mcp_analytics

List MCP sessions for the current project, derived by grouping $mcp_tool_call events by $mcp_session_id. Ordered by newest session start first by default.

get/api/projects/{project_id}/mcp_analytics/sessions/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/mcp_analytics/sessions/
  • Auth: HTTP bearer

Path parameters

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Query parameters

date_fromstring

Start of the window to aggregate sessions over. PostHog date string — relative (e.g. '-7d', '-24h') or an absolute ISO timestamp. Defaults to '-7d'.

date_tostring

End of the window. PostHog date string or absolute ISO timestamp. Defaults to now.

filter_test_accountsboolean

Whether to also apply the project's internal and test user filters (its test_account_filters setting) on top of properties.

has_errorsboolean nullable

Filter by session outcome. true keeps sessions with at least one errored tool call ($mcp_is_error), false keeps sessions with none. Omit to list both.

limitinteger

Maximum number of sessions to return per page. Defaults to 100; values above 500 are rejected.

offsetinteger

Number of sessions to skip before returning results. Combine with limit to page through sessions; the response's has_next flag indicates whether more remain.

order_bystring

Sort column. Allowed: session_id, session_start, session_end, duration_seconds, tool_call_count, mcp_client_name, distinct_id. Prefix with '-' for descending. Defaults to '-session_start' (newest sessions first).

propertiesstring

Property filters that narrow the underlying $mcp_tool_call events, JSON-encoded. A list of event, person, or session property filters, each with key, value, operator, and type. Example: [{"key": "$mcp_tool_name", "value": ["query_run"], "operator": "exact", "type": "event"}]

searchstring

Case-insensitive substring filter matched against session_id, distinct_id, mcp_client_name, and tools_used.

Response

has_nextboolean required

Whether more results exist beyond this page; the client fetches the next page with a larger offset.

Changes

No recorded changes to this operation across all 1 revision of this API.