: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-analytics): storybook stories for doc screenshots (#64097)
Paul D'Ambra088221eaa081
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 6af2962ee415..b77162ae20ad 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5308,6 +5308,10 @@ snapshots:hash: v1.k794b7964.83c385733deb4cb77095126aa6a3f07575be1ade3a8c264f8ab5535a8e388e46.1kLb3ug8AjcFymdwya_lMsMdDCY_TMjXZoSsNGmeIKwscenes-app-data-warehouse-settings-schemas--multi-schema--light:hash: v1.k794b7964.0ac75ee5ad6cce1b73e6e462c3afc25be5fa8b185803b2841ba592e3cd213447.dJOxWbbi2m7WmG9JPR4C2pvmDkUAQciRrcIRbZyHhQk+ scenes-app-data-warehouse-sql-editor--top-tools-per-server--dark:+ hash: v1.k794b7964.1c077ddef3f35475809250e6f5ca5bf28ff4e76118f9cc324f3111c640dc734e.SAFT2NixbMVO1CefVzYzDcOznVq2iZLGzXmhYnim2-0+ scenes-app-data-warehouse-sql-editor--top-tools-per-server--light:+ hash: v1.k794b7964.a1f22f0abe647e51d75603df28448d9dd09d5d1193838d0d18e592c73d24ab7b.Vuc8iYlKwzsbg3TJr_6vltAZplqU3xwvnkQC2leev5Iscenes-app-error-project-unavailable--access-revoked--dark:hash: v1.k794b7964.0574501d1036cac7563c61590dfb8b3d64192e239cbad126d754b9905b4f3ee1._MDyv82QyHN-dApRaQoppTvESKRRZP_p6MB5PKLrjegscenes-app-error-project-unavailable--access-revoked--light:@@ -5328,6 +5332,10 @@ snapshots:hash: v1.k794b7964.255bb3a04f42d5dc5922480078098194199f9ab2654ef6923d7e725ff7968ba1.NqAiq7rAZkXlnjCi3_nZCTo3qi16OjXPDyE7wa8epHYscenes-app-events--event-explorer--light:hash: v1.k794b7964.9c5112b445a6384ad2d6a0d26338b7336485f3144bff122a1e54ea3a1138ae02.ufrUX3DKNQ97Zuadfm6U6QGXqbdaMxwYa5R7uPnlGz0+ scenes-app-events-mcp-tool-calls--mcp-tool-calls--dark:+ hash: v1.k794b7964.8f89948ee00f8e8c0e0305f4b9238676d8eec08b6d84de93789921b56a8ed715.dfVd-_XajcLQB6QK2iwZTCRdkbf1JKplgF8Fp0Wnfag+ scenes-app-events-mcp-tool-calls--mcp-tool-calls--light:+ hash: v1.k794b7964.5f73a07c7d72524d9a2a70079c4229cba30d85f9c97c34c633d8eb7852f41707.qtaSYaBb0rIk54Hlb0by95rpE95zIdFs1MSd1bqyl7Ascenes-app-experiments--draft-experiment--dark:hash: v1.k794b7964.6d82f7386471ee5e75c8bb75a5e71bb84a033e1e6fafb0a6d86e2751d267b5de.hj4hBxL8bTZ89RrQrnpF2Iikqhvmxuc1UUxBvq7DqE0scenes-app-experiments--draft-experiment--light:@@ -5812,6 +5820,10 @@ snapshots:hash: v1.k794b7964.9226faee502bdeca6720a84e746489d9eac5dc4d102176fa3ec6622a2eb849be.NEGj0oYEiYNFJ4bowd9Z1FJpRJvKL538swXf33_kVj0scenes-app-insights-loading-messages--loading-messages--light:hash: v1.k794b7964.6e7f58555ec0ab4517c718a4062f7ec433c2f849c5870fbdf7f4a1c86c7d7462.ic0QxTM26TV5twnRajAcxcCfwKuZJbvilyt80dyUN5k+ scenes-app-insights-mcp-missing-capability--mcp-missing-capability--dark:+ hash: v1.k794b7964.b2867c1b3182e8e51696f338e626ab052764cdf7601a8a92f219ac5da6c3638d.Dx3NXLRLC1rhGxa5T7qyW63abreOxt78C5aik2e999o+ scenes-app-insights-mcp-missing-capability--mcp-missing-capability--light:+ hash: v1.k794b7964.e0d9eecd9f646fe4f7bf5fcd32f6654fd1df0b7f542a8bf6db8dd8acd4fa1b58.IrWNY-Wa_gH7_7zLJkYAxxpFS9SWygMtABDe7rgkrfoscenes-app-insights-regionmap--default--dark:hash: v1.k794b7964.1da35c2684f9c0b6ab0043c27cfa880693ad3a31bba2aaeffa101dca5427c4d7.AV2LBdDhvM_G28U2qGXNMKF8hEbKcexDdk3I7Lz4X5Mscenes-app-insights-regionmap--default--light:diff --git a/frontend/src/mocks/fixtures/api/projects/team_id/insights/mcpMissingCapability.json b/frontend/src/mocks/fixtures/api/projects/team_id/insights/mcpMissingCapability.jsonnew file mode 100644index 000000000000..8ddd3c93fd58--- /dev/null+++ b/frontend/src/mocks/fixtures/api/projects/team_id/insights/mcpMissingCapability.json@@ -0,0 +1,163 @@+{+ "id": 5101,+ "short_id": "MCPMISS",+ "name": "Missing capabilities by client",+ "derived_name": null,+ "filters": {},+ "filters_hash": "cache_mcp_missing_capability",+ "order": null,+ "deleted": false,+ "dashboard": null,+ "layouts": {},+ "color": null,+ "last_refresh": null,+ "refreshing": false,+ "result": [+ {+ "action": {+ "id": "$mcp_missing_capability",+ "type": "events",+ "order": 0,+ "name": "$mcp_missing_capability",+ "custom_name": null,+ "math": "total",+ "math_property": null,+ "math_group_type_index": null,+ "properties": {}+ },+ "label": "claude-code",+ "count": 34,+ "data": [4, 6, 5, 7, 3, 5, 4],+ "labels": ["1-Jun", "2-Jun", "3-Jun", "4-Jun", "5-Jun", "6-Jun", "7-Jun"],+ "days": ["2026-06-01", "2026-06-02", "2026-06-03", "2026-06-04", "2026-06-05", "2026-06-06", "2026-06-07"],+ "aggregated_value": 34,+ "filter": {+ "breakdown": "$mcp_client_name",+ "breakdown_type": "event",+ "date_from": "2026-06-01T00:00:00+00:00",+ "date_to": "2026-06-07T23:59:59+00:00",+ "display": "ActionsTable",+ "insight": "TRENDS",+ "interval": "day"+ },+ "breakdown_value": "claude-code"+ },+ {+ "action": {+ "id": "$mcp_missing_capability",+ "type": "events",+ "order": 0,+ "name": "$mcp_missing_capability",+ "custom_name": null,+ "math": "total",+ "math_property": null,+ "math_group_type_index": null,+ "properties": {}+ },+ "label": "cursor",+ "count": 18,+ "data": [2, 3, 2, 4, 1, 3, 3],+ "labels": ["1-Jun", "2-Jun", "3-Jun", "4-Jun", "5-Jun", "6-Jun", "7-Jun"],+ "days": ["2026-06-01", "2026-06-02", "2026-06-03", "2026-06-04", "2026-06-05", "2026-06-06", "2026-06-07"],+ "aggregated_value": 18,+ "filter": {+ "breakdown": "$mcp_client_name",+ "breakdown_type": "event",+ "date_from": "2026-06-01T00:00:00+00:00",+ "date_to": "2026-06-07T23:59:59+00:00",+ "display": "ActionsTable",+ "insight": "TRENDS",+ "interval": "day"+ },+ "breakdown_value": "cursor"+ },+ {+ "action": {+ "id": "$mcp_missing_capability",+ "type": "events",+ "order": 0,+ "name": "$mcp_missing_capability",+ "custom_name": null,+ "math": "total",+ "math_property": null,+ "math_group_type_index": null,+ "properties": {}+ },+ "label": "codex-cli",+ "count": 9,+ "data": [1, 2, 1, 2, 0, 2, 1],+ "labels": ["1-Jun", "2-Jun", "3-Jun", "4-Jun", "5-Jun", "6-Jun", "7-Jun"],+ "days": ["2026-06-01", "2026-06-02", "2026-06-03", "2026-06-04", "2026-06-05", "2026-06-06", "2026-06-07"],+ "aggregated_value": 9,+ "filter": {+ "breakdown": "$mcp_client_name",+ "breakdown_type": "event",+ "date_from": "2026-06-01T00:00:00+00:00",+ "date_to": "2026-06-07T23:59:59+00:00",+ "display": "ActionsTable",+ "insight": "TRENDS",+ "interval": "day"+ },+ "breakdown_value": "codex-cli"+ }+ ],+ "created_at": "2026-06-07T06:00:00.000000Z",+ "created_by": {+ "id": 1,+ "uuid": "017f7913-c1ee-0000-faff-0fe5ace3849a",+ "distinct_id": "Q1OD2NmnqqbqrLR45mYm2p1VNNbSO9DBFsMig90GWkK",+ "first_name": "Paul",+ "email": "[email protected]"+ },+ "description": "",+ "updated_at": "2026-06-07T06:00:00.000000Z",+ "tags": [],+ "favorited": false,+ "saved": true,+ "last_modified_at": "2026-06-07T06:00:00.000000Z",+ "last_modified_by": {+ "id": 1,+ "uuid": "017f7913-c1ee-0000-faff-0fe5ace3849a",+ "distinct_id": "Q1OD2NmnqqbqrLR45mYm2p1VNNbSO9DBFsMig90GWkK",+ "first_name": "Paul",+ "email": "[email protected]"+ },+ "is_sample": false,+ "query": {+ "kind": "InsightVizNode",+ "source": {+ "kind": "TrendsQuery",+ "series": [+ {+ "kind": "EventsNode",+ "event": "$mcp_missing_capability",+ "name": "$mcp_missing_capability",+ "math": "total"+ }+ ],+ "interval": "day",+ "dateRange": {+ "date_from": "2026-06-01",+ "date_to": "2026-06-07"+ },+ "breakdownFilter": {+ "breakdown": "$mcp_client_name",+ "breakdown_type": "event"+ },+ "trendsFilter": {+ "display": "ActionsTable"+ },+ "properties": {+ "type": "AND",+ "values": [+ {+ "type": "AND",+ "values": []+ }+ ]+ },+ "version": 2+ },+ "full": true+ }+}diff --git a/frontend/src/scenes/activity/explore/MCPEvents.stories.tsx b/frontend/src/scenes/activity/explore/MCPEvents.stories.tsxnew file mode 100644index 000000000000..5f39d02de9e3--- /dev/null+++ b/frontend/src/scenes/activity/explore/MCPEvents.stories.tsx@@ -0,0 +1,260 @@+import { Meta, StoryObj } from '@storybook/react'+import { combineUrl } from 'kea-router'++import { App } from 'scenes/App'+import { urls } from 'scenes/urls'++import { mswDecorator } from '~/mocks/browser'+import { NodeKind } from '~/queries/schema/schema-general'+import { ActivityTab } from '~/types'++interface MCPCall {+ uuid: string+ distinctId: string+ timestamp: string+ tool: string+ client: string+ isError: boolean+ durationMs: number+ intent: string+ intentSource: string+ server: string+ conversationId: string+ sessionId: string+ parameters: Record<string, any>+ response: Record<string, any>+ errorMessage?: string+}++const CALLS: MCPCall[] = [+ {+ uuid: '0193f2a1-0000-0000-0000-000000000001',+ distinctId: '[email protected]',+ timestamp: '2026-06-07T10:04:42Z',+ tool: 'execute-sql',+ client: 'claude-code/1.2.0',+ isError: true,+ durationMs: 610000,+ intent: 'Retry the tuned dashboard query after the first attempt timed out.',+ intentSource: 'tool_argument',+ server: 'posthog',+ conversationId: 'conv-7f3a',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000001',+ parameters: { query: 'SELECT count() FROM events WHERE ...' },+ response: {},+ errorMessage: 'Estimated query execution time is too long (max_execution_time=600)',+ },+ {+ uuid: '0193f2a1-0000-0000-0000-000000000002',+ distinctId: '[email protected]',+ timestamp: '2026-06-07T10:01:10Z',+ tool: 'execute-sql',+ client: 'claude-code/1.2.0',+ isError: false,+ durationMs: 8125,+ intent: 'Run the slow dashboard query with EXPLAIN to find the bottleneck.',+ intentSource: 'tool_argument',+ server: 'posthog',+ conversationId: 'conv-7f3a',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000001',+ parameters: { query: 'EXPLAIN SELECT ...' },+ response: { rows: 1 },+ },+ {+ uuid: '0193f2a1-0000-0000-0000-000000000003',+ distinctId: '[email protected]',+ timestamp: '2026-06-07T10:00:05Z',+ tool: 'read-data-schema',+ client: 'claude-code/1.2.0',+ isError: false,+ durationMs: 420,+ intent: 'Look up the events schema before writing SQL.',+ intentSource: 'tool_argument',+ server: 'posthog',+ conversationId: 'conv-7f3a',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000001',+ parameters: { table: 'events' },+ response: { columns: 42 },+ },+ {+ uuid: '0193f2a1-0000-0000-0000-000000000004',+ distinctId: '[email protected]',+ timestamp: '2026-06-07T09:31:30Z',+ tool: 'query-trends',+ client: 'cursor-vscode/0.42',+ isError: false,+ durationMs: 2122,+ intent: 'Chart weekly active users for the last quarter.',+ intentSource: 'intent_fallback',+ server: 'posthog',+ conversationId: 'conv-9b21',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000002',+ parameters: { events: ['$pageview'] },+ response: { series: 1 },+ },+ {+ uuid: '0193f2a1-0000-0000-0000-000000000005',+ distinctId: '[email protected]',+ timestamp: '2026-06-07T09:30:55Z',+ tool: 'insight-create',+ client: 'cursor-vscode/0.42',+ isError: false,+ durationMs: 727,+ intent: 'Save the weekly active users trend as an insight.',+ intentSource: 'tool_argument',+ server: 'posthog',+ conversationId: 'conv-9b21',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000002',+ parameters: { name: 'WAU' },+ response: { short_id: 'aBcD1234' },+ },+ {+ uuid: '0193f2a1-0000-0000-0000-000000000006',+ distinctId: 'codex-runner',+ timestamp: '2026-06-07T08:17:40Z',+ tool: 'exec',+ client: 'codex-cli',+ isError: false,+ durationMs: 2290,+ intent: 'Run the test suite for the checkout service.',+ intentSource: 'intent_fallback',+ server: 'filesystem',+ conversationId: 'conv-4c08',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000003',+ parameters: { command: 'pnpm test checkout' },+ response: { exit_code: 0 },+ },+ {+ uuid: '0193f2a1-0000-0000-0000-000000000007',+ distinctId: 'codex-runner',+ timestamp: '2026-06-07T08:15:12Z',+ tool: 'feature-flag-list',+ client: 'codex-cli',+ isError: false,+ durationMs: 510,+ intent: 'List active feature flags before editing the rollout.',+ intentSource: 'tool_argument',+ server: 'posthog',+ conversationId: 'conv-4c08',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000003',+ parameters: {},+ response: { count: 18 },+ },+ {+ uuid: '0193f2a1-0000-0000-0000-000000000008',+ distinctId: '[email protected]',+ timestamp: '2026-06-07T07:48:03Z',+ tool: 'cohort-create',+ client: 'claude-ai',+ isError: false,+ durationMs: 1620,+ intent: 'Build a cohort of users who hit the new pricing page.',+ intentSource: 'tool_argument',+ server: 'posthog',+ conversationId: 'conv-1d77',+ sessionId: '0193f2a1-aaaa-bbbb-cccc-000000000004',+ parameters: { name: 'Pricing page visitors' },+ response: { id: 91 },+ },+]++const COLUMNS = [+ '*',+ 'event',+ 'properties.$mcp_tool_name -- Tool',+ 'properties.$mcp_client_name -- Client',+ 'properties.$mcp_is_error -- Error',+ 'properties.$mcp_duration_ms -- Duration (ms)',+ 'timestamp',+]++function toRow(call: MCPCall): any[] {+ const properties: Record<string, any> = {+ $mcp_tool_name: call.tool,+ $mcp_intent: call.intent,+ $mcp_intent_source: call.intentSource,+ $mcp_is_error: call.isError,+ $mcp_duration_ms: call.durationMs,+ $mcp_client_name: call.client,+ $mcp_server_name: call.server,+ $mcp_parameters: call.parameters,+ $mcp_response: call.response,+ $mcp_conversation_id: call.conversationId,+ $session_id: call.sessionId,+ }+ if (call.errorMessage) {+ properties.$mcp_error_message = call.errorMessage+ }+ const event = {+ uuid: call.uuid,+ event: 'mcp_tool_call',+ distinct_id: call.distinctId,+ timestamp: call.timestamp,+ properties,+ elements_chain: '',+ }+ // Derive the row tuple from COLUMNS so reordering the columns can't silently desync the mock.+ const valueByColumn: Record<string, any> = {+ '*': event,+ event: 'mcp_tool_call',+ 'properties.$mcp_tool_name -- Tool': call.tool,+ 'properties.$mcp_client_name -- Client': call.client,+ 'properties.$mcp_is_error -- Error': call.isError,+ 'properties.$mcp_duration_ms -- Duration (ms)': call.durationMs,+ timestamp: call.timestamp,+ }+ return COLUMNS.map((column) => valueByColumn[column])+}++const mcpEventsResponse = {+ columns: COLUMNS,+ types: [+ 'Tuple',+ 'String',+ 'Nullable(String)',+ 'Nullable(String)',+ 'Nullable(Boolean)',+ 'Nullable(Int64)',+ "DateTime64(6, 'UTC')",+ ],+ hasMore: false,+ results: CALLS.map(toRow),+}++const mcpQuery = {+ kind: NodeKind.DataTableNode,+ full: true,+ source: {+ kind: NodeKind.EventsQuery,+ select: COLUMNS,+ event: 'mcp_tool_call',+ orderBy: ['timestamp DESC'],+ after: '-24h',+ },+ propertiesViaUrl: true,+ showSavedQueries: true,+ showPersistentColumnConfigurator: true,+}++const meta: Meta = {+ component: App,+ title: 'Scenes-App/Events/MCP Tool Calls',+ decorators: [+ mswDecorator({+ post: {+ '/api/environments/:team_id/query/:kind': mcpEventsResponse,+ },+ }),+ ],+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ mockDate: '2026-06-07T12:00:00Z',+ pageUrl: combineUrl(urls.activity(ActivityTab.ExploreEvents), {}, { q: mcpQuery }).url,+ testOptions: { waitForSelector: '.DataTable td' },+ },+}+export default meta++type Story = StoryObj<{}>+export const MCPToolCalls: Story = {}diff --git a/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsxnew file mode 100644index 000000000000..de4f4c6fa44d--- /dev/null+++ b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx@@ -0,0 +1,124 @@+import { Decorator, Meta, StoryObj } from '@storybook/react'+import { useEffect, useRef } from 'react'++import { App } from 'scenes/App'+import { urls } from 'scenes/urls'++import { mswDecorator } from '~/mocks/browser'+import { AccessControlLevel, AccessControlResourceType } from '~/types'++// The SQL editor scene gates on warehouse-objects access; grant it on the storybook app context+// before the story mounts and restore the original on unmount so story order can't leak.+const grantWarehouseAccess: Decorator = function GrantWarehouseAccess(Story): JSX.Element {+ const appContext = (window as any).POSTHOG_APP_CONTEXT+ const original = useRef<{ value: unknown }>()+ if (appContext && !original.current) {+ original.current = { value: appContext.resource_access_control }+ appContext.resource_access_control = {+ ...appContext.resource_access_control,+ [AccessControlResourceType.WarehouseObjects]: AccessControlLevel.Editor,+ }+ }+ useEffect(+ () => () => {+ if (appContext && original.current) {+ appContext.resource_access_control = original.current.value+ }+ },+ [appContext]+ )+ return <Story />+}++// Top tools per server — mirrors the first recipe in the MCP analytics docs (queries.mdx).+const SAMPLE_SQL = `SELECT+ properties.$mcp_server_name AS server,+ properties.$mcp_tool_name AS tool,+ count() AS calls,+ round(avg(toFloat(properties.$mcp_duration_ms))) AS avg_duration_ms,+ countIf(toBool(properties.$mcp_is_error)) AS errors+FROM events+WHERE event = 'mcp_tool_call' AND timestamp > now() - INTERVAL 7 DAY+GROUP BY server, tool+ORDER BY calls DESC+LIMIT 20`++// Mock results for the "top tools per server" query. The visual-regression snapshot captures the+// editor with the query pre-loaded but NOT run (driving Run in the snapshot races the async query+// against Storybook's story-prepare step and flakes). These results back the query when a human+// presses Run locally — that's how the doc screenshot with a populated grid was captured.+const SQL_RESULTS = {+ columns: ['server', 'tool', 'calls', 'avg_duration_ms', 'errors'],+ types: ['String', 'String', 'UInt64', 'Float64', 'UInt64'],+ hasMore: false,+ results: [+ ['posthog', 'execute-sql', 1480, 3525, 144],+ ['posthog', 'read-data-schema', 760, 1298, 3],+ ['posthog', 'query-trends', 540, 2122, 5],+ ['posthog', 'insight-create', 410, 727, 8],+ ['posthog', 'dashboard-create', 260, 940, 2],+ ['posthog', 'feature-flag-list', 180, 510, 1],+ ['posthog', 'cohort-create', 95, 1620, 6],+ ['filesystem', 'exec', 5200, 2290, 208],+ ['filesystem', 'read-file', 980, 180, 3],+ ['filesystem', 'write-file', 420, 240, 11],+ ],+}++// The empty-warehouse notice in the sidebar renders a SourceIcon per provider, each of which shows a+// LemonSkeleton until availableSourcesLogic resolves. Without this mock the skeletons never settle and+// the visual-regression runner times out waiting for loaders to disappear.+const AVAILABLE_SOURCES = {+ Postgres: { name: 'Postgres', iconPath: '/static/services/postgres.png', fields: [], caption: '', featured: true },+ Stripe: { name: 'Stripe', iconPath: '/static/services/stripe.png', fields: [], caption: '', featured: true },+ GoogleAds: {+ name: 'GoogleAds',+ iconPath: '/static/services/google-ads.png',+ fields: [],+ caption: '',+ featured: true,+ },+}++const meta: Meta = {+ component: App,+ title: 'Scenes-App/Data Warehouse/SQL Editor',+ decorators: [+ grantWarehouseAccess,+ mswDecorator({+ get: {+ '/api/environments/:team_id/external_data_sources/wizard': () => [200, AVAILABLE_SOURCES],+ },+ post: {+ '/api/environments/:team_id/query/:kind': async ({ request }) => {+ const body = (await request.json()) as Record<string, any>+ const kind = body?.query?.kind+ if (kind === 'DatabaseSchemaQuery') {+ return [200, { tables: {} }]+ }+ if (kind === 'HogQLMetadata') {+ return [200, { errors: [], warnings: [], notices: [], isValid: true }]+ }+ return [200, SQL_RESULTS]+ },+ },+ }),+ ],+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ mockDate: '2026-06-07',+ // open_query pre-fills the editor with SAMPLE_SQL but does not auto-run it, so the snapshot+ // captures the loaded query with an empty results pane. (SQL_RESULTS backs the query when Run+ // is pressed locally — see its comment.)+ pageUrl: urls.sqlEditor({ query: SAMPLE_SQL }),+ testOptions: {+ waitForSelector: '.monaco-editor',+ viewport: { width: 1600, height: 900 },+ },+ },+}+export default meta++type Story = StoryObj<{}>+export const TopToolsPerServer: Story = {}diff --git a/frontend/src/scenes/insights/stories/MCPMissingCapability.stories.tsx b/frontend/src/scenes/insights/stories/MCPMissingCapability.stories.tsxnew file mode 100644index 000000000000..e568096efe8b--- /dev/null+++ b/frontend/src/scenes/insights/stories/MCPMissingCapability.stories.tsx@@ -0,0 +1,43 @@+import { samplePersonProperties } from 'scenes/insights/__mocks__/insight.mocks'++import { Meta, StoryObj } from '@storybook/react'++import { createInsightStory } from 'scenes/insights/__mocks__/createInsightScene'++import { mswDecorator } from '~/mocks/browser'++import __mcpMissingCapability from '../../../mocks/fixtures/api/projects/team_id/insights/mcpMissingCapability.json'++type Story = StoryObj<{}>+const meta: Meta = {+ title: 'Scenes-App/Insights/MCP Missing Capability',+ parameters: {+ layout: 'fullscreen',+ testOptions: {+ snapshotBrowsers: ['chromium'],+ viewport: {+ width: 1300,+ height: 720,+ },+ },+ viewMode: 'story',+ mockDate: '2026-06-07T12:00:00Z',+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/environments/:team_id/persons/properties': samplePersonProperties,+ '/api/projects/:team_id/groups_types': [],+ },+ post: {+ '/api/projects/:team_id/cohorts/': { id: 1 },+ },+ }),+ ],+}+export default meta++export const MCPMissingCapability: Story = createInsightStory(__mcpMissingCapability as any)+MCPMissingCapability.parameters = {+ testOptions: { waitForSelector: '[data-attr=insights-table-graph] td' },+}diff --git a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsxindex 90ea1ee9eed1..c9a8e2227e92 100644--- a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx+++ b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx@@ -30,6 +30,34 @@ const TOOL_RESULTS = [['cohort-create', 95, 6, 6.3, 1620],]+// One [day, calls, errors] table drives both time-series charts so they agree with+// each other and with KPI_RESULTS' daily tool_calls/errors by construction.+const DAILY_TOTALS: [string, number, number][] = [+ ['2026-05-31', 4200, 145],+ ['2026-06-01', 4300, 150],+ ['2026-06-02', 4500, 165],+ ['2026-06-03', 4720, 158],+ ['2026-06-04', 4600, 170],+ ['2026-06-05', 4900, 182],+ ['2026-06-06', 5100, 176],+ ['2026-06-07', 5300, 168],+]++const ACTIVITY_RESULTS = DAILY_TOTALS.map(([day, calls, errors]) => [day, calls - errors, errors])++const TOOL_DAILY_SHARES: [string, number][] = [+ ['exec', 0.58],+ ['execute-sql', 0.17],+ ['read-data-schema', 0.085],+ ['query-trends', 0.06],+ ['insight-create', 0.046],+ ['dashboard-create', 0.029],+]++const TOOL_DAILY_RESULTS = DAILY_TOTALS.flatMap(([day, calls]) =>+ TOOL_DAILY_SHARES.map(([tool, share]) => [day, tool, Math.round(calls * share)])+)+const SESSION_RESULTS = [['0193f2a1-aaaa-bbbb-cccc-000000000001', 42, 18, 42.9, 610, 7, '2026-06-07T10:00:00Z'],['0193f2a1-aaaa-bbbb-cccc-000000000002', 6, 6, 100.0, 95, 2, '2026-06-07T09:30:00Z'],@@ -335,6 +363,12 @@ const meta: Meta = {if (query.includes('count() AS calls') && query.includes('GROUP BY category')) {return [200, { results: CATEGORY_COUNTS }]}+ if (query.includes('AS successes')) {+ return [200, { results: ACTIVITY_RESULTS }]+ }+ if (query.includes('GROUP BY day, tool')) {+ return [200, { results: TOOL_DAILY_RESULTS }]+ }if (query.includes('p95_duration_ms')) {return [200, { results: TOOL_RESULTS }]}@@ -349,7 +383,7 @@ const meta: Meta = {parameters: {layout: 'fullscreen',viewMode: 'story',- mockDate: '2026-06-07',+ mockDate: '2026-06-07T12:00:00Z',pageUrl: urls.mcpAnalyticsDashboard(),featureFlags: [FEATURE_FLAGS.MCP_ANALYTICS],},