: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-analytics): event-gated onboarding into the wizard flow (#66237)
Lucas Faria8d5e03b613fd
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 71f17e5d024b..a767f23b0c20 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -31942,6 +31942,7 @@"logs","marketing_analytics","max",+ "mcp_analytics","mobile_replay","notebooks","persons",diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.tsindex b34e43bd2ab5..dc5087e17365 100644--- a/frontend/src/queries/schema/schema-general.ts+++ b/frontend/src/queries/schema/schema-general.ts@@ -7666,6 +7666,7 @@ export enum ProductKey {LOGS = 'logs',MARKETING_ANALYTICS = 'marketing_analytics',MAX = 'max',+ MCP_ANALYTICS = 'mcp_analytics',MOBILE_REPLAY = 'mobile_replay',NOTEBOOKS = 'notebooks',PERSONS = 'persons',diff --git a/frontend/src/scenes/onboarding/legacy/stepProviderRegistry.ts b/frontend/src/scenes/onboarding/legacy/stepProviderRegistry.tsindex 0a2b217d19eb..a4d9c8e0979b 100644--- a/frontend/src/scenes/onboarding/legacy/stepProviderRegistry.ts+++ b/frontend/src/scenes/onboarding/legacy/stepProviderRegistry.ts@@ -6,6 +6,7 @@ import { errorTrackingOnboarding } from 'products/error_tracking/frontend/onboarimport { experimentsOnboarding } from 'products/experiments/frontend/onboarding/steps'import { featureFlagsOnboarding } from 'products/feature_flags/frontend/onboarding/steps'import { logsOnboarding } from 'products/logs/frontend/onboarding/steps'+import { mcpAnalyticsOnboarding } from 'products/mcp_analytics/frontend/onboarding/steps'import { productAnalyticsOnboarding } from 'products/product_analytics/frontend/onboarding/steps'import { sessionReplayOnboarding } from 'products/session_replay/frontend/onboarding/steps'import { surveysOnboarding } from 'products/surveys/frontend/onboarding/steps'@@ -36,4 +37,5 @@ export const onboardingProviderRegistry: Partial<Record<ProductKey, ProductOnboa[ProductKey.AI_OBSERVABILITY]: aiObservabilityOnboarding,[ProductKey.WORKFLOWS]: workflowsOnboarding,[ProductKey.LOGS]: logsOnboarding,+ [ProductKey.MCP_ANALYTICS]: mcpAnalyticsOnboarding,}diff --git a/frontend/src/scenes/onboarding/shared/utils.tsx b/frontend/src/scenes/onboarding/shared/utils.tsxindex 07cdae9778f6..d9c4bd4e804e 100644--- a/frontend/src/scenes/onboarding/shared/utils.tsx+++ b/frontend/src/scenes/onboarding/shared/utils.tsx@@ -313,4 +313,21 @@ export const availableOnboardingProducts: AvailableOnboardingProducts = {scene: Scene.Logs,setupEffort: 'low',},+ [ProductKey.MCP_ANALYTICS]: {+ name: 'MCP analytics',+ description: 'See how AI agents use your MCP server — tool calls, intent, and failures',+ userCentricDescription: 'Understand how agents actually use your MCP tools',+ capabilities: ['Tool call tracking', 'Agent intent clustering', 'Error & latency monitoring'],+ valueProps: [+ { title: 'Every tool call', problem: 'See exactly what the agent sent, got back, and how long it took' },+ { title: 'Agent intent', problem: 'Know what agents were trying to do, not just which tools they ran' },+ { title: 'Failures & gaps', problem: 'Catch failing tools and capabilities agents wish you had' },+ ],+ hedgehog: RobotHog,+ icon: 'IconLlmAnalytics',+ iconColor: 'rgb(182 42 217)',+ url: urls.mcpAnalyticsDashboard(),+ scene: Scene.MCPAnalytics,+ setupEffort: 'low',+ },}diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.tsindex b3fcfa263934..248d28eafbbf 100644--- a/frontend/src/scenes/sceneTypes.ts+++ b/frontend/src/scenes/sceneTypes.ts@@ -198,6 +198,7 @@ export enum Scene {AIObservabilityTrace = 'AIObservabilityTrace',AIObservabilityUsers = 'AIObservabilityUsers',Logs = 'Logs',+ MCPAnalytics = 'MCPAnalytics',LogsAlertDetail = 'LogsAlertDetail',LogsAlertNotificationDetail = 'LogsAlertNotificationDetail',LogsSamplingNew = 'LogsSamplingNew',diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex c398c0b67eab..3da60c0ca0cd 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -6830,7 +6830,8 @@ export type AvailableOnboardingProducts = Record<| ProductKey.ERROR_TRACKING| ProductKey.AI_OBSERVABILITY| ProductKey.WORKFLOWS- | ProductKey.LOGS,+ | ProductKey.LOGS+ | ProductKey.MCP_ANALYTICS,OnboardingProduct>diff --git a/posthog/schema_enums.py b/posthog/schema_enums.pyindex dd5e060c700f..9552369fed6e 100644--- a/posthog/schema_enums.py+++ b/posthog/schema_enums.py@@ -2752,6 +2752,7 @@ class ProductKey(StrEnum):LOGS = "logs"MARKETING_ANALYTICS = "marketing_analytics"MAX = "max"+ MCP_ANALYTICS = "mcp_analytics"MOBILE_REPLAY = "mobile_replay"NOTEBOOKS = "notebooks"PERSONS = "persons"diff --git a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsxindex 98995e048ec2..90ea1ee9eed1 100644--- a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx+++ b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx@@ -313,6 +313,11 @@ const meta: Meta = {if (body?.query?.kind === 'MCPHarnessBreakdownQuery') {return [200, { results: HARNESS_RESULTS }]}+ // Onboarding gate: report the project as instrumented so the scene+ // renders the dashboard/tabs instead of the empty state.+ if (query.includes('has_initialize')) {+ return [200, { results: [[true, true]] }]+ }if (query.includes('AS session_id')) {return [200, { results: SESSION_RESULTS }]}diff --git a/products/mcp_analytics/frontend/MCPAnalyticsOnboarding.tsx b/products/mcp_analytics/frontend/MCPAnalyticsOnboarding.tsxnew file mode 100644index 000000000000..e9a5bd46072c--- /dev/null+++ b/products/mcp_analytics/frontend/MCPAnalyticsOnboarding.tsx@@ -0,0 +1,76 @@+import { LemonButton, Spinner } from '@posthog/lemon-ui'++import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'+import { DetectiveHog, WavingHog } from 'lib/components/hedgehogs'++import type { MCPOnboardingState } from './mcpAnalyticsOnboardingLogic'+import {+ MCP_ANALYTICS_DOCS_URL,+ MCPAnalyticsInstallHero,+ MCPListeningIndicator,+ useMCPAnalyticsWizardCommand,+} from './onboarding/MCPAnalyticsInstall'++/** Branded loading state shown while we work out whether the project has MCP events yet. */+export function MCPAnalyticsLoading(): JSX.Element {+ return (+ <div className="flex flex-col items-center justify-center gap-4 py-20 text-center">+ <DetectiveHog className="w-32 h-32" />+ <div className="flex items-center gap-2 text-secondary">+ <Spinner />+ <span>Checking for MCP activity…</span>+ </div>+ </div>+ )+}++/**+ * Shown once the server is wired up (`$mcp_initialize` seen) but no tool call has landed yet.+ * They're already instrumented, so the hero is "make a tool call" + the live indicator; the+ * wizard command is demoted to a secondary "instrument another server" affordance.+ */+function ConnectedNoCalls(): JSX.Element {+ const { command, isCloudOrDev } = useMCPAnalyticsWizardCommand()++ return (+ <div className="flex flex-col items-center text-center gap-6 py-12 max-w-xl mx-auto">+ <WavingHog className="w-32 h-32" />+ <div className="space-y-2">+ <h2 className="text-2xl font-bold">You're connected — now make a tool call</h2>+ <p className="text-muted m-0">+ We've seen your MCP server connect, but it hasn't handled a tool call yet. Trigger a tool from your+ agent and this page fills in on its own.+ </p>+ </div>+ <MCPListeningIndicator />+ {isCloudOrDev && (+ <div className="w-full flex flex-col items-center gap-2 pt-2">+ <p className="text-xs text-muted m-0">Instrumenting another server? Re-run setup:</p>+ <CommandBlock+ command={command}+ copyLabel="MCP wizard command"+ ariaLabel="Copy MCP analytics wizard command"+ size="sm"+ className="bg-bg-light border border-border"+ />+ </div>+ )}+ <LemonButton type="tertiary" size="small" to={MCP_ANALYTICS_DOCS_URL} targetBlank>+ Read the docs+ </LemonButton>+ </div>+ )+}++/** Shown until the project captures its first `$mcp_tool_call`. Tailors by signal state. */+export function MCPAnalyticsOnboarding({ state }: { state: Exclude<MCPOnboardingState, 'onboarded'> }): JSX.Element {+ if (state === 'connected-no-calls') {+ return <ConnectedNoCalls />+ }+ // not-instrumented: lead with the full install hero — same treatment as the onboarding page.+ return (+ <div className="py-8">+ <MCPAnalyticsInstallHero />+ </div>+ )+}diff --git a/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx b/products/mcp_analytics/frontend/MCPAnalyticsScene.tsxindex 475e06dff8c4..170824796f05 100644--- a/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx+++ b/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx@@ -11,6 +11,8 @@ import { SceneExport } from '~/scenes/sceneTypes'import { MCPAnalyticsClustering } from './clustering/MCPAnalyticsClustering'import { MCPAnalyticsDashboard } from './MCPAnalyticsDashboard'+import { MCPAnalyticsLoading, MCPAnalyticsOnboarding } from './MCPAnalyticsOnboarding'+import { mcpAnalyticsOnboardingLogic } from './mcpAnalyticsOnboardingLogic'import { MCPAnalyticsTab, TAB_DESCRIPTIONS, mcpAnalyticsSceneLogic } from './mcpAnalyticsSceneLogic'import { MCPAnalyticsToolQuality } from './MCPAnalyticsToolQuality'import { MCPSessionsPlaylist } from './sessions/MCPSessionsPlaylist'@@ -25,6 +27,7 @@ const DEFAULT_DOCS_URL = 'https://posthog.com/docs/mcp-analytics/installation'export function MCPAnalyticsScene(): JSX.Element {const { searchParams } = useValues(router)const { activeTab } = useValues(mcpAnalyticsSceneLogic)+ const { onboardingState, signals } = useValues(mcpAnalyticsOnboardingLogic)const tabs: LemonTab<MCPAnalyticsTab>[] = [{@@ -61,7 +64,7 @@ export function MCPAnalyticsScene(): JSX.Element {<SceneContent><SceneTitleSectionname="MCP analytics"- description={TAB_DESCRIPTIONS[activeTab]}+ description={onboardingState === 'onboarded' ? TAB_DESCRIPTIONS[activeTab] : null}resourceType={{ type: 'llm_analytics' }}actions={<LemonButton to={DEFAULT_DOCS_URL} type="secondary" targetBlank size="small">@@ -69,7 +72,16 @@ export function MCPAnalyticsScene(): JSX.Element {</LemonButton>}/>- <LemonTabs activeKey={activeTab} data-attr="mcp-analytics-tabs" tabs={tabs} sceneInset />+ {/* `signals === null` means we don't know yet — still loading, or a transient+ query failure. Hold the skeleton rather than falling through to the empty+ dashboard (the very state this onboarding exists to avoid); the 20s poll retries. */}+ {signals === null ? (+ <MCPAnalyticsLoading />+ ) : onboardingState && onboardingState !== 'onboarded' ? (+ <MCPAnalyticsOnboarding state={onboardingState} />+ ) : (+ <LemonTabs activeKey={activeTab} data-attr="mcp-analytics-tabs" tabs={tabs} sceneInset />+ )}</SceneContent>)}diff --git a/products/mcp_analytics/frontend/mcpAnalyticsOnboardingLogic.ts b/products/mcp_analytics/frontend/mcpAnalyticsOnboardingLogic.tsnew file mode 100644index 000000000000..b968896a2427--- /dev/null+++ b/products/mcp_analytics/frontend/mcpAnalyticsOnboardingLogic.ts@@ -0,0 +1,89 @@+import { afterMount, kea, listeners, path, selectors } from 'kea'+import { loaders } from 'kea-loaders'++import api from 'lib/api'++import { HogQLQueryResponse, NodeKind } from '~/queries/schema/schema-general'++import type { mcpAnalyticsOnboardingLogicType } from './mcpAnalyticsOnboardingLogicType'++export type MCPOnboardingState = 'not-instrumented' | 'connected-no-calls' | 'onboarded'++export interface MCPOnboardingSignals {+ /** A client has completed the MCP handshake — proves the SDK wrap is live. */+ hasInitialize: boolean+ /** A tool has actually been called — the server is in use. */+ hasToolCall: boolean+}++// Two-signal funnel over all history. `$mcp_initialize` fires when an agent+// connects (before any tool call), so it distinguishes "instrumented but no+// traffic yet" from "not instrumented at all" — without it, a freshly-wired+// server that hasn't been called looks identical to one that was never set up.+// Filtering on the two event names hits the events sort key, so this stays cheap.+const ONBOARDING_SIGNAL_QUERY = `+SELECT+ countIf(event = '$mcp_initialize') > 0 AS has_initialize,+ countIf(event = '$mcp_tool_call') > 0 AS has_tool_call+FROM events+WHERE event IN ('$mcp_initialize', '$mcp_tool_call')+`++// While the user is still onboarding we re-check on a timer so the page flips to+// the dashboard on its own the moment the first events land. The disposables+// plugin pauses this on hidden tabs and tears it down on unmount.+const POLL_INTERVAL_MS = 20000++export const mcpAnalyticsOnboardingLogic = kea<mcpAnalyticsOnboardingLogicType>([+ path(['products', 'mcp_analytics', 'frontend', 'mcpAnalyticsOnboardingLogic']),+ loaders({+ signals: {+ __default: null as MCPOnboardingSignals | null,+ loadSignals: async (_: void, breakpoint): Promise<MCPOnboardingSignals> => {+ const response = (await api.query({+ kind: NodeKind.HogQLQuery,+ query: ONBOARDING_SIGNAL_QUERY,+ })) as HogQLQueryResponse+ breakpoint()+ const row = (response?.results?.[0] as unknown[] | undefined) ?? []+ // ClickHouse returns the `> 0` comparisons as 0/1; coerce numerically so a+ // stringified "0" can never read as truthy (Boolean("0") would).+ const truthy = (value: unknown): boolean => Number(value) > 0+ return { hasInitialize: truthy(row[0]), hasToolCall: truthy(row[1]) }+ },+ },+ }),+ selectors({+ onboardingState: [+ (s) => [s.signals],+ (signals): MCPOnboardingState | null => {+ if (!signals) {+ return null+ }+ if (signals.hasToolCall) {+ return 'onboarded'+ }+ if (signals.hasInitialize) {+ return 'connected-no-calls'+ }+ return 'not-instrumented'+ },+ ],+ isOnboarded: [(s) => [s.onboardingState], (onboardingState): boolean => onboardingState === 'onboarded'],+ }),+ listeners(({ values, cache }) => ({+ loadSignalsSuccess: () => {+ // Once tool calls show up the gate flips for good — stop polling.+ if (values.isOnboarded) {+ cache.disposables.dispose('poll')+ }+ },+ })),+ afterMount(({ actions, cache }) => {+ actions.loadSignals()+ cache.disposables.add(() => {+ const id = window.setInterval(() => actions.loadSignals(), POLL_INTERVAL_MS)+ return () => clearInterval(id)+ }, 'poll')+ }),+])diff --git a/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.ts b/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.tsindex 15efc8aaaa47..99ec6a8b86ce 100644--- a/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.ts+++ b/products/mcp_analytics/frontend/mcpAnalyticsSceneLogic.ts@@ -1,13 +1,20 @@-import { connect, kea, path, selectors } from 'kea'+import { connect, kea, listeners, path, selectors } from 'kea'+import { router } from 'kea-router'+import { teamLogic } from 'scenes/teamLogic'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'import { sceneLogic } from '~/scenes/sceneLogic'+import { OnboardingStepKey } from '~/types'+import { mcpAnalyticsOnboardingLogic } from './mcpAnalyticsOnboardingLogic'import type { mcpAnalyticsSceneLogicType } from './mcpAnalyticsSceneLogicType'export type MCPAnalyticsTab = 'dashboard' | 'sessions' | 'tool-quality' | 'intent-clustering'export const TAB_DESCRIPTIONS: Record<MCPAnalyticsTab, string> = {- dashboard: 'Overview of your MCP usage.',+ dashboard: 'Tool call volume, error rates, and latency across your MCP server.',sessions: 'Sessions where users interacted with your MCP tools.','tool-quality': 'Understand how reliably your MCP tools support user workflows.','intent-clustering':@@ -24,7 +31,14 @@ const SCENE_KEY_TO_TAB: Record<string, MCPAnalyticsTab> = {export const mcpAnalyticsSceneLogic = kea<mcpAnalyticsSceneLogicType>([path(['products', 'mcp_analytics', 'frontend', 'mcpAnalyticsSceneLogic']),connect(() => ({- values: [sceneLogic, ['sceneKey']],+ values: [+ sceneLogic,+ ['sceneKey'],+ mcpAnalyticsOnboardingLogic,+ ['onboardingState'],+ teamLogic,+ ['currentTeam'],+ ],})),selectors({activeTab: [@@ -32,4 +46,18 @@ export const mcpAnalyticsSceneLogic = kea<mcpAnalyticsSceneLogicType>([(sceneKey: string): MCPAnalyticsTab => SCENE_KEY_TO_TAB[sceneKey] ?? 'dashboard',],}),+ listeners(({ values }) => ({+ // Send never-set-up projects straight into the polished onboarding flow,+ // rather than the bare in-scene card. Guarded on `has_completed_onboarding_for`+ // so the post-onboarding return to the dashboard doesn't bounce back here —+ // once they've been through setup we let the in-scene "waiting" state show.+ [mcpAnalyticsOnboardingLogic.actionTypes.loadSignalsSuccess]: () => {+ const completed = values.currentTeam?.has_completed_onboarding_for?.[ProductKey.MCP_ANALYTICS]+ if (values.onboardingState === 'not-instrumented' && !completed) {+ router.actions.replace(+ urls.onboarding({ productKey: ProductKey.MCP_ANALYTICS, stepKey: OnboardingStepKey.INSTALL })+ )+ }+ },+ })),])diff --git a/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx b/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsxnew file mode 100644index 000000000000..b5cdb4474d5f--- /dev/null+++ b/products/mcp_analytics/frontend/onboarding/MCPAnalyticsInstall.tsx@@ -0,0 +1,119 @@+import { useValues } from 'kea'++import { IconCheckCircle } from '@posthog/icons'+import { LemonButton, Spinner } from '@posthog/lemon-ui'++import { CommandBlock } from 'lib/components/CommandBlock/CommandBlock'+import { cn } from 'lib/utils/css-classes'+import { WIZARD_HOG_URL } from 'scenes/onboarding/legacy/sdks/OnboardingInstallStep/WizardCommandBlock'+import { useWizardCommand } from 'scenes/onboarding/shared/SetupWizardBanner'+import { teamLogic } from 'scenes/teamLogic'++import { mcpAnalyticsOnboardingLogic } from '../mcpAnalyticsOnboardingLogic'++export const MCP_ANALYTICS_DOCS_URL = 'https://posthog.com/docs/mcp-analytics'++// The shared wizard hook only emits the base command; slot in our subcommand right+// after the package reference (before any flags like `--region eu`). Matching+// `@posthog/wizard@<anything>` keeps this working if the hook ever pins a version;+// the fallback guarantees the subcommand is never silently dropped.+const WIZARD_PKG_RE = /@posthog\/wizard@\S+/++export function useMCPAnalyticsWizardCommand(): { command: string; isCloudOrDev: boolean } {+ const { wizardCommand, isCloudOrDev } = useWizardCommand()+ const { currentTeam } = useValues(teamLogic)+ const base = WIZARD_PKG_RE.test(wizardCommand)+ ? wizardCommand.replace(WIZARD_PKG_RE, '$& mcp-analytics')+ : `${wizardCommand} mcp-analytics`+ // Pin the project so the wizard targets this team directly — and, once the consent+ // screen honors the hint, pre-selects it. Harmless if the user authorizes the same project.+ const command = currentTeam?.id ? `${base} --project-id=${currentTeam.id}` : base+ return { command, isCloudOrDev }+}++/** Live "are events arriving yet?" status, driven by the same poll the scene uses. */+export function MCPListeningIndicator(): JSX.Element {+ const { onboardingState } = useValues(mcpAnalyticsOnboardingLogic)++ if (onboardingState === 'onboarded') {+ return (+ <div className="flex items-center gap-2 text-success">+ <IconCheckCircle className="text-lg" />+ <span>Tool calls are flowing — you're all set.</span>+ </div>+ )+ }+ if (onboardingState === 'connected-no-calls') {+ return (+ <div className="flex items-center gap-2 text-secondary">+ <IconCheckCircle className="text-lg text-success" />+ <span>Server connected — waiting for the first tool call…</span>+ </div>+ )+ }+ return (+ <div className="flex items-center gap-2 text-secondary">+ <Spinner />+ <span>Listening for your first MCP event…</span>+ </div>+ )+}++/**+ * The "instrument in one command" hero — heading, rainbow wizard command, project nudge, and+ * a live listening indicator. Shared by the onboarding step and the in-scene empty state so the+ * two surfaces can't drift.+ */+export function MCPAnalyticsInstallHero(): JSX.Element {+ const { command, isCloudOrDev } = useMCPAnalyticsWizardCommand()+ const { currentTeam } = useValues(teamLogic)++ return (+ <div className="w-full max-w-2xl mx-auto space-y-8">+ <div className="text-center space-y-3">+ <h2 className="text-2xl font-bold">Skip the setup. Instrument in one command.</h2>+ <p className="text-muted">+ Run this from your MCP server's project root. The wizard detects how your server is built, installs+ the <code>@posthog/mcp</code> SDK, wires up your credentials, and starts capturing every tool call,+ agent intent, and failure.+ </p>+ <p className="text-muted text-xs">LLM inference is on us, no API key needed.</p>+ </div>++ {isCloudOrDev && (+ <div className="flex items-center gap-6">+ <img+ src={WIZARD_HOG_URL}+ alt="PostHog wizard hedgehog"+ className={cn('w-28 h-28 hidden md:block shrink-0')}+ />+ <div className="flex-1 min-w-0 flex flex-col gap-3">+ <CommandBlock+ command={command}+ copyLabel="MCP wizard command"+ ariaLabel="Copy MCP analytics wizard command"+ size="md"+ decoration="rainbow"+ className="bg-bg-light border border-border hover:border-primary"+ />+ <p className="text-xs text-muted mb-0">+ {currentTeam?.name ? (+ <>+ Authorize access to <strong>{currentTeam.name}</strong> when prompted.{' '}+ </>+ ) : null}+ Then make a tool call — this page fills in the moment events arrive.+ </p>+ </div>+ </div>+ )}++ <div className="flex flex-col items-center gap-2">+ <MCPListeningIndicator />+ <LemonButton type="tertiary" size="small" to={MCP_ANALYTICS_DOCS_URL} targetBlank>+ Prefer to set it up manually? Read the docs+ </LemonButton>+ </div>+ </div>+ )+}diff --git a/products/mcp_analytics/frontend/onboarding/steps.tsx b/products/mcp_analytics/frontend/onboarding/steps.tsxnew file mode 100644index 000000000000..9e6f60511a24--- /dev/null+++ b/products/mcp_analytics/frontend/onboarding/steps.tsx@@ -0,0 +1,47 @@+import { useActions, useValues } from 'kea'+import { useEffect } from 'react'++import { onboardingLogic } from 'scenes/onboarding/legacy/onboardingLogic'+import { OnboardingStep } from 'scenes/onboarding/legacy/OnboardingStep'+import { type ProductOnboardingProvider } from 'scenes/onboarding/legacy/types'+import { urls } from 'scenes/urls'++import { ProductKey } from '~/queries/schema/schema-general'+import { OnboardingStepKey } from '~/types'++import { mcpAnalyticsOnboardingLogic } from '../mcpAnalyticsOnboardingLogic'+import { MCPAnalyticsInstallHero } from './MCPAnalyticsInstall'++function MCPAnalyticsInstallStep(): JSX.Element {+ const { onboardingState } = useValues(mcpAnalyticsOnboardingLogic)+ const { completeOnboarding } = useActions(onboardingLogic)++ // The moment tool calls start flowing the setup worked — whisk them to their data+ // instead of making them click "Go to dashboard".+ useEffect(() => {+ if (onboardingState === 'onboarded') {+ completeOnboarding()+ }+ }, [onboardingState, completeOnboarding])++ return (+ <OnboardingStep title="Install" stepKey={OnboardingStepKey.INSTALL} continueText="Go to dashboard">+ <div className="mt-6">+ <MCPAnalyticsInstallHero />+ </div>+ </OnboardingStep>+ )+}++export const mcpAnalyticsOnboarding: ProductOnboardingProvider = {+ steps: (ctx) => [+ {+ id: `${OnboardingStepKey.INSTALL}:${ProductKey.MCP_ANALYTICS}`,+ productKey: ProductKey.MCP_ANALYTICS,+ stepKey: OnboardingStepKey.INSTALL,+ role: ctx.role,+ render: () => <MCPAnalyticsInstallStep />,+ },+ ],+ completeRedirectUrl: () => urls.mcpAnalyticsDashboard(),+}