: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(mcp): request icons in activity query results (#118485)
Paul D'Ambra57b1551805b6
diff --git a/docs/published/docs/mcp-analytics/harness-share.mdx b/docs/published/docs/mcp-analytics/harness-share.mdxindex 6e8219075895..94811992c25d 100644--- a/docs/published/docs/mcp-analytics/harness-share.mdx+++ b/docs/published/docs/mcp-analytics/harness-share.mdx@@ -27,3 +27,19 @@ Remaining named harnesses use brand colors or stable palette colors.PostHog assigns each call a harness from the client identity captured with it: the vendor header, the User-Agent, and the client name.[How the harness label is resolved](/docs/mcp-analytics/events#how-the-harness-label-is-resolved) lists the order PostHog checks them in, and what to check if most calls land in **Other harnesses**.++## Harness labels in SQL++`properties.$virt_mcp_harness` returns the resolved harness label as a string on MCP events, and `NULL` on other events.+You can filter and group by it in HogQL:++```sql+SELECT properties.$virt_mcp_harness AS harness, count() AS calls+FROM events+WHERE event = '$mcp_tool_call'+GROUP BY harness+ORDER BY calls DESC+```++The activity feed and recent calls table explicitly request logos for their Client and Model columns with `withIcon(label, mark)`.+Other queries keep plain string values unless they request rich formatting.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 375fce70e745..8a4a0ba6daeb 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -13147,17 +13147,17 @@ snapshots:scenes-app-max-ai-replay-vision-scan-widget--with-skipped--light:hash: v1.k794b7964.c543228b0f31abb2aae3b274819abdee4ba6a89fb3324fc6aaa2b18aefee5815.S9etTEY8oT2JhOgLO5hdc6VqvbvYhD-nU4P1WKh24ygscenes-app-mcp-analytics--activity--dark:- hash: v1.k794b7964.c394a234b4f7819a84b681afe0319092b51cbc19c9ceae5c86f5629a6317f76c.fZqYB4Ozs4JZX_R6ee6CYl3A9u25wQsT_aHbd8Yu3Kk+ hash: v1.k794b7964.0033d6fd516925f47acdd2eeceec86c6dac1ecd7c04ab131e8f5e49edd39696f.k9P9vgRFj_9dCJvXz077I-kADUf1eWKh4ho0P5tWh4sscenes-app-mcp-analytics--activity--light:- hash: v1.k794b7964.886fda2e2b5ec79f804b963d499e5efb605a9a37c39e26306c65049ce0114d8b.s4enJ2q-R3UlTKyUfBlgEBX9dqwykp7ASlNG_d2h-uk+ hash: v1.k794b7964.d474848b2bc47e46787496a14dd43ffc9e465c701cd87bbc030d4dec06c1e52b.lQLPtt2VdIWJYftYgPI8DKkqsKcQ2E6HAAHgFZrI_OMscenes-app-mcp-analytics--dashboard--medium--dark:- hash: v1.k794b7964.ff1a1cd34a237bf13a9aa027425cef5ef9d02af477b5911e81f2d50f06911c17.nuj7hl2ypQCaaQTmGjLhvXJxUUF0pu2PESjBirV_5Wk+ hash: v1.k794b7964.cd7dbb05e691ce3fb9853772e15eb64d0653e5427143dcdb6b6bb57da5fde300.IZR1Kyv8ixMRDPSgNWoKnNSzB17B5HAr3selV2DMZmUscenes-app-mcp-analytics--dashboard--medium--light:- hash: v1.k794b7964.0b16fcb8f6bb2a03d60b8b17a73e9f8eb29dce43ae8905afadd6065ca60df6d2.zIULt3A_qS_NoHK4slACz5PaZzfO-mJHm1zpED8DL78+ hash: v1.k794b7964.6d7d402edb854164d4d296a6de8d43e00316df783401b86075cfe77305a31700.WMZZtLPR6ok9F4dU8AUvN9FS4NA3DUVs-BUFMwZZktsscenes-app-mcp-analytics--dashboard--wide--dark:- hash: v1.k794b7964.aea98d8aeab252e2341577b3d8b4e968c7f2d2079f2797f8307ce0d27687c91f.7r1cPFUUDBQlsWo_xTHmWLw0bJ2Zc_DN38qtBkBXJYY+ hash: v1.k794b7964.269f4e3aa9ea51b60b564eccc7bc2d055ffaa34a299c8d7ed4ba194f16bef3be.gvZYnmAeZtEF_r-K34qolYn9mo1ct3lRM6M6r5nEbXMscenes-app-mcp-analytics--dashboard--wide--light:- hash: v1.k794b7964.f1d45cd4f9a1ef8d68595026167cbfc1864ee1b9a4818ca8bf2a0cb51a729257.Tqy2omtbfxxuJhgDDDQV0cYa2mN4qAZcbkWXz_XiYYg+ hash: v1.k794b7964.35af8931fc7aaf221b95f51bd0cae9516aae77aaca4cd607a4058e90d4a9e719.xZuG7QnTTZI-jMz_tcvX-1vxUnpTrcEJ74U6aN__nxwscenes-app-mcp-analytics--dashboard-leaderboard-home--medium--dark:hash: v1.k794b7964.ce4a6644ec9aaa5b54e7549152456c9ddabce1b78614009536d4d6df2ee72077.Ds-6RKnkFP8qkqSP9LPQa9pPfaqu7k2euZfUYnKnh6sscenes-app-mcp-analytics--dashboard-leaderboard-home--medium--light:@@ -13171,9 +13171,9 @@ snapshots:scenes-app-mcp-analytics--dashboard-narrow--light:hash: v1.k794b7964.9fd0bf729292df67e95ade4faf38103ec75f95b952502a598a2ce4c74e85dd47.zFrfMAt4P1jPjG405qkvEoHGva5TpUqKkk37qPnwiwYscenes-app-mcp-analytics--dashboard-with-menu-bar--dark:- hash: v1.k794b7964.56476e6d62c7575031afbed69f00b6e881e7178fb63e84df131ce0dc392bd538.GmtA6HgC1zoIt9ZheGQ8qTdtnUeJsV5lnxNJIlIFHLA+ hash: v1.k794b7964.4ca1e1a0efc7df3586e495c9e58076971e39ba80a8e8717df65b484488e24874.8htYr2YE9RVbjluO1Y6Ae7cbh6sc-DW6TeKSxAR0wogscenes-app-mcp-analytics--dashboard-with-menu-bar--light:- hash: v1.k794b7964.a9289a1ebe5320b06505fc5d30ffcdaad7907b0aac37e7a194fe7b9cb6a35f0d.y4AVe00Zb02hsUF8LxZmqeCIgEjLollLCGRCBT1Gvs8+ hash: v1.k794b7964.9302a44bdd2e4a56588c8d503c03344e668d2a967254b9963713576c2972ec15.umr44eCQQ6fVVQCPdtmq587DcTipu-PNYHk2-hVnaVYscenes-app-mcp-analytics--intent-clustering--dark:hash: v1.k794b7964.9549b853f80d754b9d6ccf17ab144d24218143200c90df7af687e184e7de5329.Er1_HM8avmrqmulj2hCLnkp98-HeuRvF5ed3j-_jS2Ascenes-app-mcp-analytics--intent-clustering--light:diff --git a/frontend/src/taxonomy/core-filter-definitions-by-group.json b/frontend/src/taxonomy/core-filter-definitions-by-group.jsonindex 8627d2d725c0..e9dfeccb56b1 100644--- a/frontend/src/taxonomy/core-filter-definitions-by-group.json+++ b/frontend/src/taxonomy/core-filter-definitions-by-group.json@@ -2751,6 +2751,12 @@"type": "Boolean","virtual": true},+ "$virt_mcp_harness": {+ "description": "MCP client label resolved from the event's client identity signals. Empty on non-MCP events.",+ "label": "MCP harness",+ "type": "String",+ "virtual": true+ },"$virt_traffic_category": {"description": "Detailed traffic category: ai_crawler, ai_search, ai_assistant, search_crawler, seo_crawler, etc. Bots the project defined itself report the category picked in settings.","examples": ["ai_crawler", "ai_search", "ai_assistant", "search_crawler", "regular"],diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 4361f1daa851..97c87e803e24 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -4136,6 +4136,9 @@ importers:'@storybook/react':specifier: 'catalog:'version: 10.4.6(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected](@testing-library/[email protected])(@types/[email protected])([email protected])([email protected]([email protected]))([email protected]))([email protected])+ '@testing-library/dom':+ specifier: '*'+ version: 10.4.0'@types/react':specifier: 18.3.27version: 18.3.27diff --git a/posthog/hogql/database/database.py b/posthog/hogql/database/database.pyindex 1221916e2f7e..e9755a367334 100644--- a/posthog/hogql/database/database.py+++ b/posthog/hogql/database/database.py@@ -3255,6 +3255,16 @@ def _use_virtual_fields(database: Database, modifiers: HogQLQueryModifiers, timiupdate={"hidden": True})+ with timings.measure("mcp_harness_virtual_field"):+ from products.mcp_analytics.backend.facade.api import mcp_harness_virtual_field_expr++ events_table.fields["$virt_mcp_harness"] = ExpressionField(+ name="$virt_mcp_harness",+ expr=mcp_harness_virtual_field_expr(),+ isolate_scope=True,+ description="MCP client label computed from this event's client identity signals.",+ )+revenue_fields = ["revenue", "mrr"]with timings.measure("revenue_analytics_virtual_fields"):for field in revenue_fields:diff --git a/posthog/hogql/database/schema/events.py b/posthog/hogql/database/schema/events.pyindex 4218295bfbea..4c61e7527a61 100644--- a/posthog/hogql/database/schema/events.py+++ b/posthog/hogql/database/schema/events.py@@ -219,6 +219,7 @@ class EventsTable(Table):"$virt_traffic_category","$virt_bot_name","$virt_bot_operator",+ "$virt_mcp_harness",]diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambrindex 3c970de07ee0..1102c0f9a565 100644--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr@@ -1117,6 +1117,16 @@"schema_valid": true,"table": null,"type": "string"+ },+ "$virt_mcp_harness": {+ "chain": null,+ "fields": null,+ "hogql_value": "`$virt_mcp_harness`",+ "id": null,+ "name": "$virt_mcp_harness",+ "schema_valid": true,+ "table": null,+ "type": "string"}},"id": "events",@@ -15338,6 +15348,16 @@"schema_valid": true,"table": null,"type": "string"+ },+ "$virt_mcp_harness": {+ "chain": null,+ "fields": null,+ "hogql_value": "`$virt_mcp_harness`",+ "id": null,+ "name": "$virt_mcp_harness",+ "schema_valid": true,+ "table": null,+ "type": "string"}},"id": "events",diff --git a/posthog/hogql/test/__snapshots__/test_resolver.ambr b/posthog/hogql/test/__snapshots__/test_resolver.ambrindex 096fba4bf3a6..685e5ab15697 100644--- a/posthog/hogql/test/__snapshots__/test_resolver.ambr+++ b/posthog/hogql/test/__snapshots__/test_resolver.ambr@@ -64,6 +64,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -2334,6 +2338,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -5334,6 +5342,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -6365,6 +6377,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -9521,6 +9537,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -11203,6 +11223,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -12887,6 +12911,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -13188,6 +13216,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -13837,6 +13869,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -14174,6 +14210,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -14515,6 +14555,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -14896,6 +14940,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -15283,6 +15331,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -15640,6 +15692,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -15998,6 +16054,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -16340,6 +16400,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -16795,6 +16859,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -17093,6 +17161,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: False@@ -17413,6 +17485,10 @@description: None,hidden: False},+ $virt_mcp_harness: {+ description: "MCP client label computed from this event's client identity signals.",+ hidden: False+ },$virt_traffic_category: {description: None,hidden: Falsediff --git a/posthog/taxonomy/taxonomy.py b/posthog/taxonomy/taxonomy.pyindex 1b765b4f2c43..9da3bed02c0c 100644--- a/posthog/taxonomy/taxonomy.py+++ b/posthog/taxonomy/taxonomy.py@@ -3385,6 +3385,12 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {"type": "String","virtual": True,},+ "$virt_mcp_harness": {+ "label": "MCP harness",+ "description": "MCP client label resolved from the event's client identity signals. Empty on non-MCP events.",+ "type": "String",+ "virtual": True,+ },# LLM analytics — per-modality token counts, per-unit pricing, and per-modality costs.# Emitted on $ai_generation / $ai_embedding events and stored as typed columns on the ai_events table."$ai_text_input_tokens": {diff --git a/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr b/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambrindex 8425549670d0..864cb4b4227c 100644--- a/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr+++ b/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr@@ -55,6 +55,7 @@- $virt_traffic_category (string)- $virt_bot_name (string)- $virt_bot_operator (string)+ - $virt_mcp_harness (string)'''# ---# name: test_get_system_prompt@@ -180,6 +181,7 @@- $virt_traffic_category (string)- $virt_bot_name (string)- $virt_bot_operator (string)+ - $virt_mcp_harness (string)Below is the current HogQL query and the error messagediff --git a/products/mcp_analytics/backend/facade/api.py b/products/mcp_analytics/backend/facade/api.pyindex 8e50cd043b1f..c86a1583221b 100644--- a/products/mcp_analytics/backend/facade/api.py+++ b/products/mcp_analytics/backend/facade/api.py@@ -6,7 +6,7 @@ from django.utils import timezonefrom posthog.schema import AnyPropertyFilterDiscriminatedfrom posthog.hogql import ast-from posthog.hogql.parser import parse_expr+from posthog.hogql.parser import CacheOrigin, parse_exprfrom posthog.api.capture import capture_internalfrom posthog.models.team.team import Team@@ -18,6 +18,7 @@ from products.mcp_analytics.backend.hogql_queries.base import (EFFECTIVE_TOOL_SQL,NEW_SDK_SOURCE,)+from products.mcp_analytics.backend.mcp_harness import HARNESS_TOKEN_SQL, harness_label_sqlfrom products.mcp_analytics.backend.models import MCPAnalyticsSubmissionfrom . import contracts@@ -25,6 +26,14 @@ from .constants import MCP_MISSING_CAPABILITY_EVENTfrom .enums import SubmissionKind+def mcp_harness_virtual_field_expr() -> ast.Expr:+ # nosemgrep: hogql-fstring-audit (both SQL fragments are fixed server-side expressions)+ return parse_expr(+ f"if(startsWith(event, '$mcp_'), arrayMap(h -> {harness_label_sql('h')}, [{HARNESS_TOKEN_SQL}])[1], NULL)",+ cache_origin=CacheOrigin.BUILTIN,+ )++def _to_submission(instance: MCPAnalyticsSubmission) -> contracts.Submission:return contracts.Submission(id=instance.id,diff --git a/products/mcp_analytics/backend/tests/test_harness_breakdown.py b/products/mcp_analytics/backend/tests/test_harness_breakdown.pyindex 50d869cbbf00..5c56cd1bbf2d 100644--- a/products/mcp_analytics/backend/tests/test_harness_breakdown.py+++ b/products/mcp_analytics/backend/tests/test_harness_breakdown.py@@ -9,12 +9,16 @@ from parameterized import parameterizedfrom posthog.schema import (DateRange,EventPropertyFilter,+ EventsQuery,MCPHarnessBreakdownItem,MCPHarnessBreakdownQuery,PropertyOperator,)from posthog.hogql.parser import parse_expr+from posthog.hogql.query import execute_hogql_query++from posthog.hogql_queries.events_query_runner import EventsQueryRunnerfrom products.mcp_analytics.backend import mcp_harnessfrom products.mcp_analytics.backend.hogql_queries.harness_breakdown import MCPHarnessBreakdownQueryRunner@@ -84,6 +88,51 @@ class TestMCPHarnessBreakdownQueryRunner(_MCPAnalyticsTeamScopedTestMixin, Click)return {row.harness: row for row in runner.calculate().results}+ def test_virtual_harness_property_groups_as_string(self) -> None:+ self._emit(properties={"$mcp_client_name": "codex-mcp-client"})+ self._emit(properties={"$mcp_client_name": "codex-mcp-client"}, distinct_id="d2")+ self._emit(properties={"$mcp_client_name": "claude-code"}, distinct_id="d3")++ flush_persons_and_events()+ response = execute_hogql_query(+ "SELECT properties.$virt_mcp_harness AS client, count() AS calls "+ "FROM events WHERE event = '$mcp_tool_call' GROUP BY client ORDER BY calls DESC",+ team=self.team,+ )++ self.assertEqual(response.columns, ["client", "calls"])+ self.assertEqual(response.results, [("OpenAI Codex", 2), ("Claude Code", 1)])++ def test_virtual_harness_property_is_empty_on_other_events(self) -> None:+ _create_event(team=self.team, event="$pageview", distinct_id="d1", properties={"$mcp_client_name": "codex"})++ flush_persons_and_events()+ response = execute_hogql_query("SELECT properties.$virt_mcp_harness FROM events", team=self.team)++ self.assertEqual(response.results, [(None,)])++ @parameterized.expand(+ [+ ("claude-code/1.2.0", "claude-code/1.2.0", "Claude"),+ ("codex-mcp-client", "codex-mcp-client", "OpenAI"),+ ("", "Other", "Other harnesses"),+ ]+ )+ def test_events_query_explicit_icon_preserves_client_label(self, client: str, label: str, mark: str) -> None:+ self._emit(properties={"$mcp_client_name": client})+ flush_persons_and_events()+ column = (+ "withIcon(coalesce(nullIf(toString(properties.$mcp_client_name), ''), properties.$virt_mcp_harness), "+ "transform(properties.$virt_mcp_harness, ['Claude Code', 'OpenAI Codex'], "+ "['Claude', 'OpenAI'], 'Other harnesses')) -- Client"+ )+ response = EventsQueryRunner(+ query=EventsQuery(select=[column], events=["$mcp_tool_call"], orderBy=[column.split(" --")[0] + " DESC"]),+ team=self.team,+ ).calculate()++ self.assertEqual(response.results, [[("__hx_tag", "BrandMarkLabel", "label", label, "mark", mark)]])+def test_tool_name_scopes_to_effective_tool_and_new_sdk(self) -> None:new_sdk = {"$mcp_source": "posthog_mcp_analytics"}self._emit(distinct_id="d1", properties={"$mcp_client_name": "claude-ai", **new_sdk})diff --git a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsxindex 3822ec975d1a..bb51f633d3a2 100644--- a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx+++ b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx@@ -1,6 +1,7 @@import { MOCK_DEFAULT_USER } from '~/lib/api.mock'import { Meta, StoryObj } from '@storybook/react'+import { within } from '@testing-library/dom'import { FEATURE_FLAGS } from 'lib/constants'import { dayjs } from 'lib/dayjs'@@ -9,6 +10,10 @@ import { urls } from 'scenes/urls'import { mswDecorator } from '~/mocks/browser'+import { expect } from 'storybook/test'++import { modelLab } from './aiLabs'+import { labMark } from './brandMarks'import { MCPAnalyticsDashboardOverview } from './MCPAnalyticsDashboardOverview'const KPI_RESULTS = [@@ -651,10 +656,24 @@ function activityEventsResponse(select: string[]): Record<string, any> {return durationMs}if (column.endsWith('-- Client')) {- return clientName+ if (!column.startsWith('withIcon(')) {+ return clientName+ }+ const mark =+ {+ 'claude-code': 'Claude',+ 'claude-ai': 'Claude',+ cursor: 'Cursor',+ 'posthog-cli': 'PostHog',+ windsurf: 'Windsurf',+ }[clientName] ?? 'Other harnesses'+ return ['__hx_tag', 'BrandMarkLabel', 'label', clientName || 'Other', 'mark', mark]}if (column.endsWith('-- Model')) {- return model+ if (!column.startsWith('withIcon(')) {+ return model+ }+ return ['__hx_tag', 'BrandMarkLabel', 'label', model, 'mark', labMark(modelLab(model))]}return null})@@ -988,9 +1007,15 @@ export const DashboardWithMenuBar: Story = {// The default landing tab for low-volume projects. The feed mock has enough rows to overflow its// viewport and reports more data, covering both scrolling and the load-more affordance.export const Activity: Story = {+ tags: ['manual-icons'],parameters: {pageUrl: urls.mcpAnalyticsActivity(),},+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement)+ await expect(await canvas.findAllByText('claude-opus-5-5', {}, { timeout: 15000 })).not.toHaveLength(0)+ await expect(canvasElement.querySelector('[data-attr=hogqlx-brand-mark-label] svg')).toBeVisible()+ },}export const Sessions: Story = {diff --git a/products/mcp_analytics/frontend/components/toolCallFeedQuery.ts b/products/mcp_analytics/frontend/components/toolCallFeedQuery.tsindex 167f167fea1f..774213695ab1 100644--- a/products/mcp_analytics/frontend/components/toolCallFeedQuery.ts+++ b/products/mcp_analytics/frontend/components/toolCallFeedQuery.ts@@ -3,8 +3,13 @@ import { MCP_TOOL_CALL_EVENT } from 'lib/components/TaxonomicFilter/utils/mcpProimport { pageCollectionId } from '~/queries/nodes/DataNode/pageCollections'import { DataTableNode, HogQLFilters, NodeKind } from '~/queries/schema/schema-general'+import { hogql } from '~/queries/utils'import { AnyPropertyFilter, PropertyFilterType, PropertyOperator } from '~/types'+import { LAB_ORDER, labSqlExpression } from '../aiLabs'+import { labMark } from '../brandMarks'+import { HARNESS_BY_LABEL, harnessMark } from '../dashboard/harnessRegistry'+export const MCP_ACTIVITY_DATA_COLLECTION_ID = pageCollectionId('mcp-analytics-activity')export const MCP_ACTIVITY_PAGE_SIZE = 100export const MCP_ACTIVITY_MAX_ROWS = 1000@@ -12,6 +17,10 @@ export const MCP_ACTIVITY_INTENT_COLUMN = 'properties.$mcp_intent -- Agent intenexport const MCP_ACTIVITY_ERROR_COLUMN = 'properties.$mcp_is_error -- Error'export const MCP_ACTIVITY_SESSION_COLUMN = 'properties.$session_id -- Session'+const harnessLabels = [...Object.keys(HARNESS_BY_LABEL), 'Unidentified client']+const clientMarkSql = hogql`transform(properties.$virt_mcp_harness, ${harnessLabels}, ${harnessLabels.map(harnessMark)}, 'Other harnesses')`+const modelMarkSql = hogql`transform(${hogql.raw(labSqlExpression('properties.$mcp_llm_model'))}, ${LAB_ORDER}, ${LAB_ORDER.map(labMark)}, 'Unbranded model')`+export const MCP_ACTIVITY_COLUMNS = ['*',`coalesce(@@ -23,8 +32,8 @@ export const MCP_ACTIVITY_COLUMNS = [MCP_ACTIVITY_INTENT_COLUMN,MCP_ACTIVITY_ERROR_COLUMN,'properties.$mcp_duration_ms -- Duration (ms)',- 'properties.$mcp_client_name -- Client',- 'properties.$mcp_llm_model -- Model',+ hogql`withIcon(coalesce(nullIf(toString(properties.$mcp_client_name), ''), properties.$virt_mcp_harness), ${hogql.raw(clientMarkSql)}) -- Client`,+ hogql`withIcon(properties.$mcp_llm_model, ${hogql.raw(modelMarkSql)}) -- Model`,MCP_ACTIVITY_SESSION_COLUMN,'timestamp',]diff --git a/products/mcp_analytics/package.json b/products/mcp_analytics/package.jsonindex 4b671d0da6a4..a6420856526b 100644--- a/products/mcp_analytics/package.json+++ b/products/mcp_analytics/package.json@@ -21,6 +21,7 @@"@posthog/brand": "catalog:","@posthog/icons": "catalog:","@storybook/react": "catalog:",+ "@testing-library/dom": "*","@types/react": "*","react": "*"}