:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(taxonomy): add $mcp_session_id and $mcp_conversation_id (#58613)
Lucas Ricoy8bf1ce63224d
diff --git a/frontend/src/taxonomy/core-filter-definitions-by-group.json b/frontend/src/taxonomy/core-filter-definitions-by-group.jsonindex aaa37e4b656c..b9ee9317f0bf 100644--- a/frontend/src/taxonomy/core-filter-definitions-by-group.json+++ b/frontend/src/taxonomy/core-filter-definitions-by-group.json@@ -1848,7 +1848,7 @@"label": "MCP consumer"},"$mcp_conversation_id": {- "description": "Logical conversation id that stitches multiple tool calls together. Unlike `$session_id` (transport-level, rotates on reconnect or framework boundary), `$mcp_conversation_id` is minted by the SDK on the first call and echoed back by the agent on subsequent calls via a prompt-back text block. Opt-in via `enableConversationId: true` on the SDK's `track()`.",+ "description": "Stable, agent-echoed conversation identifier that stitches multiple tool calls into a single logical session. The MCP server mints a UUID when the agent omits one and prompts the agent to reuse it on subsequent calls; subsequent calls within the same conversation carry the same value. Unlike $mcp_session_id this survives reconnects and process restarts. Only present when the server has `enableConversationId` turned on.","label": "MCP conversation ID"},"$mcp_duration_ms": {@@ -1976,7 +1976,7 @@"label": "MCP server version"},"$mcp_session_id": {- "description": "Stable MCP-layer session ID supplied by the transport (e.g. the MCP `extra.sessionId` handle or framework session). Distinct from PostHog's `$session_id`, which is a posthog-js / SDK construct \u2014 `$mcp_session_id` is the MCP-layer handle, `$session_id` is the analytics-layer one.",+ "description": "Transport-level session handle the MCP SDK observed for this request (e.g. MCP `extra.sessionId` or a framework session cookie). Rotates per process restart, reconnect, or framework boundary \u2014 use $mcp_conversation_id when you need a stable identifier across reconnects.","label": "MCP session ID"},"$mcp_source": {@@ -5757,7 +5757,7 @@"label": "MCP consumer"},"$mcp_conversation_id": {- "description": "Logical conversation id that stitches multiple tool calls together. Unlike `$session_id` (transport-level, rotates on reconnect or framework boundary), `$mcp_conversation_id` is minted by the SDK on the first call and echoed back by the agent on subsequent calls via a prompt-back text block. Opt-in via `enableConversationId: true` on the SDK's `track()`.",+ "description": "Stable, agent-echoed conversation identifier that stitches multiple tool calls into a single logical session. The MCP server mints a UUID when the agent omits one and prompts the agent to reuse it on subsequent calls; subsequent calls within the same conversation carry the same value. Unlike $mcp_session_id this survives reconnects and process restarts. Only present when the server has `enableConversationId` turned on.","label": "MCP conversation ID"},"$mcp_duration_ms": {@@ -5885,7 +5885,7 @@"label": "MCP server version"},"$mcp_session_id": {- "description": "Stable MCP-layer session ID supplied by the transport (e.g. the MCP `extra.sessionId` handle or framework session). Distinct from PostHog's `$session_id`, which is a posthog-js / SDK construct \u2014 `$mcp_session_id` is the MCP-layer handle, `$session_id` is the analytics-layer one.",+ "description": "Transport-level session handle the MCP SDK observed for this request (e.g. MCP `extra.sessionId` or a framework session cookie). Rotates per process restart, reconnect, or framework boundary \u2014 use $mcp_conversation_id when you need a stable identifier across reconnects.","label": "MCP session ID"},"$mcp_source": {diff --git a/posthog/taxonomy/taxonomy.py b/posthog/taxonomy/taxonomy.pyindex e52edd102ba0..fcffe0fc111c 100644--- a/posthog/taxonomy/taxonomy.py+++ b/posthog/taxonomy/taxonomy.py@@ -2597,11 +2597,11 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {},"$mcp_session_id": {"label": "MCP session ID",- "description": "Stable MCP-layer session ID supplied by the transport (e.g. the MCP `extra.sessionId` handle or framework session). Distinct from PostHog's `$session_id`, which is a posthog-js / SDK construct — `$mcp_session_id` is the MCP-layer handle, `$session_id` is the analytics-layer one.",+ "description": "Transport-level session handle the MCP SDK observed for this request (e.g. MCP `extra.sessionId` or a framework session cookie). Rotates per process restart, reconnect, or framework boundary — use $mcp_conversation_id when you need a stable identifier across reconnects.",},"$mcp_conversation_id": {"label": "MCP conversation ID",- "description": "Logical conversation id that stitches multiple tool calls together. Unlike `$session_id` (transport-level, rotates on reconnect or framework boundary), `$mcp_conversation_id` is minted by the SDK on the first call and echoed back by the agent on subsequent calls via a prompt-back text block. Opt-in via `enableConversationId: true` on the SDK's `track()`.",+ "description": "Stable, agent-echoed conversation identifier that stitches multiple tool calls into a single logical session. The MCP server mints a UUID when the agent omits one and prompts the agent to reuse it on subsequent calls; subsequent calls within the same conversation carry the same value. Unlike $mcp_session_id this survives reconnects and process restarts. Only present when the server has `enableConversationId` turned on.",},# PostHog-specific MCP properties added by the PostHog MCP server on top of the SDK's core# set. They identify which deployment, transport, and consumer produced the event. The