Mcp

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
POST

Retrieve mcp analytics sessions activity

Aggregate counters, top tools, agent clients, and the most recent tool calls for the last 30 days, computed in one request. Powers the dashboard's activity view; always computed fresh so polling callers watch data arrive.

Required API key scopes

mcp_analytics:read

Response


Example request

GET /api/projects/:project_id/mcp_analytics/sessions/activity_overview
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_analytics/sessions/activity_overview/

Example response

Status 200
RESPONSE
{
"stats": {
"total_calls": 0,
"distinct_tools": 0,
"distinct_sessions": 0,
"distinct_clients": 0,
"calls_with_intent": 0,
"error_calls": 0,
"missing_capability_reports": 0
},
"top_tools": [
{
"tool": "string",
"calls": 0,
"errors": 0
}
],
"clients": [
{
"client": "string",
"calls": 0
}
],
"recent_calls": [
{
"timestamp": "2019-08-24T14:15:22Z",
"tool": "string",
"intent": "string",
"is_error": true,
"error_message": "string",
"duration_ms": 0,
"client_name": "string"
}
]
}

Create mcp analytics sessions intent

Generate (or return the cached) LLM digest of what agents are trying to do with this MCP server, derived from the most recent recorded $mcp_intents across all sessions. Content-addressed cache: only regenerates when new intents arrive. Powers the dashboard's low-volume activity stage.

Required API key scopes

mcp_analytics:write

Response


Example request

POST /api/projects/:project_id/mcp_analytics/sessions/intent_digest
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/mcp_analytics/sessions/intent_digest/

Example response

Status 200
RESPONSE
{
"digest": "string",
"intent_count": 0
}
Status 503 Intent digest generation is unavailable (LLM not configured).

Community questions