Skip to content

: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.

feat(mcp-analytics): show calls by protocol revision on the dashboard (#106357)

Lucas Faria92535710ba79
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 94ba1618c8c8..cda18ba8afff 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -10610,6 +10610,14 @@ snapshots:
hash: v1.k794b7964.f4834bd847409bc77a9089579cd237f78ae7e83fdcc9521c395180aea0febb8b.F4anEytvZgRohcIl4DRGzQryWB1odxKnwlegi-rDGDY
scenes-app-mcp-analytics-dashboard-cards--share-by-model-unknown-only--light:
hash: v1.k794b7964.eadcb2a22597e6ccdb6a3f09c36e7c25e8e877947c1907adc3e26493efa99b6f.F3RoI5DLu7SfZO7h6xDbMP3Zy8nLzBBwcBfREd5fw8k
+ scenes-app-mcp-analytics-dashboard-cards--share-by-protocol-version--dark:
+ hash: v1.k794b7964.4797eb9699599cce7b5c1b4b602d47deaef29599d700e440bd57c8846a13f9e7.2rtO4N1ReXx_XHlS0sLC6ecv_H5pWLDF4OhJwXPQqPk
+ scenes-app-mcp-analytics-dashboard-cards--share-by-protocol-version--light:
+ hash: v1.k794b7964.d4c0ad9490f9324805cda24156d5ff98d958ad05ca72cce51e72fc3a970db629.zLruUrubw1IU4_FVWo1T96V5cmAOOhhrv5ANAu4FY4k
+ scenes-app-mcp-analytics-dashboard-cards--share-by-protocol-version-many-legacy--dark:
+ hash: v1.k794b7964.81b7244b2881278b658a3892c13fe77c4631edd8ad5041e14a4c1ce480c29d17.IkC2uJ3Zav4XGz7XBB_AX0_rDes0b2qnZoEsK7UgY94
+ scenes-app-mcp-analytics-dashboard-cards--share-by-protocol-version-many-legacy--light:
+ hash: v1.k794b7964.1a63e7fd139014351710bb159cd7250b8f58bd397aaab4db622a693c20e1c779.tuYcBlTGs7j61MU4GruquLPrJBrBm-pDM3i4Bys61FM
scenes-app-mcp-analytics-missing-capabilities-preview--example-reports--dark:
hash: v1.k794b7964.e1dfe15b20b22dec1f74881db821597e40d534cf0c9773fc032948311de642f7.iAS_FuPfykHZ7rjy90ExdGbsAT1eKhSIwVLvxUg1aGM
scenes-app-mcp-analytics-missing-capabilities-preview--example-reports--light:
diff --git a/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx b/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx
index aa33b091ccbb..eecd3c0079dc 100644
--- a/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx
+++ b/products/mcp_analytics/frontend/MCPAnalyticsDashboardOverview.tsx
@@ -13,6 +13,7 @@ import { HarnessBarChart } from './dashboard/HarnessBarChart'
import { KpiTiles } from './dashboard/KpiTiles'
import { ModelBarChart } from './dashboard/ModelBarChart'
import { NotableSessionsTable } from './dashboard/NotableSessionsTable'
+import { ProtocolVersionStrip } from './dashboard/ProtocolVersionStrip'
import { RecentToolCallsCard } from './dashboard/RecentToolCallsCard'
import { ToolErrorRateChart } from './dashboard/ToolErrorRateChart'
import { ToolUsageChart } from './dashboard/ToolUsageChart'
@@ -35,6 +36,9 @@ export function MCPAnalyticsDashboardOverview(): JSX.Element {
modelRows,
modelRowsLoading,
hasModelData,
+ protocolVersionRows,
+ protocolVersionRowsLoading,
+ hasProtocolVersionData,
dailyActivity,
activityRowsLoading,
activityIncompleteTail,
@@ -67,6 +71,7 @@ export function MCPAnalyticsDashboardOverview(): JSX.Element {
sessionRowsLoading ||
harnessRowsLoading ||
modelRowsLoading ||
+ protocolVersionRowsLoading ||
activityRowsLoading ||
toolDailyRowsLoading ||
toolRowsLoading
@@ -131,6 +136,7 @@ export function MCPAnalyticsDashboardOverview(): JSX.Element {
<HarnessBarChart rows={harnessRows} loading={harnessRowsLoading} theme={theme} />
{hasModelData ? <ModelBarChart rows={modelRows} theme={theme} filters={queryFilters} /> : null}
</div>
+ {hasProtocolVersionData ? <ProtocolVersionStrip rows={protocolVersionRows} theme={theme} /> : null}
</div>
</section>
<section className="flex min-w-0 flex-col gap-4" data-quill>
diff --git a/products/mcp_analytics/frontend/dashboard/DashboardCards.stories.tsx b/products/mcp_analytics/frontend/dashboard/DashboardCards.stories.tsx
index 20969b71ff00..16813a258152 100644
--- a/products/mcp_analytics/frontend/dashboard/DashboardCards.stories.tsx
+++ b/products/mcp_analytics/frontend/dashboard/DashboardCards.stories.tsx
@@ -5,7 +5,7 @@ import { type ChartTheme } from '@posthog/quill-charts'
import { buildTheme } from 'lib/charts/utils/theme'
import { mswDecorator } from '~/mocks/browser'
-import { MCPModelBreakdownQuery } from '~/queries/schema/schema-general'
+import { MCPModelBreakdownQuery, MCPProtocolVersionBreakdownItem } from '~/queries/schema/schema-general'
import { MCPAnalyticsDashboardOverview } from '../MCPAnalyticsDashboardOverview'
import {
@@ -23,6 +23,7 @@ import { HarnessBarChart } from './HarnessBarChart'
import { KpiTiles } from './KpiTiles'
import { ModelBarChart } from './ModelBarChart'
import { NotableSessionsTable } from './NotableSessionsTable'
+import { ProtocolVersionStrip } from './ProtocolVersionStrip'
import { ToolErrorRateChart } from './ToolErrorRateChart'
import { ToolUsageChart } from './ToolUsageChart'
@@ -113,6 +114,15 @@ const modelPagesDecorator = mswDecorator({
},
})
+const PROTOCOL_VERSION_ROWS: MCPProtocolVersionBreakdownItem[] = [
+ { protocol_version: '2026-07-28', is_current: true, total_calls: 5832 },
+ { protocol_version: '2025-11-25', is_current: false, total_calls: 2256 },
+ { protocol_version: '2025-06-18', is_current: false, total_calls: 13296 },
+ { protocol_version: '2025-03-26', is_current: false, total_calls: 15 },
+ { protocol_version: '2024-11-05', is_current: false, total_calls: 20 },
+ { protocol_version: 'Unknown', is_current: false, total_calls: 982 },
+]
+
const NOTABLE_SESSIONS: NotableSession[] = [
{
rule: 'worst_error_rate',
@@ -385,6 +395,29 @@ export const ShareByModelEmpty: Story = {
render: withTheme((theme) => <ModelBarChart rows={[]} theme={theme} />),
}
+export const ShareByProtocolVersion: Story = {
+ render: withTheme((theme) => <ProtocolVersionStrip rows={PROTOCOL_VERSION_ROWS} theme={theme} />),
+}
+
+export const ShareByProtocolVersionManyLegacy: Story = {
+ render: withTheme((theme) => (
+ <ProtocolVersionStrip
+ rows={[
+ { protocol_version: 'draft', is_current: true, total_calls: 120 },
+ { protocol_version: '2026-07-28', is_current: true, total_calls: 5832 },
+ { protocol_version: '2025-11-25', is_current: false, total_calls: 2256 },
+ { protocol_version: '2025-06-18', is_current: false, total_calls: 13296 },
+ { protocol_version: '2025-03-26', is_current: false, total_calls: 415 },
+ { protocol_version: '2024-11-05', is_current: false, total_calls: 220 },
+ { protocol_version: 'v2', is_current: false, total_calls: 90 },
+ { protocol_version: 'Other', is_current: false, total_calls: 60 },
+ { protocol_version: 'Unknown', is_current: false, total_calls: 982 },
+ ]}
+ theme={theme}
+ />
+ )),
+}
+
export const ErrorRateByTool: Story = {
render: withTheme((theme) => <ToolErrorRateChart rows={TOOL_ROWS} loading={false} theme={theme} />),
}
diff --git a/products/mcp_analytics/frontend/dashboard/ProtocolVersionStrip.tsx b/products/mcp_analytics/frontend/dashboard/ProtocolVersionStrip.tsx
new file mode 100644
index 000000000000..3e5717dc773a
--- /dev/null
+++ b/products/mcp_analytics/frontend/dashboard/ProtocolVersionStrip.tsx
@@ -0,0 +1,119 @@
+import { useMemo } from 'react'
+
+import { type ChartTheme, type TooltipContext } from '@posthog/quill-charts'
+
+import { LemonCard } from 'lib/lemon-ui/LemonCard'
+import { Tooltip } from 'lib/lemon-ui/Tooltip'
+
+import { MCPProtocolVersionBreakdownItem } from '~/queries/schema/schema-general'
+
+import { ChartTooltip } from './ChartTooltip'
+import { formatNumber } from './formatters'
+import {
+ CURRENT_PROTOCOL_VERSION,
+ PROTOCOL_VERSIONING_URL,
+ formatShare,
+ specVersionUrl,
+ summarizeProtocolVersions,
+ versionColor,
+} from './protocolVersions'
+import { ShareBarChart, type ShareBarRow } from './ShareBarChart'
+
+function protocolVersionLabel(version: string): string {
+ return version === 'Other' ? 'Other versions' : version
+}
+
+function renderTooltip(ctx: TooltipContext<MCPProtocolVersionBreakdownItem & { share: number }>): JSX.Element | null {
+ const row = ctx.seriesData[0]?.series.meta
+ if (!row) {
+ return null
+ }
+ return (
+ <ChartTooltip
+ title={protocolVersionLabel(row.protocol_version)}
+ rows={[
+ ['Calls', formatNumber(row.total_calls)],
+ ['Share of all calls', formatShare(row.share)],
+ ]}
+ />
+ )
+}
+
+function SummarySpan({
+ tooltip,
+ docLink,
+ children,
+}: {
+ tooltip: string
+ docLink?: string
+ children: React.ReactNode
+}): JSX.Element {
+ return (
+ <Tooltip title={tooltip} docLink={docLink}>
+ <span tabIndex={0} className="cursor-help decoration-dotted underline underline-offset-2">
+ {children}
+ </span>
+ </Tooltip>
+ )
+}
+
+export function ProtocolVersionStrip({
+ rows,
+ theme,
+}: {
+ rows: MCPProtocolVersionBreakdownItem[]
+ theme: ChartTheme
+}): JSX.Element {
+ const { totalCalls, unknownCalls, legacyCalls } = useMemo(() => summarizeProtocolVersions(rows), [rows])
+ const columns = useMemo<ShareBarRow<MCPProtocolVersionBreakdownItem>[][]>(() => {
+ const chartRows = rows.map((row) => ({
+ key: `${row.protocol_version}:${row.is_current}`,
+ label: protocolVersionLabel(row.protocol_version),
+ href: specVersionUrl(row.protocol_version),
+ value: row.total_calls,
+ color: versionColor(theme, row),
+ meta: row,
+ }))
+ const half = Math.ceil(chartRows.length / 2)
+ return [chartRows.slice(0, half), chartRows.slice(half)].filter((column) => column.length > 0)
+ }, [rows, theme])
+ const share = (calls: number): number => (totalCalls > 0 ? (calls / totalCalls) * 100 : 0)
+
+ return (
+ <LemonCard className="flex min-w-0 flex-col gap-1 bg-surface-secondary px-3 py-2" hoverEffect={false}>
+ <div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1">
+ <h3 className="mb-0 text-sm font-medium">
+ <SummarySpan
+ tooltip={`MCP protocol versions are named by their release date. Clients and servers agree on one for each request. ${CURRENT_PROTOCOL_VERSION} removed the initialize handshake that older versions use. Select a version to read what changed in it.`}
+ docLink={PROTOCOL_VERSIONING_URL}
+ >
+ Calls by MCP protocol version
+ </SummarySpan>
+ </h3>
+ <div className="flex flex-wrap gap-3 text-xs text-secondary tabular-nums" translate="no">
+ <SummarySpan
+ tooltip={`Calls on versions older than ${CURRENT_PROTOCOL_VERSION}, plus values that aren't a known version. Calls on the draft version count as current.`}
+ >
+ {formatShare(share(legacyCalls))} on versions before {CURRENT_PROTOCOL_VERSION}
+ </SummarySpan>
+ <SummarySpan tooltip="These calls have no protocol version, usually because the server runs @posthog/mcp before 0.10.0 or posthog (Python) before 7.33.0. Upgrade the SDK to capture it.">
+ {formatShare(share(unknownCalls))} unknown
+ </SummarySpan>
+ </div>
+ </div>
+ <div className="grid min-w-0 grid-cols-1 gap-x-8 @min-[48rem]/mcp-overview:grid-cols-2">
+ {columns.map((column) => (
+ <ShareBarChart
+ key={column[0].key}
+ rows={column}
+ totalCalls={totalCalls}
+ theme={theme}
+ tooltip={renderTooltip}
+ label="Calls by MCP protocol version"
+ fitContent
+ />
+ ))}
+ </div>
+ </LemonCard>
+ )
+}
diff --git a/products/mcp_analytics/frontend/dashboard/ShareBarChart.tsx b/products/mcp_analytics/frontend/dashboard/ShareBarChart.tsx
index 4c8308b944a3..b7fc10d83dac 100644
--- a/products/mcp_analytics/frontend/dashboard/ShareBarChart.tsx
+++ b/products/mcp_analytics/frontend/dashboard/ShareBarChart.tsx
@@ -16,12 +16,15 @@ export function ShareBarChart<T>({
theme,
tooltip,
label,
+ fitContent = false,
}: {
rows: ShareBarRow<T>[]
totalCalls: number
theme: ChartTheme
tooltip: (ctx: TooltipContext<T & { share: number }>) => JSX.Element | null
label: string
+ /** Size to the rows instead of a fixed, scrollable 320px area. */
+ fitContent?: boolean
}): JSX.Element {
const labels = useMemo(() => rows.map((row) => row.key), [rows])
const series = useMemo<Series<T & { share: number }>[]>(
@@ -41,8 +44,17 @@ export function ShareBarChart<T>({
)
const config = useShareBarChartConfig(rows.length, totalCalls)
return (
- <div className="h-80 overflow-y-auto" translate="no" tabIndex={0} role="region" aria-label={label}>
- <div className="flex min-h-80 flex-col" style={{ height: rows.length * 40 + 20 }}>
+ <div
+ className={fitContent ? undefined : 'h-80 overflow-y-auto'}
+ translate="no"
+ tabIndex={0}
+ role="region"
+ aria-label={label}
+ >
+ <div
+ className={fitContent ? 'flex flex-col' : 'flex min-h-80 flex-col'}
+ style={{ height: rows.length * 40 + 20 }}
+ >
<BarChart series={series} labels={labels} theme={theme} config={config} tooltip={tooltip}>
<ShareBarLabels rows={rows} totalCalls={totalCalls} />
</BarChart>
diff --git a/products/mcp_analytics/frontend/dashboard/ShareBarLabels.tsx b/products/mcp_analytics/frontend/dashboard/ShareBarLabels.tsx
index fabc24c813a9..febb3ba099e3 100644
--- a/products/mcp_analytics/frontend/dashboard/ShareBarLabels.tsx
+++ b/products/mcp_analytics/frontend/dashboard/ShareBarLabels.tsx
@@ -2,6 +2,7 @@ import { type ReactNode } from 'react'
import { useChartLayout } from '@posthog/quill-charts'
+import { Link } from 'lib/lemon-ui/Link'
import { formatPercentage } from 'lib/utils/numbers'
import { formatNumber } from './formatters'
@@ -10,6 +11,7 @@ export interface ShareBarLabel {
key: string
label: string
icon?: ReactNode
+ href?: string
value: number
}
@@ -25,7 +27,19 @@ export function ShareBarLabels({ rows, totalCalls }: { rows: ShareBarLabel[]; to
>
<span className="flex min-w-0 items-center gap-1.5" title={row.label}>
{row.icon}
- <span className="truncate">{row.label}</span>
+ {row.href ? (
+ <Link
+ to={row.href}
+ target="_blank"
+ className="pointer-events-auto truncate"
+ data-hog-charts-interactive-overlay
+ onClick={(event) => event.stopPropagation()}
+ >
+ {row.label}
+ </Link>
+ ) : (
+ <span className="truncate">{row.label}</span>
+ )}
</span>
<span className="shrink-0 text-secondary tabular-nums">
{formatPercentage(totalCalls > 0 ? (row.value / totalCalls) * 100 : 0, { compact: true })} ·{' '}
diff --git a/products/mcp_analytics/frontend/dashboard/modelColors.ts b/products/mcp_analytics/frontend/dashboard/modelColors.ts
index f4ce66a329e7..055ccbe0855c 100644
--- a/products/mcp_analytics/frontend/dashboard/modelColors.ts
+++ b/products/mcp_analytics/frontend/dashboard/modelColors.ts
@@ -36,10 +36,13 @@ export function modelColor(theme: ChartTheme, model: string): string | undefined
const name = match ? normalized.slice(match.index + match[0].length - match[1].length) : normalized
const hash = hashCodeForString(name)
const index = match ? FAMILY_COLOR_INDEX[match[1]] : hash
- const base = theme.colors[index % theme.colors.length]
+ return shadeColor(theme.colors[index % theme.colors.length], (hash % 5) * 8) ?? theme.axisColor
+}
+
+export function shadeColor(base: string | undefined, pct: number): string | undefined {
if (!base) {
- return theme.axisColor
+ return undefined
}
const hex = toOpaqueHex(base)
- return /^#[\da-f]{3}([\da-f]{3})?$/i.test(hex) ? lightenDarkenColor(hex, (hash % 5) * 8) : base
+ return /^#[\da-f]{3}([\da-f]{3})?$/i.test(hex) ? lightenDarkenColor(hex, pct) : base
}
diff --git a/products/mcp_analytics/frontend/dashboard/protocolVersions.test.ts b/products/mcp_analytics/frontend/dashboard/protocolVersions.test.ts
new file mode 100644
index 000000000000..e7813ef84ff7
--- /dev/null
+++ b/products/mcp_analytics/frontend/dashboard/protocolVersions.test.ts
@@ -0,0 +1,86 @@
+import { DEFAULT_CHART_COLORS } from '@posthog/quill-charts'
+
+import { MCPProtocolVersionBreakdownItem } from '~/queries/schema/schema-general'
+
+import { formatShare, specVersionUrl, summarizeProtocolVersions, versionColor, versionGroup } from './protocolVersions'
+
+const theme = { colors: [...DEFAULT_CHART_COLORS], axisColor: '#888888' }
+
+const row = (protocol_version: string, is_current: boolean, total_calls = 1): MCPProtocolVersionBreakdownItem => ({
+ protocol_version,
+ is_current,
+ total_calls,
+})
+
+describe('protocol versions', () => {
+ it.each([
+ [row('draft', true), 'current'],
+ [row('2026-07-28', true), 'current'],
+ [row('2025-06-18', false), 'legacy'],
+ [row('v2', false), 'legacy'],
+ [row('Other', false), 'legacy'],
+ [row('Unknown', false), 'unknown'],
+ ])('groups %o as %s', (item, expected) => {
+ expect(versionGroup(item)).toBe(expected)
+ })
+
+ it.each([
+ { name: 'empty', rows: [], expected: { totalCalls: 0, unknownCalls: 0, legacyCalls: 0 } },
+ {
+ name: 'mixed eras',
+ rows: [
+ row('draft', true, 5),
+ row('2026-07-28', true, 50),
+ row('2025-06-18', false, 100),
+ row('v2', false, 15),
+ row('Other', false, 20),
+ row('Unknown', false, 40),
+ ],
+ expected: { totalCalls: 230, unknownCalls: 40, legacyCalls: 135 },
+ },
+ ])('sums calls for $name', ({ rows, expected }) => {
+ expect(summarizeProtocolVersions(rows)).toEqual(expected)
+ })
+
+ it.each([
+ [0, '0%'],
+ [0.4, '0.4%'],
+ [61.2, '61%'],
+ [99.4, '99%'],
+ [99.6, '>99%'],
+ [100, '100%'],
+ ])('formats a %s%% share as %s', (pct, expected) => {
+ expect(formatShare(pct)).toBe(expected)
+ })
+
+ it('colors each group once, with Other as faded legacy and Unknown muted', () => {
+ const colors = [
+ row('2026-07-28', true),
+ row('2025-06-18', false),
+ row('Other', false),
+ row('Unknown', false),
+ ].map((item) => versionColor(theme, item))
+
+ expect(colors[0]).toBe(versionColor(theme, row('draft', true)))
+ expect(colors[1]).toBe(versionColor(theme, row('v2', false)))
+ expect(new Set(colors).size).toBe(4)
+ expect(colors[3]).toBe(theme.axisColor)
+ })
+
+ it.each([
+ ['2024-11-05', 'https://modelcontextprotocol.io/specification/2024-11-05'],
+ ['2025-06-18', 'https://modelcontextprotocol.io/specification/2025-06-18/changelog'],
+ ['2026-07-28', 'https://modelcontextprotocol.io/specification/2026-07-28/changelog'],
+ ['draft', 'https://modelcontextprotocol.io/specification/draft/changelog'],
+ ['2026-01-26', undefined],
+ ['v2', undefined],
+ ['Other', undefined],
+ ['Unknown', undefined],
+ ])('links %s to %s', (version, expected) => {
+ expect(specVersionUrl(version)).toBe(expected)
+ })
+
+ it('falls back to the axis color when the palette is too short', () => {
+ expect(versionColor({ colors: [], axisColor: '#888888' }, row('2025-06-18', false))).toBe('#888888')
+ })
+})
diff --git a/products/mcp_analytics/frontend/dashboard/protocolVersions.ts b/products/mcp_analytics/frontend/dashboard/protocolVersions.ts
new file mode 100644
index 000000000000..4b2dd2202aae
--- /dev/null
+++ b/products/mcp_analytics/frontend/dashboard/protocolVersions.ts
@@ -0,0 +1,69 @@
+import type { ChartTheme } from '@posthog/quill-charts'
+
+import { formatPercentage } from 'lib/utils/numbers'
+
+import { MCPProtocolVersionBreakdownItem } from '~/queries/schema/schema-general'
+
+import { shadeColor } from './modelColors'
+
+export const CURRENT_PROTOCOL_VERSION = '2026-07-28'
+
+const MCP_SITE = 'https://modelcontextprotocol.io'
+export const PROTOCOL_VERSIONING_URL = `${MCP_SITE}/docs/learn/versioning`
+
+// Released spec versions, one line per release. Anything unlisted (junk values, a version
+// released after this list) renders without a link rather than a 404.
+const SPEC_VERSION_PATHS: Record<string, string> = {
+ '2024-11-05': '/specification/2024-11-05',
+ '2025-03-26': '/specification/2025-03-26/changelog',
+ '2025-06-18': '/specification/2025-06-18/changelog',
+ '2025-11-25': '/specification/2025-11-25/changelog',
+ '2026-07-28': '/specification/2026-07-28/changelog',
+ draft: '/specification/draft/changelog',
+}
+
+export function specVersionUrl(version: string): string | undefined {
+ const path = SPEC_VERSION_PATHS[version]
+ return path ? `${MCP_SITE}${path}` : undefined
+}
+
+type VersionGroup = 'current' | 'legacy' | 'unknown'
+
+// The runner only folds legacy versions into 'Other', so it belongs to the legacy group.
+export function versionGroup(row: MCPProtocolVersionBreakdownItem): VersionGroup {
+ if (row.protocol_version === 'Unknown') {
+ return 'unknown'
+ }
+ return row.is_current ? 'current' : 'legacy'
+}
+
+export function summarizeProtocolVersions(rows: MCPProtocolVersionBreakdownItem[]): {
+ totalCalls: number
+ unknownCalls: number
+ legacyCalls: number
+} {
+ const sumCalls = (predicate: (row: MCPProtocolVersionBreakdownItem) => boolean): number =>
+ rows.filter(predicate).reduce((total, row) => total + row.total_calls, 0)
+ return {
+ totalCalls: sumCalls(() => true),
+ unknownCalls: sumCalls((row) => versionGroup(row) === 'unknown'),
+ legacyCalls: sumCalls((row) => versionGroup(row) === 'legacy'),
+ }
+}
+
+// Two significant digits round 99.6% up to "100%", which would read as nobody having migrated.
+export function formatShare(pct: number): string {
+ return pct >= 99.5 && pct < 100 ? '>99%' : formatPercentage(pct, { compact: true })
+}
+
+const GROUP_PALETTE_INDEX = { current: 0, legacy: 11 }
+const OTHER_LIGHTEN_PCT = 30
+
+export function versionColor(theme: ChartTheme, row: MCPProtocolVersionBreakdownItem): string | undefined {
+ const group = versionGroup(row)
+ if (group === 'unknown') {
+ return theme.axisColor
+ }
+ const base = theme.colors[GROUP_PALETTE_INDEX[group]]
+ return shadeColor(base, row.protocol_version === 'Other' ? OTHER_LIGHTEN_PCT : 0) ?? theme.axisColor
+}
diff --git a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.ts b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.ts
index b5b67e6e2a45..d51bca135401 100644
--- a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.ts
+++ b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.ts
@@ -409,6 +409,27 @@ describe('mcpDashboardOverviewLogic', () => {
})
})
+ describe('protocol version visibility', () => {
+ beforeEach(() => {
+ jest.clearAllMocks()
+ initKeaTests()
+ jest.spyOn(mockApi, 'query').mockResolvedValue({ results: [] } as any)
+ })
+
+ it.each([
+ { rows: [], visible: false },
+ { rows: [{ protocol_version: 'Unknown', is_current: false, total_calls: 12 }], visible: true },
+ { rows: [{ protocol_version: '2026-07-28', is_current: true, total_calls: 1 }], visible: true },
+ ])('shows protocol version coverage when any call exists: $rows', async ({ rows, visible }) => {
+ const logic = mcpDashboardOverviewLogic()
+ logic.mount()
+ await expectLogic(logic).toFinishAllListeners()
+
+ logic.actions.loadProtocolVersionRowsSuccess(rows)
+ expect(logic.values.hasProtocolVersionData).toBe(visible)
+ })
+ })
+
describe('filter wiring', () => {
beforeEach(() => {
jest.clearAllMocks()
@@ -476,11 +497,11 @@ describe('mcpDashboardOverviewLogic', () => {
}).toFinishAllListeners()
const reloads = reloadCallsSince(callsBefore)
- // Eight tiles: KPI + users + the six breakdown queries.
- expect(reloads.length).toBe(8)
- // The six breakdowns pass the raw selected range straight through.
+ // Nine tiles: KPI + users + the seven breakdown queries.
+ expect(reloads.length).toBe(9)
+ // The seven breakdowns pass the raw selected range straight through.
const breakdowns = reloads.filter((call) => filtersOf(call).dateRange?.date_from === '-30d')
- expect(breakdowns).toHaveLength(6)
+ expect(breakdowns).toHaveLength(7)
// The KPI and users tiles widen to an absolute doubled window so they can compare against the prior period.
const kpi = reloads.find((call) => call.query?.includes('AS bucket'))
expect(kpi?.filters.dateRange.date_from).not.toBe('-30d')
@@ -504,7 +525,7 @@ describe('mcpDashboardOverviewLogic', () => {
}
const reloads = reloadCallsSince(callsBefore)
- expect(reloads.length).toBe(8)
+ expect(reloads.length).toBe(9)
expect(reloads.every((call) => filtersOf(call).filterTestAccounts === enabled)).toBe(true)
})
@@ -517,7 +538,7 @@ describe('mcpDashboardOverviewLogic', () => {
// No explicit toggle, yet every tile filters internal users because the team default is on.
const reloads = mockApi.query.mock.calls.map((call) => call[0] as any)
- expect(reloads.length).toBeGreaterThanOrEqual(8)
+ expect(reloads.length).toBeGreaterThanOrEqual(9)
expect(reloads.every((call) => filtersOf(call).filterTestAccounts === true)).toBe(true)
})
@@ -542,7 +563,7 @@ describe('mcpDashboardOverviewLogic', () => {
}).toFinishAllListeners()
const reloads = reloadCallsSince(callsBefore)
- expect(reloads).toHaveLength(8)
+ expect(reloads).toHaveLength(9)
expect(reloads.every((call) => filtersOf(call).filterTestAccounts === true)).toBe(true)
expect(
reloads.every((call) => JSON.stringify(filtersOf(call).properties) === JSON.stringify([EVENT_FILTER]))
@@ -564,12 +585,12 @@ describe('mcpDashboardOverviewLogic', () => {
}).toFinishAllListeners()
const reloads = reloadCallsSince(callsBefore)
- expect(reloads).toHaveLength(8)
+ expect(reloads).toHaveLength(9)
expect(reloads.every((call) => filtersOf(call).filterTestAccounts === true)).toBe(true)
expect(
reloads.every((call) => JSON.stringify(filtersOf(call).properties) === JSON.stringify([EVENT_FILTER]))
).toBe(true)
- expect(reloads.filter((call) => filtersOf(call).dateRange?.date_from === '-30d')).toHaveLength(6)
+ expect(reloads.filter((call) => filtersOf(call).dateRange?.date_from === '-30d')).toHaveLength(7)
})
// Feature-flag filters arrive as ordinary $feature/<key> event-property filters.
const FLAG_FILTER: AnyPropertyFilter = {
@@ -593,7 +614,7 @@ describe('mcpDashboardOverviewLogic', () => {
}).toFinishAllListeners()
const reloads = reloadCallsSince(callsBefore)
- expect(reloads.length).toBe(8)
+ expect(reloads.length).toBe(9)
expect(
reloads.every((call) => JSON.stringify(filtersOf(call).properties) === JSON.stringify([filter]))
).toBe(true)
diff --git a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts
index b9f2a8653b83..3a846e157fa6 100644
--- a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts
+++ b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts
@@ -19,6 +19,7 @@ import {
HogQLQueryResponse,
MCPHarnessBreakdownItem,
MCPModelBreakdownItem,
+ MCPProtocolVersionBreakdownItem,
MCPToolCallBreakdownItem,
MCPToolCallsAndErrorsItem,
NodeKind,
@@ -395,6 +396,7 @@ export interface mcpDashboardOverviewLogicValues {
harnessRowsLoading: boolean
hasFilterInteraction: boolean
hasModelData: boolean
+ hasProtocolVersionData: boolean
intentClusterCount: KPIMetric
interval: IntervalType
kpiIncompleteTail: boolean
@@ -403,6 +405,8 @@ export interface mcpDashboardOverviewLogicValues {
modelRows: ModelRow[]
modelRowsLoading: boolean
notableSessions: NotableSession[]
+ protocolVersionRows: MCPProtocolVersionBreakdownItem[]
+ protocolVersionRowsLoading: boolean
queryFilters: HogQLFilters
sessionRows: SessionRow[]
sessionRowsLoading: boolean
@@ -502,6 +506,21 @@ export interface mcpDashboardOverviewLogicActions {
modelRows: ModelRow[]
payload?: void
}
+ loadProtocolVersionRows: (_: void) => void
+ loadProtocolVersionRowsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadProtocolVersionRowsSuccess: (
+ protocolVersionRows: MCPProtocolVersionBreakdownItem[],
+ payload?: void
+ ) => {
+ protocolVersionRows: MCPProtocolVersionBreakdownItem[]
+ payload?: void
+ }
loadSessionRows: (_: void) => void
loadSessionRowsFailure: (
error: string,
@@ -615,6 +634,7 @@ export interface mcpDashboardOverviewLogicMeta {
sessionRowsLoading: boolean,
harnessRowsLoading: boolean,
modelRowsLoading: boolean,
+ protocolVersionRowsLoading: boolean,
activityRowsLoading: boolean,
toolDailyRowsLoading: boolean
) => boolean
@@ -637,6 +657,7 @@ export interface mcpDashboardOverviewLogicMeta {
toolDailySeries: (toolDailyRows: ToolDailyRow[], bucketKeys: string[]) => ToolDailySeries
notableSessions: (sessionRows: SessionRow[]) => NotableSession[]
hasModelData: (modelRows: ModelRow[]) => boolean
+ hasProtocolVersionData: (protocolVersionRows: MCPProtocolVersionBreakdownItem[]) => boolean
intentClusterCount: (totalClusterCount: number) => KPIMetric
}
}
@@ -834,6 +855,22 @@ export const mcpDashboardOverviewLogic = kea<mcpDashboardOverviewLogicType>([
},
},
],
+ protocolVersionRows: [
+ [] as MCPProtocolVersionBreakdownItem[],
+ {
+ loadProtocolVersionRows: async (_: void, breakpoint): Promise<MCPProtocolVersionBreakdownItem[]> => {
+ const { dateRange, properties, filterTestAccounts } = values.queryFilters
+ const response = (await api.query({
+ kind: NodeKind.MCPProtocolVersionBreakdownQuery,
+ dateRange,
+ properties,
+ filterTestAccounts,
+ })) as { results?: MCPProtocolVersionBreakdownItem[] }
+ breakpoint()
+ return response?.results ?? []
+ },
+ },
+ ],
activityRows: [
[] as ActivityRow[],
{
@@ -886,6 +923,7 @@ export const mcpDashboardOverviewLogic = kea<mcpDashboardOverviewLogicType>([
s.sessionRowsLoading,
s.harnessRowsLoading,
s.modelRowsLoading,
+ s.protocolVersionRowsLoading,
s.activityRowsLoading,
s.toolDailyRowsLoading,
],
@@ -943,6 +981,10 @@ export const mcpDashboardOverviewLogic = kea<mcpDashboardOverviewLogicType>([
(s) => [s.modelRows],
(modelRows: ModelRow[]): boolean => modelRows.some((row) => row.total_calls > 0),
],
+ hasProtocolVersionData: [
+ (s) => [s.protocolVersionRows],
+ (protocolVersionRows: MCPProtocolVersionBreakdownItem[]): boolean => protocolVersionRows.length > 0,
+ ],
intentClusterCount: [
// The snapshot only stores the top clusters by call volume — report
// the run's true count, not the length of the truncated list.
@@ -985,6 +1027,7 @@ export const mcpDashboardOverviewLogic = kea<mcpDashboardOverviewLogicType>([
actions.loadSessionRows()
actions.loadHarnessRows()
actions.loadModelRows()
+ actions.loadProtocolVersionRows()
actions.loadActivityRows()
actions.loadToolDailyRows()
},