: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
chore(mcp): make $mcp_tool_call the sole canonical event, mark legacy taxonomy (#67541)
Lucas Fariaf5b8f231322c
diff --git a/frontend/src/taxonomy/core-filter-definitions-by-group.json b/frontend/src/taxonomy/core-filter-definitions-by-group.jsonindex 18f9901247e7..dcb246721b07 100644--- a/frontend/src/taxonomy/core-filter-definitions-by-group.json+++ b/frontend/src/taxonomy/core-filter-definitions-by-group.json@@ -4042,8 +4042,9 @@"label": "MCP feedback submitted"},"mcp init": {- "description": "MCP initialization event emitted by the mcpcat library. Fires for all traffic today (alongside mcp_initialize where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability; until then, filter on this event if you need coverage across all clients, or on mcp_initialize if you only want the @posthog/mcp-enabled slice.",- "label": "MCP init"+ "description": "LEGACY \u2014 do not use. MCP initialization event from the retired mcpcat library. Superseded by `$mcp_initialize`. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": true,+ "label": "MCP init (legacy)"},"mcp organization switched": {"description": "Fires when a user switches the active organization in their MCP session.",@@ -4054,60 +4055,74 @@"label": "MCP project switched"},"mcp tool call": {- "description": "Tool-call event emitted by the mcpcat library. Fires for all traffic today (alongside mcp_tool_call where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability.",- "label": "MCP tool call (mcpcat)"+ "description": "LEGACY \u2014 do not use. Tool-call event from the external mcpcat integration (still trickling in until that integration is switched off). Superseded by `$mcp_tool_call`, which covers all traffic from 2026-06-16 on. Query this only for older historical data.",+ "ignored_in_assistant": true,+ "label": "MCP tool call \u2014 mcpcat (legacy)"},"mcp tool response": {- "description": "Tool-response event emitted by the mcpcat library. Tool responses are also carried inline on mcp_tool_call (under $mcp_response) for @posthog/mcp-enabled traffic. Will be retired once @posthog/mcp reaches general availability.",- "label": "MCP tool response (mcpcat)"+ "description": "LEGACY \u2014 do not use. Tool-response event from the external mcpcat integration (still trickling in until that integration is switched off). Responses now ride inline on `$mcp_tool_call` (under `$mcp_response`). Query this only for older historical data.",+ "ignored_in_assistant": true,+ "label": "MCP tool response \u2014 mcpcat (legacy)"},"mcp_custom": {- "description": "A custom MCP analytics event emitted by a server through the SDK's custom-event API. Properties depend on what the caller passed.",- "label": "MCP custom event"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_custom`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP custom event (legacy)"},"mcp_initialize": {- "description": "Fires when an MCP client completes the handshake with the server. Carries the client and server name/version so you can break down usage by client.",- "label": "MCP initialize"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_initialize`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP initialize (legacy)"},"mcp_mcpcat:identify": {- "description": "Identify event emitted by the mcpcat library. Fires for all traffic today (alongside posthog_identify where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability.",- "label": "MCP identify (mcpcat)"+ "description": "LEGACY \u2014 do not use. Identify event from the retired mcpcat library. Superseded by the canonical `$identify` emitted by @posthog/mcp. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": true,+ "label": "MCP identify \u2014 mcpcat (legacy)"},"mcp_posthog:identify": {- "description": "Identify event emitted by PostHog's in-tree MCP analytics path. Fires for all traffic today (alongside posthog_identify where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability.",- "label": "MCP identify (in-tree)"+ "description": "LEGACY \u2014 do not use. Identify event from PostHog's retired in-tree MCP analytics path. Superseded by the canonical `$identify` emitted by @posthog/mcp. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": true,+ "label": "MCP identify \u2014 in-tree (legacy)"},"mcp_prompt_get": {- "description": "Fires when an MCP prompt is fetched by a client. Includes the prompt name.",- "label": "MCP prompt fetched"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_prompt_get`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP prompt fetched (legacy)"},"mcp_prompts_list": {- "description": "Fires when an MCP client requests the list of available prompts.",- "label": "MCP prompts listed"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_prompts_list`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP prompts listed (legacy)"},"mcp_resource_read": {- "description": "Fires when an MCP resource is fetched by a client. Includes the resource name.",- "label": "MCP resource read"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_resource_read`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP resource read (legacy)"},"mcp_resources_list": {- "description": "Fires when an MCP client requests the list of available resources.",- "label": "MCP resources listed"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_resources_list`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP resources listed (legacy)"},"mcp_tool_call": {- "description": "Fires every time an MCP server tool is invoked. Includes the tool name, wall-clock duration, error state, and (when the client supplied a context argument) the agent's stated intent.",- "label": "MCP tool call"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_tool_call`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical tool calls before that date.",+ "ignored_in_assistant": true,+ "label": "MCP tool call (legacy)"},"mcp_tool_called": {- "description": "Tool-call event emitted by PostHog's in-tree MCP analytics path. Fires for all traffic today (alongside mcp_tool_call where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability; until then, filter on this event if you need coverage across all clients, or on mcp_tool_call if you only want the @posthog/mcp-enabled slice.",- "label": "MCP tool called (in-tree)"+ "description": "LEGACY \u2014 do not use. Tool-call event from PostHog's retired in-tree MCP analytics path. Superseded by `$mcp_tool_call`. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": true,+ "label": "MCP tool called \u2014 in-tree (legacy)"},"mcp_tools_list": {- "description": "Fires when an MCP client requests the list of available tools. Useful for measuring discovery \u2014 i.e. whether new clients are finding the server.",- "label": "MCP tools listed"+ "description": "LEGACY \u2014 do not use. Superseded by `$mcp_tools_list`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP tools listed (legacy)"},"posthog_identify": {- "description": "Fires when an MCP session becomes associated with an identified user, or when the identity changes for an existing session. Used to attribute subsequent events to a real user instead of an anonymous session.",- "label": "MCP identify"+ "description": "LEGACY \u2014 do not use. Superseded by the canonical `$identify` emitted by @posthog/mcp, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": true,+ "label": "MCP identify (legacy)"}},"groups": {diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambrindex c65814075e9c..fd5132ddbcda 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambr@@ -4,7 +4,7 @@SELECT events.event AS event,count() AS countFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', '$snapshot']))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))GROUP BY events.eventORDER BY count DESC, events.event ASCLIMIT 501diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambrindex 777030fdad33..8f0eb8b08e1d 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambr@@ -4,7 +4,7 @@SELECT events.event AS event,count() AS countFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', '$snapshot']))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))GROUP BY events.eventORDER BY count DESC, events.event ASCLIMIT 501diff --git a/posthog/taxonomy/taxonomy.py b/posthog/taxonomy/taxonomy.pyindex 267d17678fe8..fc487cda6f57 100644--- a/posthog/taxonomy/taxonomy.py+++ b/posthog/taxonomy/taxonomy.py@@ -292,10 +292,8 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {"label": "Deep link opened","description": "When a user opens the mobile app via a deep link.",},- # Canonical events emitted by the @posthog/mcp analytics SDK. PostHog-owned events are- # always `$`-prefixed, so these `$mcp_*` names are the final, going-forward names. They- # fire alongside the legacy non-`$` names just below (which the server dual-emits during- # the cutover so existing dashboards keep working) — those legacy names are being retired.+ # Canonical @posthog/mcp SDK events, and the only MCP events to build on. They cover all+ # traffic since 2026-06-16; the legacy non-`$` names below are frozen (older history only)."$mcp_tool_call": {"label": "MCP tool call","description": "Fires every time an MCP server tool is invoked via @posthog/mcp. Includes the tool name, wall-clock duration, error state, and (when the client supplied a context argument) the agent's stated intent. Canonical replacement for the legacy `mcp_tool_call`.",@@ -332,75 +330,86 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {"label": "MCP missing capability","description": "Fires when an agent reports functionality it couldn't find via the `get_more_tools` virtual tool (when `reportMissing` is enabled). Carries the agent's reasoning in `$mcp_intent` — a capability gap, not a tool invocation.",},- # Legacy in-tree @posthog/mcp event names (non-`$`-prefixed). These were emitted by the- # MCP server's hand-rolled analytics path before it moved onto the SDK. The server now- # dual-emits them alongside the canonical `$mcp_*` names above so existing insights keep- # working through the cutover; they will be removed once those insights are migrated.+ # LEGACY MCP event names (non-`$`) — DO NOT USE. Dual-emitted through the cutover, now+ # stopped; query only for pre-2026-06-16 history. `ignored_in_assistant` hides them from+ # the AI assistant so it doesn't steer people onto them."mcp_tool_call": {- "label": "MCP tool call",- "description": "Fires every time an MCP server tool is invoked. Includes the tool name, wall-clock duration, error state, and (when the client supplied a context argument) the agent's stated intent.",+ "label": "MCP tool call (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_tool_call`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical tool calls before that date.",+ "ignored_in_assistant": True,},"mcp_tools_list": {- "label": "MCP tools listed",- "description": "Fires when an MCP client requests the list of available tools. Useful for measuring discovery — i.e. whether new clients are finding the server.",+ "label": "MCP tools listed (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_tools_list`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,},"mcp_initialize": {- "label": "MCP initialize",- "description": "Fires when an MCP client completes the handshake with the server. Carries the client and server name/version so you can break down usage by client.",+ "label": "MCP initialize (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_initialize`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,},"mcp_resources_list": {- "label": "MCP resources listed",- "description": "Fires when an MCP client requests the list of available resources.",+ "label": "MCP resources listed (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_resources_list`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,},"mcp_resource_read": {- "label": "MCP resource read",- "description": "Fires when an MCP resource is fetched by a client. Includes the resource name.",+ "label": "MCP resource read (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_resource_read`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,},"mcp_prompts_list": {- "label": "MCP prompts listed",- "description": "Fires when an MCP client requests the list of available prompts.",+ "label": "MCP prompts listed (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_prompts_list`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,},"mcp_prompt_get": {- "label": "MCP prompt fetched",- "description": "Fires when an MCP prompt is fetched by a client. Includes the prompt name.",+ "label": "MCP prompt fetched (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_prompt_get`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,},"mcp_custom": {- "label": "MCP custom event",- "description": "A custom MCP analytics event emitted by a server through the SDK's custom-event API. Properties depend on what the caller passed.",+ "label": "MCP custom event (legacy)",+ "description": "LEGACY — do not use. Superseded by `$mcp_custom`, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,},"posthog_identify": {- "label": "MCP identify",- "description": "Fires when an MCP session becomes associated with an identified user, or when the identity changes for an existing session. Used to attribute subsequent events to a real user instead of an anonymous session.",- },- # Older MCP events. Today these are the only events that fire for traffic where @posthog/mcp- # isn't enabled yet, and they fire alongside the @posthog/mcp events for traffic where it is.- # Not deprecated today — @posthog/mcp is still in internal testing — but slated for removal- # once @posthog/mcp reaches general availability. They come from two sources:- # - the mcpcat library PostHog used before @posthog/mcp existed- # - PostHog's in-tree trackEvent path inside the MCP server+ "label": "MCP identify (legacy)",+ "description": "LEGACY — do not use. Superseded by the canonical `$identify` emitted by @posthog/mcp, which covers all MCP traffic from 2026-06-16 on. Query this only for historical data before that date.",+ "ignored_in_assistant": True,+ },+ # Oldest MCP events — LEGACY, DO NOT USE. Predate the `$mcp_*` SDK. The in-tree names have+ # stopped; the mcpcat `mcp tool call` / `mcp tool response` still trickle in from the+ # external mcpcat integration until it is switched off. Query only for pre-2026-06-16 history."mcp init": {- "label": "MCP init",- "description": "MCP initialization event emitted by the mcpcat library. Fires for all traffic today (alongside mcp_initialize where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability; until then, filter on this event if you need coverage across all clients, or on mcp_initialize if you only want the @posthog/mcp-enabled slice.",+ "label": "MCP init (legacy)",+ "description": "LEGACY — do not use. MCP initialization event from the retired mcpcat library. Superseded by `$mcp_initialize`. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": True,},"mcp_mcpcat:identify": {- "label": "MCP identify (mcpcat)",- "description": "Identify event emitted by the mcpcat library. Fires for all traffic today (alongside posthog_identify where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability.",+ "label": "MCP identify — mcpcat (legacy)",+ "description": "LEGACY — do not use. Identify event from the retired mcpcat library. Superseded by the canonical `$identify` emitted by @posthog/mcp. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": True,},"mcp_posthog:identify": {- "label": "MCP identify (in-tree)",- "description": "Identify event emitted by PostHog's in-tree MCP analytics path. Fires for all traffic today (alongside posthog_identify where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability.",+ "label": "MCP identify — in-tree (legacy)",+ "description": "LEGACY — do not use. Identify event from PostHog's retired in-tree MCP analytics path. Superseded by the canonical `$identify` emitted by @posthog/mcp. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": True,},"mcp_tool_called": {- "label": "MCP tool called (in-tree)",- "description": "Tool-call event emitted by PostHog's in-tree MCP analytics path. Fires for all traffic today (alongside mcp_tool_call where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability; until then, filter on this event if you need coverage across all clients, or on mcp_tool_call if you only want the @posthog/mcp-enabled slice.",+ "label": "MCP tool called — in-tree (legacy)",+ "description": "LEGACY — do not use. Tool-call event from PostHog's retired in-tree MCP analytics path. Superseded by `$mcp_tool_call`. Query this only for historical data before 2026-06-16.",+ "ignored_in_assistant": True,},"mcp tool call": {- "label": "MCP tool call (mcpcat)",- "description": "Tool-call event emitted by the mcpcat library. Fires for all traffic today (alongside mcp_tool_call where @posthog/mcp is enabled). Will be retired once @posthog/mcp reaches general availability.",+ "label": "MCP tool call — mcpcat (legacy)",+ "description": "LEGACY — do not use. Tool-call event from the external mcpcat integration (still trickling in until that integration is switched off). Superseded by `$mcp_tool_call`, which covers all traffic from 2026-06-16 on. Query this only for older historical data.",+ "ignored_in_assistant": True,},"mcp tool response": {- "label": "MCP tool response (mcpcat)",- "description": "Tool-response event emitted by the mcpcat library. Tool responses are also carried inline on mcp_tool_call (under $mcp_response) for @posthog/mcp-enabled traffic. Will be retired once @posthog/mcp reaches general availability.",+ "label": "MCP tool response — mcpcat (legacy)",+ "description": "LEGACY — do not use. Tool-response event from the external mcpcat integration (still trickling in until that integration is switched off). Responses now ride inline on `$mcp_tool_call` (under `$mcp_response`). Query this only for older historical data.",+ "ignored_in_assistant": True,},"mcp project switched": {"label": "MCP project switched",diff --git a/products/mcp_analytics/backend/constants.py b/products/mcp_analytics/backend/constants.pyindex 9074ce83e382..d381db068750 100644--- a/products/mcp_analytics/backend/constants.py+++ b/products/mcp_analytics/backend/constants.py@@ -1,5 +1,3 @@-# The @posthog/mcp SDK and PostHog's own MCP server both emit this canonical,-# $-prefixed event. PostHog's server additionally dual-emits a legacy `mcp_tool_call`-# alias for older dashboards; reading both names would double-count its calls, so we-# key on the canonical name only.+# Key on this canonical event only — also matching the legacy `mcp_tool_call` alias+# (frozen, pre-2026-06-16 history) would double-count every call.MCP_TOOL_CALL_EVENT = "$mcp_tool_call"diff --git a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.tsindex 04dfa15d873c..5535a62e8b5f 100644--- a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts+++ b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts@@ -28,8 +28,7 @@ const DEFAULT_DATE_FILTER: DateFilter = { dateFrom: '-7d', dateTo: null }// the time buckets, so the query only needs the doubled date range. `__BUCKET__`// is replaced with a dateTrunc at the active interval at call time.//-// Queries key on the canonical, $-prefixed event — PostHog's MCP server dual-emits a-// legacy `mcp_tool_call` alias, so matching both names would double-count it.+// Key on the canonical event only — also matching the legacy `mcp_tool_call` alias would double-count.const KPI_QUERY = `SELECT__BUCKET__ AS bucket,diff --git a/products/product_analytics/frontend/insights/trends/shared/humanizeSeriesLabel.ts b/products/product_analytics/frontend/insights/trends/shared/humanizeSeriesLabel.tsindex 82e1ff8d454a..2f20c9aa891b 100644--- a/products/product_analytics/frontend/insights/trends/shared/humanizeSeriesLabel.ts+++ b/products/product_analytics/frontend/insights/trends/shared/humanizeSeriesLabel.ts@@ -59,23 +59,23 @@ const POSTHOG_EVENT_DISPLAY_NAMES: Record<string, string> = {'Application updated': 'Application updated','Deep link opened': 'Deep link opened','mcp feedback submitted': 'MCP feedback submitted',- 'mcp init': 'MCP init',+ 'mcp init': 'MCP init (legacy)','mcp organization switched': 'MCP organization switched','mcp project switched': 'MCP project switched',- 'mcp tool call': 'MCP tool call (mcpcat)',- 'mcp tool response': 'MCP tool response (mcpcat)',- mcp_custom: 'MCP custom event',- mcp_initialize: 'MCP initialize',- 'mcp_mcpcat:identify': 'MCP identify (mcpcat)',- 'mcp_posthog:identify': 'MCP identify (in-tree)',- mcp_prompt_get: 'MCP prompt fetched',- mcp_prompts_list: 'MCP prompts listed',- mcp_resource_read: 'MCP resource read',- mcp_resources_list: 'MCP resources listed',- mcp_tool_call: 'MCP tool call',- mcp_tool_called: 'MCP tool called (in-tree)',- mcp_tools_list: 'MCP tools listed',- posthog_identify: 'MCP identify',+ 'mcp tool call': 'MCP tool call — mcpcat (legacy)',+ 'mcp tool response': 'MCP tool response — mcpcat (legacy)',+ mcp_custom: 'MCP custom event (legacy)',+ mcp_initialize: 'MCP initialize (legacy)',+ 'mcp_mcpcat:identify': 'MCP identify — mcpcat (legacy)',+ 'mcp_posthog:identify': 'MCP identify — in-tree (legacy)',+ mcp_prompt_get: 'MCP prompt fetched (legacy)',+ mcp_prompts_list: 'MCP prompts listed (legacy)',+ mcp_resource_read: 'MCP resource read (legacy)',+ mcp_resources_list: 'MCP resources listed (legacy)',+ mcp_tool_call: 'MCP tool call (legacy)',+ mcp_tool_called: 'MCP tool called — in-tree (legacy)',+ mcp_tools_list: 'MCP tools listed (legacy)',+ posthog_identify: 'MCP identify (legacy)',}/** Returns the human-friendly display name for a series label.diff --git a/services/mcp/ARCHITECTURE.md b/services/mcp/ARCHITECTURE.mdindex d3a521148550..250854f015cc 100644--- a/services/mcp/ARCHITECTURE.md+++ b/services/mcp/ARCHITECTURE.md@@ -83,7 +83,9 @@ There are three independent layers that emit signals about each MCP request:#### `$mcp_tool_call` event paths-Three distinct code paths emit the tool-call event (canonical `$mcp_tool_call`, with a legacy unprefixed `mcp_tool_call` alias still dual-emitted during the cutover — see the transition shim in `hono/analytics.ts`); which one fires depends on the server mode and on the `mcp-posthog-analytics-sdk` feature flag:+The canonical event is `$mcp_tool_call`.+The legacy unprefixed `mcp_tool_call` alias is no longer emitted — the transition shim that dual-emitted it through the cutover has been removed (only pre-2026-06-16 history remains under that name).+The path that fires depends on the server mode and on the `mcp-posthog-analytics-sdk` feature flag:- **`hono/analytics.ts`** — homegrown PostHog capture. Used by the exec-mode wrapper to emit events for inner tool calls. Properties use the bare form: `mcp_session_id`, `mcp_conversation_id`, `mcp_client_name`, etc.- **`lib/mcpcat.ts`** — legacy MCPcat SDK path. Same bare property names.diff --git a/services/mcp/src/cli/index.ts b/services/mcp/src/cli/index.tsindex 3a8d1ca2b6cc..3b289deb31d1 100644--- a/services/mcp/src/cli/index.ts+++ b/services/mcp/src/cli/index.ts@@ -101,8 +101,6 @@ async function buildExec(config: CliConfig = resolveCliConfig()): Promise<BuiltE...(properties.error_message ? { error_message: properties.error_message } : {}),}void context.trackEvent(AnalyticsEvent.MCP_TOOL_CALL, toolCallProperties)- // Legacy shim: remove with the hono shim once insights migrate off `mcp_tool_call`.- void context.trackEvent(AnalyticsEvent.MCP_TOOL_CALL_LEGACY, toolCallProperties)},[],{ requireDestructiveConfirmation: true }diff --git a/services/mcp/src/hono/analytics.ts b/services/mcp/src/hono/analytics.tsindex 969354c9fcf4..e99f3f230c04 100644--- a/services/mcp/src/hono/analytics.ts+++ b/services/mcp/src/hono/analytics.ts@@ -83,27 +83,6 @@ export async function trackInitEvent(state: ResolvedState): Promise<void> {via_sse_redirect: !!requestContext.viaSseRedirect,},})-- // TRANSITION SHIM — DELETE once the MCP insights + taxonomy are migrated to- // the `$mcp_*` event names. `$mcp_initialize` (above) is the canonical event- // going forward, but the existing dashboards/insights still key on the legacy- // `mcp_initialize`, so we dual-emit it through the cutover to keep them working.- getPostHogClient().capture({- distinctId: state.distinctId,- event: 'mcp_initialize',- ...(Object.keys(groups).length > 0 ? { groups } : {}),- properties: {- ...properties,- $mcp_duration_ms: initDurationMs ?? 0,- $mcp_is_error: false,- tool_count: state.allTools.length,- has_organization_id: !!requestContext.organizationId,- has_project_id: !!requestContext.projectId,- read_only: !!requestContext.readOnly,- via_sse_redirect: !!requestContext.viaSseRedirect,- ...(sessionUuid ? { $session_id: sessionUuid } : {}),- },- })} catch {// never break the request for analytics}@@ -131,22 +110,16 @@ export async function trackToolCall(const { properties, groups } = buildBaseProperties(state, analyticsContext)- // `$mcp_tool_category` is the dashboard's grouping dimension (e.g. "Logs",- // "Tracing"). The contract is: the producer stamps the category onto every- // tool-call event; the MCP analytics dashboard reads it back verbatim and- // never maps tool names to categories itself. PostHog's server derives it- // from its own catalog here; external servers using the SDK declare it per- // tool. Omitted when unknown (e.g. the `exec` wrapper) so the dashboard- // buckets those as "Uncategorized".+ // The producer stamps the tool's category so the dashboard groups by it verbatim+ // (it never maps tool→category itself). Omitted when unknown (e.g. the `exec`+ // wrapper), which the dashboard buckets as "Uncategorized".const toolCategory = getToolCategory(toolName)// Emits `$mcp_tool_call` (+ `$mcp_is_error`). The SDK maps `toolName` →// `$mcp_tool_name`, `durationMs` → `$mcp_duration_ms`, `isError` →// `$mcp_is_error`, `intent` → `$mcp_intent`, and `sessionId` →// `$session_id`. `$exception` fan-out is disabled on the client, so an- // errored call stays a single event. The intent pipeline reads- // `$mcp_intent` off this canonical event, so it only needs to land here- // (not on the legacy dual-emit below).+ // errored call stays a single event.getPostHogClient().captureToolCall({toolName,durationMs,@@ -163,26 +136,6 @@ export async function trackToolCall(...extraProperties,},})-- // TRANSITION SHIM — DELETE once the MCP insights + taxonomy are migrated to- // the `$mcp_*` event names. `$mcp_tool_call` (above) is the canonical event- // going forward, but the existing dashboards/insights still key on the legacy- // `mcp_tool_call`, so we dual-emit it through the cutover to keep them working.- getPostHogClient().capture({- distinctId: state.distinctId,- event: 'mcp_tool_call',- ...(Object.keys(groups).length > 0 ? { groups } : {}),- properties: {- ...properties,- $mcp_tool_name: toolName,- $mcp_duration_ms: durationMs,- $mcp_is_error: isError,- tool_name: toolName,- ...(toolCategory ? { $mcp_tool_category: toolCategory } : {}),- ...(sessionUuid ? { $session_id: sessionUuid } : {}),- ...extraProperties,- },- })} catch {// never break the request for analytics}@@ -196,9 +149,8 @@ export async function trackToolsList(toolNames: string[], state: ResolvedState):const { properties, groups } = buildBaseProperties(state, analyticsContext)- // Emits `$mcp_tools_list`. The SDK maps `toolNames` → `$mcp_listed_tool_names`,- // which powers "advertised but never called" analysis. No legacy dual-emit:- // `mcp_tools_list` has had no consumers since the cutover.+ // The SDK maps `toolNames` → `$mcp_listed_tool_names`, which powers+ // "advertised but never called" analysis.getPostHogClient().captureToolsList({toolNames,distinctId: state.distinctId,diff --git a/services/mcp/src/lib/posthog/analytics.ts b/services/mcp/src/lib/posthog/analytics.tsindex ee315a8e4e2b..4d8afbe97b76 100644--- a/services/mcp/src/lib/posthog/analytics.ts+++ b/services/mcp/src/lib/posthog/analytics.ts@@ -1,9 +1,7 @@export enum AnalyticsEvent {- MCP_INIT = 'mcp init',MCP_PROJECT_SWITCHED = 'mcp project switched',MCP_ORGANIZATION_SWITCHED = 'mcp organization switched',MCP_TOOL_CALL = '$mcp_tool_call',- MCP_TOOL_CALL_LEGACY = 'mcp_tool_call', // dual-emitted during the migration to `$mcp_tool_call`MCP_FEEDBACK_SUBMITTED = 'mcp feedback submitted',}diff --git a/services/mcp/tests/hono/analytics.test.ts b/services/mcp/tests/hono/analytics.test.tsindex 4b955c59c2c0..c6cdbad017e8 100644--- a/services/mcp/tests/hono/analytics.test.ts+++ b/services/mcp/tests/hono/analytics.test.ts@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'const { mockCaptureToolCall, mockCaptureInitialize, mockCapture } = vi.hoisted(() => ({mockCaptureToolCall: vi.fn(),mockCaptureInitialize: vi.fn(),- // `capture` backs the temporary dual-emit of the legacy `mcp_*` event names.+ // Raw `capture`; must never be used for the retired legacy `mcp_*` event names.mockCapture: vi.fn(),}))@@ -73,15 +73,12 @@ describe('Hono MCP analytics contexts', () => {mockCapture.mockClear()})- it('dual-emits the legacy mcp_tool_call / mcp_initialize names during the cutover', async () => {- // TRANSITION SHIM coverage — delete alongside the dual-emit once insights- // are migrated to the `$mcp_*` names.+ it('does not dual-emit the retired legacy mcp_tool_call / mcp_initialize names', async () => {+ // Guards against reintroducing the legacy dual-emit, which double-counted every call.await trackInitEvent(makeState())await trackToolCall('user-get', 12, false, makeState())- const legacyEvents = mockCapture.mock.calls.map((c) => c[0].event)- expect(legacyEvents).toContain('mcp_initialize')- expect(legacyEvents).toContain('mcp_tool_call')+ expect(mockCapture).not.toHaveBeenCalled()})it('emits request properties on $mcp fields and session properties on mcp_session fields', async () => {diff --git a/services/mcp/tests/unit/permission-errors.test.ts b/services/mcp/tests/unit/permission-errors.test.tsindex df3171b1b6cf..0d3189e30973 100644--- a/services/mcp/tests/unit/permission-errors.test.ts+++ b/services/mcp/tests/unit/permission-errors.test.ts@@ -17,7 +17,7 @@ vi.mock('@/lib/posthog', () => ({getPostHogClient: () => ({ captureException }),}))vi.mock('@/lib/posthog/analytics', () => ({- AnalyticsEvent: { MCP_INIT: 'mcp init' },+ AnalyticsEvent: { MCP_TOOL_CALL: '$mcp_tool_call' },}))vi.mock('@/lib/posthog/flags', () => ({isFeatureFlagEnabled: vi.fn().mockResolvedValue(false),diff --git a/services/mcp/tests/unit/rate-limit-errors.test.ts b/services/mcp/tests/unit/rate-limit-errors.test.tsindex 6cbc7cff40da..e5a2e4c3bb83 100644--- a/services/mcp/tests/unit/rate-limit-errors.test.ts+++ b/services/mcp/tests/unit/rate-limit-errors.test.ts@@ -8,7 +8,7 @@ vi.mock('@/lib/posthog', () => ({getPostHogClient: () => ({ captureException }),}))vi.mock('@/lib/posthog/analytics', () => ({- AnalyticsEvent: { MCP_INIT: 'mcp init' },+ AnalyticsEvent: { MCP_TOOL_CALL: '$mcp_tool_call' },}))vi.mock('@/lib/posthog/flags', () => ({isFeatureFlagEnabled: vi.fn().mockResolvedValue(false),