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): collect inline session usefulness feedback (#99442)

Lucas Faria2128de379bf2
diff --git a/docs/internal/mcp-analytics-feedback.md b/docs/internal/mcp-analytics-feedback.md
new file mode 100644
index 000000000000..59bba28a5c52
--- /dev/null
+++ b/docs/internal/mcp-analytics-feedback.md
@@ -0,0 +1,42 @@
+# MCP analytics session feedback
+
+The session detail panel shows a thumbs question after 30 seconds with loaded tool calls.
+Refreshing feature flags keeps an already-pending delay when the same survey remains eligible.
+Leaving the panel or hiding the tab cancels the delay; returning starts a fresh delay.
+The SDK must return an active matching survey, and capture must be enabled for a signed-in, non-impersonated user.
+Showing the prompt starts a 30-day cooldown shared across sequential placements for that user in this browser.
+Mount only one placement at a time; simultaneous placements do not synchronize their in-memory cooldowns.
+Feedback is requested in context; the page header has no general Feedback button.
+
+## Configuration and rollout
+
+`MCP_ANALYTICS_USEFULNESS_SURVEY_ID` selects an API survey with partial responses enabled and an Always schedule.
+Recurring survey iterations are not supported.
+The survey belongs to the project configured for PostHog’s own analytics SDK, not the customer project being viewed.
+Its questions must be a two-point emoji rating followed by optional open text, both with stable IDs.
+`MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT` supplies the displayed copy and placement metadata.
+Incompatible, draft, stopped, or nonmatching surveys do not start a prompt.
+The API survey can launch before deployment because it does not display itself.
+
+After deployment, verify `survey shown` events before interpreting zero responses as lack of feedback.
+Check the SDK project, targeting, survey status, and question schema if impressions are absent.
+This change needs no update to the existing header survey configuration.
+
+## Events and reporting
+
+- `survey shown` records the impression and starts the cooldown.
+- `survey sent` records the first answer immediately with `$survey_completed: false`.
+- Done or Send feedback sends the same answer and optional text with `$survey_completed: true` and the same submission ID.
+- Navigating away does not emit a dismissal or abandonment event; any partial response already captured remains.
+- `survey dismissed` records an unfinished dismissal and whether the first answer was captured. Closing the thank-you state does not count.
+
+Responses use `$survey_response_<question-id>` with `"1"` for thumbs up and `"2"` for thumbs down.
+All inline events share `$survey_submission_id`, stable question IDs, and the displayed wording in `$survey_questions`.
+They also carry `feedback_surface`, `feedback_entry_point`, `mcp_analytics_tab`, `feedback_question_version`, `feedback_question`, and `feedback_followup_question`.
+Copy is captured when the prompt appears so it stays consistent throughout the submission.
+Failed captures preserve the answer for retry; a confirmation means the SDK queued the event, not that the server received it.
+
+Count distinct submission IDs with an answer divided by distinct shown submission IDs; do not double-count partial and completed events.
+Compare placements and copy versions, and report unique viewers and organizations alongside response counts.
+The prompt adds no MCP session IDs, tool inputs, outputs, or customer end-user details.
+Reported usefulness does not establish a business outcome; assess that through follow-up conversations.
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index cb1f8040b0ef..e915b3a9c3eb 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5932,6 +5932,34 @@ snapshots:
hash: v1.k794b7964.f7bd678d57ae64d2ec9dec79e1017fbc7a916f466a56562bb387a0a4eb3a58a9.bQGrcXvT7JLVejN-8Xo7XKYa4rSc5A6C-7dkfpXHPcw
products-data-quality-overview--narrow-empty--light:
hash: v1.k794b7964.2e8bd152beae69121fee95257fd82b94845eb349372d743971a471eb3e5328cd.YgUtIxLiYjsHr0Val39OaOaf-D4S9aToLSY85dDjB4I
+ products-mcp-analytics-feedback-prompt--contextual-copy--dark:
+ hash: v1.k794b7964.b9a43443a726379620a7b8fcb5a97d6f42eb092717a96a050c1d60e4850d7f29.pqYVY5w4VqCVPWENMeYL5kO5uRWJ3YGEAh2gPbkpg_U
+ products-mcp-analytics-feedback-prompt--contextual-copy--light:
+ hash: v1.k794b7964.d065e4cb7ecb9502ba7374baaf23d2c0cc4f0885abfcb2e807b6b814e5fdd3d0.tqChEQrfpmRX7tuHb1yU-8v1NiwD-WMDKzBHOirvgEQ
+ products-mcp-analytics-feedback-prompt--default--dark:
+ hash: v1.k794b7964.7c336ecc0b0049054b4a219dea0d12091417decdbf348f9000428570bcca6167.UalRR5QQm9N4vreFdBsJT71WOiU2wexgEXUFTh332Sc
+ products-mcp-analytics-feedback-prompt--default--light:
+ hash: v1.k794b7964.31034c1d42f02bfe9b2bebdc682e55215ea07e850d6c67491b3eacfe5e63da1d.emd1QOi9CKOLMO2Zqoop0PLnSTV-MJKLYp5eiLzwQCc
+ products-mcp-analytics-feedback-prompt--error--dark:
+ hash: v1.k794b7964.43ea00d497a885cee1a088060d6063c71caec5e31ddcd41f218e4826893fc90f.lPsdl9_A1bfYbsHGGEoJR6gWVARNJPM6OZDPHfRZnfw
+ products-mcp-analytics-feedback-prompt--error--light:
+ hash: v1.k794b7964.beefdfadffc01f380f48847a22d6ff48f4de59c662452d89ef046fe842b8a00a.kLqW9aRpOe4MPm7zgiTG5KMBetV-IjwAHHNujxs3TvY
+ products-mcp-analytics-feedback-prompt--follow-up--dark:
+ hash: v1.k794b7964.08e09112a105e351a3c946616f7ce205920dd835e09c1f474f207f167bb028a9.L20lavoYUogEGAEHtKEgGHhz3shzmobQyuiN0vdevBQ
+ products-mcp-analytics-feedback-prompt--follow-up--light:
+ hash: v1.k794b7964.86318b7c48c1f262b16f6dd9fb6e78b6141060af29579b1c73dc19483bc672db.R8fr3Z_dhhF2_GgOpgbs817bo_gAiTR8auq24SMVwos
+ products-mcp-analytics-feedback-prompt--narrow--dark:
+ hash: v1.k794b7964.91731ec01042c409f3f5af0f767c5081c6272240a2598931176cabfa4e5f44a3.0GfLP70F6AkTQ5hc_kpy6wGgjls08iHbKY68vR6o3F8
+ products-mcp-analytics-feedback-prompt--narrow--light:
+ hash: v1.k794b7964.2653b8fb076027a83762f55a115bdb899cf0ce498041a1920237a93bcec13954.1c2taK6OHYkeTeFq81SaVY7Oee0The_C1Re6N6QgUeI
+ products-mcp-analytics-feedback-prompt--session-review--dark:
+ hash: v1.k794b7964.0785ac352948e1f9631f66044de7169f84f899cfafe9c4b0612df369f2006518.FzkNpLZpMEMSbh27lqWwQ9wfuFQiY692jNq5SwbwL1g
+ products-mcp-analytics-feedback-prompt--session-review--light:
+ hash: v1.k794b7964.a7714027322b53a76db06d0dff096dfe9d4030cbd05ff2aafa0d87df0a1e6a31.hK6-sKqljCeBFZSamPkfBuiC5A3TbA7XWiYcM29pOU4
+ products-mcp-analytics-feedback-prompt--thanks--dark:
+ hash: v1.k794b7964.7342cef0e28e24af505643d1ca740ddc5a2b89720335a2e4751f12933fa84e35.Usn3BixbuV7GT5ijicRpBzMkuOHdrpwoy9NryTjML_w
+ products-mcp-analytics-feedback-prompt--thanks--light:
+ hash: v1.k794b7964.b86333e1bc1e049903618c705edc9af4589ba0962efee52b6f3f44e741c4382e.TKvjgdZWMBrK_b8ZiHxup_FnbmXmoDhf94L7QrRTcl0
products-mcp-analytics-routingbar--all-variants--dark:
hash: v1.k794b7964.769a69526cf676447319f587f24ed0d2670a137098867f8d3ee87ebda3415a70.3FGS0pbxxcrZUSto8SNCNHEkxaFXH6T8shqpdg5zzlQ
products-mcp-analytics-routingbar--all-variants--light:
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7510dd476a45..cbb599887590 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3958,6 +3958,9 @@ importers:
kea-router:
specifier: 'catalog:'
version: 3.4.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ posthog-js:
+ specifier: 'catalog:'
+ version: 1.433.9(@types/[email protected])([email protected])
react:
specifier: 18.3.1
version: 18.3.1
diff --git a/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx b/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx
index 58f92064c0c6..9d4dd8b33f9e 100644
--- a/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx
+++ b/products/mcp_analytics/frontend/MCPAnalyticsScene.tsx
@@ -3,7 +3,6 @@ import { router, combineUrl } from 'kea-router'
import { LemonButton, LemonTab, LemonTabs, LemonTag } from '@posthog/lemon-ui'
-import { FeedbackSurveyButton } from 'lib/components/FeedbackSurveyButton/FeedbackSurveyButton'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -37,7 +36,6 @@ export const scene: SceneExport = {
}
const MCP_DOCS_URL = 'https://posthog.com/docs/mcp-analytics/installation'
-const MCP_ANALYTICS_FEEDBACK_SURVEY_ID = '01a04991-bc80-0000-70c5-beeea0553cd0'
export function MCPAnalyticsScene(): JSX.Element {
return (
@@ -140,19 +138,9 @@ function MCPAnalyticsSceneContent(): JSX.Element {
description={onboardingState === 'onboarded' ? TAB_DESCRIPTIONS[activeTab] : null}
resourceType={{ type: 'mcp_analytics' }}
actions={
- <>
- <FeedbackSurveyButton
- surveyId={MCP_ANALYTICS_FEEDBACK_SURVEY_ID}
- properties={{
- feedback_surface: 'mcp_analytics',
- mcp_analytics_tab: activeTab,
- }}
- data-attr="mcp-analytics-feedback-button"
- />
- <LemonButton to={MCP_DOCS_URL} type="secondary" targetBlank size="small">
- Documentation
- </LemonButton>
- </>
+ <LemonButton to={MCP_DOCS_URL} type="secondary" targetBlank size="small">
+ Documentation
+ </LemonButton>
}
/>
diff --git a/products/mcp_analytics/frontend/feedback/MCPAnalyticsFeedbackPrompt.stories.tsx b/products/mcp_analytics/frontend/feedback/MCPAnalyticsFeedbackPrompt.stories.tsx
new file mode 100644
index 000000000000..e94e8d7df6ea
--- /dev/null
+++ b/products/mcp_analytics/frontend/feedback/MCPAnalyticsFeedbackPrompt.stories.tsx
@@ -0,0 +1,164 @@
+import { Meta, StoryObj } from '@storybook/react'
+import { useValues } from 'kea'
+import posthog, { Survey, SurveyType, SurveyQuestionType } from 'posthog-js'
+import { useEffect } from 'react'
+
+import { userLogic } from 'scenes/userLogic'
+
+import { mswDecorator } from '~/mocks/browser'
+
+import { MCPSessionDetail } from '../sessions/MCPSessionDetail'
+import { MCP_ANALYTICS_USEFULNESS_SURVEY_ID, MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT } from './constants'
+import { mcpAnalyticsFeedbackLogic } from './mcpAnalyticsFeedbackLogic'
+import { MCPAnalyticsFeedbackPrompt } from './MCPAnalyticsFeedbackPrompt'
+
+const survey: Survey = {
+ id: MCP_ANALYTICS_USEFULNESS_SURVEY_ID,
+ name: 'Session usefulness',
+ type: SurveyType.API,
+ start_date: '2026-01-01T00:00:00Z',
+ feature_flag_keys: null,
+ linked_flag_key: null,
+ targeting_flag_key: null,
+ internal_targeting_flag_key: null,
+ appearance: null,
+ conditions: null,
+ end_date: null,
+ current_iteration: null,
+ current_iteration_start_date: null,
+ questions: [
+ {
+ id: 'example-choice',
+ type: SurveyQuestionType.Rating,
+ question: 'Did this session help you find what you needed?',
+ display: 'emoji',
+ scale: 2,
+ lowerBoundLabel: '',
+ upperBoundLabel: '',
+ },
+ {
+ id: 'example-detail',
+ type: SurveyQuestionType.Open,
+ question: 'What did you learn, or what was missing?',
+ optional: true,
+ },
+ ],
+}
+
+const meta: Meta<typeof MCPAnalyticsFeedbackPrompt> = {
+ title: 'Products/MCP Analytics/Feedback prompt',
+ component: MCPAnalyticsFeedbackPrompt,
+ args: { contextKey: 'example-session', prompt: MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT },
+ beforeEach: () => {
+ const { capture, onSurveysLoaded } = posthog
+ posthog.capture = () => ({ uuid: 'example-event' }) as ReturnType<typeof posthog.capture>
+ posthog.onSurveysLoaded = () => () => {}
+ return () => {
+ Object.assign(posthog, { capture, onSurveysLoaded })
+ }
+ },
+ decorators: [
+ (Story, context) => {
+ const { user } = useValues(userLogic)
+ const logic = mcpAnalyticsFeedbackLogic({
+ userId: user?.uuid ?? '',
+ contextKey: 'example-session',
+ prompt: context.args.prompt ?? MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT,
+ isImpersonated: false,
+ })
+ useValues(logic)
+ useEffect(() => {
+ logic.actions.showPrompt(survey, Date.now(), 'example-submission')
+ if (context.parameters.feedbackStage === 'followup') {
+ logic.actions.responseQueued('2', false)
+ }
+ if (context.parameters.feedbackStage === 'error') {
+ logic.actions.responseQueued('2', false)
+ logic.actions.setDetail('Found a tool call that needs a clearer error message.')
+ logic.actions.responseFailed()
+ }
+ if (context.parameters.feedbackStage === 'thanks') {
+ logic.actions.responseQueued('1', true)
+ }
+ }, [logic, context.parameters.feedbackStage])
+ return <Story />
+ },
+ ],
+}
+export default meta
+
+type Story = StoryObj<typeof meta>
+
+export const Default: Story = {
+ render: (args) => (
+ <div className="w-[800px] max-w-full">
+ <MCPAnalyticsFeedbackPrompt {...args} />
+ </div>
+ ),
+}
+
+export const Narrow: Story = {
+ render: (args) => (
+ <div className="w-[520px] max-w-full">
+ <MCPAnalyticsFeedbackPrompt {...args} />
+ </div>
+ ),
+}
+
+export const SessionReview: Story = {
+ decorators: [
+ mswDecorator({
+ get: {
+ '/api/projects/:team_id/mcp_analytics/sessions/': {
+ results: [
+ {
+ session_id: 'example-session',
+ distinct_id: 'example-user',
+ session_start: '2026-09-01T12:00:00Z',
+ session_end: '2026-09-01T12:00:02Z',
+ tool_calls: 1,
+ intent: 'Check the status of a deployment.',
+ mcp_client_name: 'Example client',
+ },
+ ],
+ has_next: false,
+ },
+ '/api/projects/:team_id/mcp_analytics/sessions/:session_id/tool_calls/': {
+ results: [
+ {
+ event_id: 'example-call',
+ timestamp: '2026-09-01T12:00:01Z',
+ tool_name: 'deployment-status',
+ intent: 'Check whether the deployment completed.',
+ is_error: false,
+ duration_ms: 240,
+ },
+ ],
+ has_next: false,
+ },
+ },
+ }),
+ ],
+ render: () => (
+ <div className="w-[520px] max-w-full h-[400px] rounded border border-primary">
+ <MCPSessionDetail />
+ </div>
+ ),
+}
+
+export const FollowUp: Story = { ...Narrow, parameters: { feedbackStage: 'followup' } }
+export const Error: Story = { ...Narrow, parameters: { feedbackStage: 'error' } }
+export const Thanks: Story = { ...Narrow, parameters: { feedbackStage: 'thanks' } }
+
+export const ContextualCopy: Story = {
+ ...Narrow,
+ args: {
+ prompt: {
+ entryPoint: 'tool_review_prompt',
+ tab: 'tools',
+ version: 1,
+ question: 'Did this tool breakdown help you find what you needed?',
+ followUpQuestion: 'What did you find, or what was missing?',
+ },
+ },
+}
diff --git a/products/mcp_analytics/frontend/feedback/MCPAnalyticsFeedbackPrompt.tsx b/products/mcp_analytics/frontend/feedback/MCPAnalyticsFeedbackPrompt.tsx
new file mode 100644
index 000000000000..9f49e2d4b3c6
--- /dev/null
+++ b/products/mcp_analytics/frontend/feedback/MCPAnalyticsFeedbackPrompt.tsx
@@ -0,0 +1,107 @@
+import { useActions, useValues } from 'kea'
+import { useId } from 'react'
+
+import { IconThumbsDown, IconThumbsUp } from '@posthog/icons'
+import { LemonBanner, LemonButton, LemonLabel, LemonTextArea } from '@posthog/lemon-ui'
+
+import { userLogic } from 'scenes/userLogic'
+
+import { MCPAnalyticsFeedbackPromptConfig, MCP_ANALYTICS_FEEDBACK_RATINGS } from './constants'
+import { mcpAnalyticsFeedbackLogic } from './mcpAnalyticsFeedbackLogic'
+
+const thumbRatings = [
+ { value: MCP_ANALYTICS_FEEDBACK_RATINGS.UP, label: 'Thumbs up', icon: <IconThumbsUp /> },
+ { value: MCP_ANALYTICS_FEEDBACK_RATINGS.DOWN, label: 'Thumbs down', icon: <IconThumbsDown /> },
+]
+
+export function MCPAnalyticsFeedbackPrompt({
+ contextKey,
+ prompt: promptConfig,
+}: {
+ contextKey: string
+ prompt: MCPAnalyticsFeedbackPromptConfig
+}): JSX.Element | null {
+ const questionId = useId()
+ const detailId = useId()
+ const { user } = useValues(userLogic)
+ const logic = mcpAnalyticsFeedbackLogic({
+ userId: user?.uuid ?? '',
+ contextKey,
+ prompt: promptConfig,
+ isImpersonated: user?.is_impersonated ?? false,
+ })
+ const { visible, survey, prompt, answer, detail, completed, submitting, error } = useValues(logic)
+ const { dismissPrompt, setDetail, submitResponse } = useActions(logic)
+
+ if (!visible || !survey) {
+ return null
+ }
+
+ return (
+ <div className="shrink-0 p-2" data-attr="mcp-analytics-feedback-prompt">
+ <LemonBanner type="info" hideIcon onClose={dismissPrompt}>
+ {completed ? (
+ <div role="status">Thanks for your feedback.</div>
+ ) : answer ? (
+ <div className="space-y-2">
+ <div className="text-secondary text-xs" role="status">
+ Thanks for answering.
+ </div>
+ <LemonLabel htmlFor={detailId} showOptional>
+ {prompt.followUpQuestion}
+ </LemonLabel>
+ <LemonTextArea
+ id={detailId}
+ value={detail}
+ onChange={setDetail}
+ autoFocus
+ minRows={2}
+ maxRows={4}
+ maxLength={2000}
+ disabled={submitting}
+ data-attr="mcp-analytics-feedback-detail"
+ />
+ <div className="flex flex-wrap gap-2">
+ <LemonButton
+ type="primary"
+ size="small"
+ loading={submitting}
+ onClick={() => submitResponse(answer, true)}
+ data-attr="mcp-analytics-feedback-submit"
+ >
+ {detail.trim() ? 'Send feedback' : 'Done'}
+ </LemonButton>
+ </div>
+ </div>
+ ) : (
+ <div className="space-y-2">
+ <div className="font-semibold" id={questionId}>
+ {prompt.question}
+ </div>
+ <div className="flex flex-wrap gap-2" role="group" aria-labelledby={questionId}>
+ {thumbRatings.map((rating) => (
+ <LemonButton
+ key={rating.value}
+ type="secondary"
+ size="small"
+ loading={submitting}
+ icon={rating.icon}
+ aria-label={rating.label}
+ tooltip={rating.label}
+ onClick={() => submitResponse(rating.value, false)}
+ data-attr="mcp-analytics-feedback-answer"
+ data-feedback-rating={rating.value}
+ />
+ ))}
+ </div>
+ </div>
+ )}
+ {error && (
+ <div className="text-danger mt-2" role="alert">
+ Couldn't send your feedback. Please try again.
+ </div>
+ )}
+ </LemonBanner>
+ </div>
+ )
+}
diff --git a/products/mcp_analytics/frontend/feedback/constants.ts b/products/mcp_analytics/frontend/feedback/constants.ts
new file mode 100644
index 000000000000..b68c0fc6a41d
--- /dev/null
+++ b/products/mcp_analytics/frontend/feedback/constants.ts
@@ -0,0 +1,19 @@
+export const MCP_ANALYTICS_USEFULNESS_SURVEY_ID = '01a091d3-2706-0000-124f-3aab2a5e9e11'
+
+export const MCP_ANALYTICS_FEEDBACK_RATINGS = { UP: '1', DOWN: '2' } as const
+
+export interface MCPAnalyticsFeedbackPromptConfig {
+ entryPoint: string
+ tab: string
+ version: number
+ question: string
+ followUpQuestion: string
+}
+
+export const MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT: MCPAnalyticsFeedbackPromptConfig = {
+ entryPoint: 'session_review_prompt',
+ tab: 'sessions',
+ version: 1,
+ question: 'Did this session help you find what you needed?',
+ followUpQuestion: 'What did you learn, or what was missing?',
+}
diff --git a/products/mcp_analytics/frontend/feedback/mcpAnalyticsFeedbackLogic.test.ts b/products/mcp_analytics/frontend/feedback/mcpAnalyticsFeedbackLogic.test.ts
new file mode 100644
index 000000000000..7646b852dedc
--- /dev/null
+++ b/products/mcp_analytics/frontend/feedback/mcpAnalyticsFeedbackLogic.test.ts
@@ -0,0 +1,316 @@
+import posthog, { Survey, SurveyType, SurveyQuestionType } from 'posthog-js'
+
+import { initKeaTests } from '~/test/init'
+
+import { MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT, MCP_ANALYTICS_USEFULNESS_SURVEY_ID } from './constants'
+import {
+ FEEDBACK_PROMPT_COOLDOWN_MS,
+ FEEDBACK_PROMPT_DELAY_MS,
+ mcpAnalyticsFeedbackLogic,
+} from './mcpAnalyticsFeedbackLogic'
+
+describe('mcpAnalyticsFeedbackLogic', () => {
+ let logic: ReturnType<typeof mcpAnalyticsFeedbackLogic.build>
+ let surveysLoaded: Parameters<typeof posthog.onSurveysLoaded>[0]
+ let flagsLoaded: Parameters<typeof posthog.onFeatureFlags>[0]
+ let unmount: () => void
+
+ const survey: Survey = {
+ id: MCP_ANALYTICS_USEFULNESS_SURVEY_ID,
+ name: 'Session usefulness',
+ type: SurveyType.API,
+ start_date: '2026-01-01T00:00:00Z',
+ feature_flag_keys: null,
+ linked_flag_key: null,
+ targeting_flag_key: null,
+ internal_targeting_flag_key: null,
+ appearance: null,
+ conditions: null,
+ end_date: null,
+ current_iteration: null,
+ current_iteration_start_date: null,
+ questions: [
+ {
+ id: 'example-choice',
+ type: SurveyQuestionType.Rating,
+ question: 'Was this useful?',
+ display: 'emoji',
+ scale: 2,
+ lowerBoundLabel: '',
+ upperBoundLabel: '',
+ },
+ { id: 'example-detail', type: SurveyQuestionType.Open, question: 'What did you learn?', optional: true },
+ ],
+ }
+
+ const loadSurvey = (available = true): void => {
+ jest.mocked(posthog.getActiveMatchingSurveys).mockImplementation((callback) =>
+ callback(available ? [survey] : [])
+ )
+ surveysLoaded(available ? [survey] : [], { isLoaded: true })
+ }
+
+ beforeEach(() => {
+ jest.useFakeTimers()
+ jest.setSystemTime(new Date('2026-09-01T12:00:00Z'))
+ localStorage.clear()
+ crypto.randomUUID = () => '00000000-0000-4000-8000-000000000001'
+ initKeaTests(false)
+ posthog.is_capturing = jest.fn(() => true)
+ posthog.getActiveMatchingSurveys = jest.fn((callback) => callback([]))
+ jest.mocked(posthog.onFeatureFlags).mockImplementation((callback) => {
+ flagsLoaded = callback
+ callback([], {})
+ return () => {}
+ })
+ jest.mocked(posthog.capture).mockClear()
+ jest.mocked(posthog.capture).mockReturnValue({ uuid: 'example-event' } as ReturnType<typeof posthog.capture>)
+ jest.mocked(posthog.onSurveysLoaded).mockImplementation((callback) => {
+ surveysLoaded = callback
+ return () => {}
+ })
+ logic = mcpAnalyticsFeedbackLogic({
+ userId: 'example-user',
+ contextKey: 'example-session',
+ isImpersonated: false,
+ prompt: MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT,
+ })
+ unmount = logic.mount()
+ })
+
+ afterEach(() => {
+ unmount()
+ jest.useRealTimers()
+ jest.restoreAllMocks()
+ jest.clearAllMocks()
+ })
+
+ it.each([false, true])(
+ 'waits for matching surveys and a fresh reading delay (backgrounded: %s)',
+ (backgrounded) => {
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(false)
+ loadSurvey(false)
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(false)
+ loadSurvey()
+ if (backgrounded) {
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS / 2)
+ const hidden = jest.spyOn(document, 'hidden', 'get').mockReturnValue(true)
+ document.dispatchEvent(new Event('visibilitychange'))
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS * 2)
+ expect(logic.values.visible).toBe(false)
+ expect(logic.values.lastPromptAt).toBe(0)
+ expect(posthog.capture).not.toHaveBeenCalledWith('survey shown', expect.anything())
+ hidden.mockReturnValue(false)
+ document.dispatchEvent(new Event('visibilitychange'))
+ }
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS - 1)
+ expect(logic.values.visible).toBe(false)
+ jest.advanceTimersByTime(1)
+ expect(logic.values.visible).toBe(true)
+ expect(posthog.capture).toHaveBeenCalledWith(
+ 'survey shown',
+ expect.objectContaining({
+ feedback_surface: 'mcp_analytics',
+ feedback_entry_point: 'session_review_prompt',
+ mcp_analytics_tab: 'sessions',
+ $survey_id: survey.id,
+ $survey_submission_id: expect.any(String),
+ })
+ )
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(jest.mocked(posthog.capture).mock.calls.filter(([name]) => name === 'survey shown')).toHaveLength(1)
+ }
+ )
+
+ it('keeps the reading delay across flag reloads and uses the latest survey metadata', () => {
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS / 2)
+ const refreshedSurvey = { ...survey, name: 'Updated usefulness survey' }
+ jest.mocked(posthog.getActiveMatchingSurveys).mockImplementation((callback) => callback([refreshedSurvey]))
+ flagsLoaded([], {})
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS / 2 - 1)
+ expect(logic.values.visible).toBe(false)
+ flagsLoaded([], {})
+ jest.advanceTimersByTime(1)
+ expect(logic.values.visible).toBe(true)
+ expect(posthog.capture).toHaveBeenCalledWith(
+ 'survey shown',
+ expect.objectContaining({ $survey_name: refreshedSurvey.name })
+ )
+ })
+
+ it.each([
+ { ending: 'complete', detail: '' },
+ { ending: 'complete', detail: 'Found a slow call.' },
+ { ending: 'dismiss', detail: '' },
+ ])('captures one submission with consistent context: %j', ({ ending, detail }) => {
+ unmount()
+ const prompt = {
+ entryPoint: 'tool_review_prompt',
+ tab: 'tools',
+ version: 2,
+ question: 'Did this tool breakdown help you find what you needed?',
+ followUpQuestion: 'What did you find, or what was missing?',
+ }
+ logic = mcpAnalyticsFeedbackLogic({
+ userId: 'example-user',
+ contextKey: 'example-tool',
+ isImpersonated: false,
+ prompt,
+ })
+ unmount = logic.mount()
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ const displayedQuestion = prompt.question
+ prompt.question = 'Later copy must not change an open prompt'
+ logic.actions.submitResponse('2', false)
+ logic.actions.submitResponse('1', false)
+ expect(logic.values.answer).toBe('2')
+ if (ending === 'complete') {
+ logic.actions.setDetail(detail)
+ logic.actions.submitResponse('2', true)
+ logic.actions.submitResponse('2', true)
+ expect(logic.values).toMatchObject({ completed: true, submitting: false })
+ }
+ logic.actions.dismissPrompt()
+ const events = jest.mocked(posthog.capture).mock.calls
+ expect(events.map(([name]) => name)).toEqual([
+ 'survey shown',
+ 'survey sent',
+ ending === 'complete' ? 'survey sent' : 'survey dismissed',
+ ])
+ for (const [, properties] of events) {
+ expect(properties).toMatchObject({
+ $survey_id: survey.id,
+ $survey_submission_id: logic.values.submissionId,
+ feedback_surface: 'mcp_analytics',
+ feedback_entry_point: 'tool_review_prompt',
+ mcp_analytics_tab: 'tools',
+ feedback_question_version: 2,
+ feedback_question: displayedQuestion,
+ feedback_followup_question: prompt.followUpQuestion,
+ $survey_questions: [
+ { id: 'example-choice', question: displayedQuestion },
+ { id: 'example-detail', question: prompt.followUpQuestion },
+ ],
+ })
+ }
+ expect(events[1][1]).toMatchObject({ $survey_completed: false, '$survey_response_example-choice': '2' })
+ expect(events[2][1]).toMatchObject(
+ ending === 'complete'
+ ? { $survey_completed: true, '$survey_response_example-choice': '2' }
+ : { $survey_partially_completed: true }
+ )
+ expect(events[2][1]?.['$survey_response_example-detail']).toBe(detail || undefined)
+ expect(logic.values.prompt.question).toBe(displayedQuestion)
+ expect(survey.questions[0].question).toBe('Was this useful?')
+ })
+
+ it('keeps the cooldown across placements after dismissal', () => {
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ logic.actions.dismissPrompt()
+ expect(logic.values.visible).toBe(false)
+ unmount()
+ logic = mcpAnalyticsFeedbackLogic({
+ userId: 'example-user',
+ contextKey: 'another-session',
+ isImpersonated: false,
+ prompt: { ...MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT, entryPoint: 'tool_review_prompt', tab: 'tools' },
+ })
+ unmount = logic.mount()
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(false)
+ unmount()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_COOLDOWN_MS)
+ logic = mcpAnalyticsFeedbackLogic({
+ userId: 'example-user',
+ contextKey: 'example-session',
+ isImpersonated: false,
+ prompt: MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT,
+ })
+ unmount = logic.mount()
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(true)
+ })
+
+ it('cancels a pending invitation when leaving the session detail', () => {
+ loadSurvey()
+ unmount()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(posthog.capture).not.toHaveBeenCalledWith('survey shown', expect.anything())
+ unmount = () => {}
+ })
+
+ it.each([
+ { userId: '', contextKey: 'example-session', isImpersonated: false },
+ { userId: 'example-user', contextKey: 'example-session', isImpersonated: true },
+ ])('does not prompt an ineligible user: %j', (props) => {
+ unmount()
+ logic = mcpAnalyticsFeedbackLogic({ ...props, prompt: MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT })
+ unmount = logic.mount()
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(false)
+ })
+ it.each(['dropped', 'thrown'] as const)(
+ 'allows retry when capture is %s without losing optional text',
+ (failure) => {
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ logic.actions.submitResponse('1', false)
+ logic.actions.setDetail('Found the slow call.')
+ const submissionId = logic.values.submissionId
+ jest.mocked(posthog.capture).mockImplementationOnce(() => {
+ if (failure === 'thrown') {
+ throw new Error('capture failed')
+ }
+ return undefined
+ })
+ logic.actions.submitResponse('1', true)
+ expect(logic.values).toMatchObject({
+ error: true,
+ completed: false,
+ submitting: false,
+ detail: 'Found the slow call.',
+ })
+ logic.actions.submitResponse('1', true)
+ expect(logic.values).toMatchObject({ error: false, completed: true, submissionId })
+ }
+ )
+
+ it('cancels the pending prompt when targeting changes and skips users without capture', () => {
+ loadSurvey()
+ loadSurvey(false)
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(false)
+ jest.mocked(posthog.is_capturing).mockReturnValue(false)
+ loadSurvey()
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(false)
+ })
+ it.each([
+ { start_date: null },
+ { end_date: '2026-08-01T00:00:00Z' },
+ { type: SurveyType.Popover },
+ { questions: [] },
+ {
+ questions: [
+ { ...survey.questions[0], type: SurveyQuestionType.SingleChoice, choices: ['Yes', 'No'] },
+ survey.questions[1],
+ ],
+ },
+ { questions: [{ ...survey.questions[0], scale: 5 as const }, survey.questions[1]] },
+ { questions: [survey.questions[0], { ...survey.questions[1], optional: false }] },
+ ])('does not show a stopped or incompatible survey: %j', (overrides) => {
+ logic.actions.schedulePrompt({ ...survey, ...overrides })
+ jest.advanceTimersByTime(FEEDBACK_PROMPT_DELAY_MS)
+ expect(logic.values.visible).toBe(false)
+ expect(posthog.capture).not.toHaveBeenCalled()
+ })
+})
diff --git a/products/mcp_analytics/frontend/feedback/mcpAnalyticsFeedbackLogic.ts b/products/mcp_analytics/frontend/feedback/mcpAnalyticsFeedbackLogic.ts
new file mode 100644
index 000000000000..a3ca17ac46b3
--- /dev/null
+++ b/products/mcp_analytics/frontend/feedback/mcpAnalyticsFeedbackLogic.ts
@@ -0,0 +1,302 @@
+import {
+ LogicWrapper,
+ MakeLogicType,
+ actions,
+ afterMount,
+ getContext,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
+import posthog, { Survey, SurveyQuestionType, SurveyType } from 'posthog-js'
+
+import { SURVEY_RATING_SCALE } from 'scenes/surveys/constants'
+
+import { SurveyEventName, SurveyEventProperties } from '~/types'
+
+import {
+ MCPAnalyticsFeedbackPromptConfig,
+ MCP_ANALYTICS_FEEDBACK_RATINGS,
+ MCP_ANALYTICS_USEFULNESS_SURVEY_ID,
+} from './constants'
+
+export const FEEDBACK_PROMPT_DELAY_MS = 30_000
+export const FEEDBACK_PROMPT_COOLDOWN_MS = 30 * 24 * 60 * 60 * 1000
+
+export interface MCPAnalyticsFeedbackLogicProps {
+ userId: string
+ contextKey: string
+ prompt: MCPAnalyticsFeedbackPromptConfig
+ isImpersonated: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsFeedbackLogicValues {
+ answer: string
+ completed: boolean
+ detail: string
+ error: boolean
+ lastPromptAt: number
+ prompt: MCPAnalyticsFeedbackPromptConfig
+ submissionId: string
+ submitting: boolean
+ survey: Survey | null
+ surveyEventProperties: Record<string, unknown>
+ visible: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsFeedbackLogicActions {
+ captureStarted: () => {
+ value: true
+ }
+ dismissPrompt: () => {
+ value: true
+ }
+ responseFailed: () => {
+ value: true
+ }
+ responseQueued: (
+ answer: string,
+ completed: boolean
+ ) => {
+ answer: string
+ completed: boolean
+ }
+ schedulePrompt: (survey: Survey | null) => {
+ survey: Survey | null
+ }
+ setDetail: (detail: string) => {
+ detail: string
+ }
+ showPrompt: (
+ survey: Survey,
+ timestamp: number,
+ submissionId: string
+ ) => {
+ submissionId: string
+ survey: Survey
+ timestamp: number
+ }
+ submitResponse: (
+ answer: string,
+ completed: boolean
+ ) => {
+ answer: string
+ completed: boolean
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface mcpAnalyticsFeedbackLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ surveyEventProperties: (
+ survey: Survey | null,
+ submissionId: string,
+ prompt: MCPAnalyticsFeedbackPromptConfig
+ ) => Record<string, unknown>
+ }
+}
+
+export type mcpAnalyticsFeedbackLogicType = MakeLogicType<
+ mcpAnalyticsFeedbackLogicValues,
+ mcpAnalyticsFeedbackLogicActions,
+ MCPAnalyticsFeedbackLogicProps,
+ mcpAnalyticsFeedbackLogicMeta
+>
+
+function hasFeedbackQuestions(survey: Survey): boolean {
+ const [choice, detail] = survey.questions
+ return (
+ survey.questions.length === 2 &&
+ choice.type === SurveyQuestionType.Rating &&
+ !!choice.id &&
+ choice.scale === SURVEY_RATING_SCALE.THUMB_2_POINT &&
+ choice.display === 'emoji' &&
+ detail.type === SurveyQuestionType.Open &&
+ !!detail.id &&
+ !!detail.optional
+ )
+}
+
+export const mcpAnalyticsFeedbackLogic: LogicWrapper<mcpAnalyticsFeedbackLogicType> =
+ kea<mcpAnalyticsFeedbackLogicType>([
+ props({} as MCPAnalyticsFeedbackLogicProps),
+ key(({ userId, contextKey, prompt }) => JSON.stringify([userId, prompt.entryPoint, contextKey])),
+ path((key) => ['products', 'mcp_analytics', 'frontend', 'feedback', 'mcpAnalyticsFeedbackLogic', key]),
+ actions({
+ schedulePrompt: (survey: Survey | null) => ({ survey }),
+ showPrompt: (survey: Survey, timestamp: number, submissionId: string) => ({
+ survey,
+ timestamp,
+ submissionId,
+ }),
+ dismissPrompt: true,
+ setDetail: (detail: string) => ({ detail }),
+ submitResponse: (answer: string, completed: boolean) => ({ answer, completed }),
+ responseQueued: (answer: string, completed: boolean) => ({ answer, completed }),
+ responseFailed: true,
+ captureStarted: true,
+ }),
+ reducers(({ props }) => ({
+ prompt: [props.prompt, { showPrompt: () => ({ ...props.prompt }) }],
+ visible: [false, { showPrompt: () => true, dismissPrompt: () => false }],
+ survey: [null as Survey | null, { showPrompt: (_, { survey }) => survey }],
+ submissionId: ['', { showPrompt: (_, { submissionId }) => submissionId }],
+ answer: ['', { responseQueued: (_, { answer }) => answer }],
+ detail: ['', { setDetail: (_, { detail }) => detail }],
+ completed: [false, { responseQueued: (_, { completed }) => completed }],
+ submitting: [
+ false,
+ { captureStarted: () => true, responseQueued: () => false, responseFailed: () => false },
+ ],
+ error: [false, { captureStarted: () => false, responseFailed: () => true }],
+ lastPromptAt: [
+ 0,
+ { persist: true, storageKey: `mcp-analytics-feedback-last-prompt:${props.userId}` },
+ { showPrompt: (_, { timestamp }) => timestamp },
+ ],
+ })),
+ selectors({
+ surveyEventProperties: [
+ (s) => [s.survey, s.submissionId, s.prompt],
+ (
+ survey: Survey | null,
+ submissionId: string,
+ prompt: MCPAnalyticsFeedbackPromptConfig
+ ): Record<string, unknown> => ({
+ feedback_surface: 'mcp_analytics',
+ feedback_entry_point: prompt.entryPoint,
+ mcp_analytics_tab: prompt.tab,
+ feedback_question_version: prompt.version,
+ feedback_question: prompt.question,
+ feedback_followup_question: prompt.followUpQuestion,
+ [SurveyEventProperties.SURVEY_ID]: survey?.id,
+ $survey_name: survey?.name,
+ [SurveyEventProperties.SURVEY_SUBMISSION_ID]: submissionId,
+ $survey_questions: survey?.questions.map(({ id }, index) => ({
+ id,
+ question: index === 0 ? prompt.question : prompt.followUpQuestion,
+ })),
+ }),
+ ],
+ }),
+ listeners(({ actions, values, props, cache }) => ({
+ schedulePrompt: ({ survey }) => {
+ if (
+ !props.userId ||
+ props.isImpersonated ||
+ values.visible ||
+ !survey ||
+ survey.type !== SurveyType.API ||
+ !survey.start_date ||
+ survey.end_date ||
+ !hasFeedbackQuestions(survey) ||
+ !posthog.is_capturing() ||
+ Date.now() - values.lastPromptAt < FEEDBACK_PROMPT_COOLDOWN_MS
+ ) {
+ cache.disposables.dispose('prompt-delay')
+ cache.pendingSurvey = null
+ return
+ }
+ const alreadyPending =
+ cache.pendingSurvey?.id === survey.id && cache.disposables.registry.has('prompt-delay')
+ cache.pendingSurvey = survey
+ if (alreadyPending) {
+ return
+ }
+ const context = getContext()
+ cache.disposables.add(() => {
+ const timer = window.setTimeout(() => {
+ if (getContext() !== context) {
+ return
+ }
+ const surveyToShow: Survey | null = cache.pendingSurvey
+ if (surveyToShow && posthog.is_capturing()) {
+ actions.showPrompt(surveyToShow, Date.now(), crypto.randomUUID())
+ }
+ cache.pendingSurvey = null
+ cache.disposables.dispose('prompt-delay')
+ }, FEEDBACK_PROMPT_DELAY_MS)
+ return () => window.clearTimeout(timer)
+ }, 'prompt-delay')
+ },
+ showPrompt: () => {
+ posthog.capture(SurveyEventName.SHOWN, values.surveyEventProperties)
+ },
+ dismissPrompt: () => {
+ if (values.survey && !values.completed) {
+ posthog.capture(SurveyEventName.DISMISSED, {
+ ...values.surveyEventProperties,
+ [SurveyEventProperties.SURVEY_PARTIALLY_COMPLETED]: !!values.answer,
+ })
+ }
+ },
+ submitResponse: ({ answer, completed }) => {
+ const { survey } = values
+ const duplicateAnswer = !completed && !!values.answer
+ const mismatchedCompletion = completed && (!values.answer || answer !== values.answer)
+ if (
+ !values.visible ||
+ !survey ||
+ values.completed ||
+ values.submitting ||
+ duplicateAnswer ||
+ mismatchedCompletion ||
+ !hasFeedbackQuestions(survey) ||
+ (answer !== MCP_ANALYTICS_FEEDBACK_RATINGS.UP && answer !== MCP_ANALYTICS_FEEDBACK_RATINGS.DOWN)
+ ) {
+ return
+ }
+ actions.captureStarted()
+ try {
+ const queued = posthog.capture(SurveyEventName.SENT, {
+ ...values.surveyEventProperties,
+ [SurveyEventProperties.SURVEY_COMPLETED]: completed,
+ [`${SurveyEventProperties.SURVEY_RESPONSE}_${survey.questions[0].id}`]: answer,
+ ...(completed && values.detail.trim()
+ ? {
+ [`${SurveyEventProperties.SURVEY_RESPONSE}_${survey.questions[1].id}`]:
+ values.detail.trim(),
+ }
+ : {}),
+ })
+ if (queued) {
+ actions.responseQueued(answer, completed)
+ } else {
+ actions.responseFailed()
+ }
+ } catch {
+ actions.responseFailed()
+ }
+ },
+ })),
+ afterMount(({ actions, cache }) => {
+ const context = getContext()
+ cache.disposables.add(() =>
+ posthog.onSurveysLoaded((_, surveyContext) => {
+ if (surveyContext?.isLoaded) {
+ cache.disposables.add(
+ () =>
+ posthog.onFeatureFlags(() => {
+ posthog.getActiveMatchingSurveys((surveys) => {
+ if (!cache.disposables.isDisposed && getContext() === context) {
+ actions.schedulePrompt(
+ surveys.find(({ id }) => id === MCP_ANALYTICS_USEFULNESS_SURVEY_ID) ??
+ null
+ )
+ }
+ })
+ }),
+ 'survey-flags'
+ )
+ }
+ })
+ )
+ }),
+ ])
diff --git a/products/mcp_analytics/frontend/sessions/MCPSessionDetail.tsx b/products/mcp_analytics/frontend/sessions/MCPSessionDetail.tsx
index 4c02e057f88b..39598e0933cd 100644
--- a/products/mcp_analytics/frontend/sessions/MCPSessionDetail.tsx
+++ b/products/mcp_analytics/frontend/sessions/MCPSessionDetail.tsx
@@ -10,6 +10,8 @@ import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { AccessControlLevel, AccessControlResourceType } from '~/types'
+import { MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT } from '../feedback/constants'
+import { MCPAnalyticsFeedbackPrompt } from '../feedback/MCPAnalyticsFeedbackPrompt'
import { mcpSessionsLogic } from './mcpSessionsLogic'
import { formatDuration, formatRelativeOffset, sessionDurationMs, shortenSessionId } from './utils'
@@ -238,6 +240,12 @@ export function MCPSessionDetail(): JSX.Element {
</AccessControlAction>
)}
</footer>
+ {!loading && toolCalls.length > 0 && (
+ <MCPAnalyticsFeedbackPrompt
+ contextKey={selectedSession.session_id}
+ prompt={MCP_ANALYTICS_SESSION_FEEDBACK_PROMPT}
+ />
+ )}
</div>
)
}
diff --git a/products/mcp_analytics/package.json b/products/mcp_analytics/package.json
index 20ec8681285c..1120cdf66c11 100644
--- a/products/mcp_analytics/package.json
+++ b/products/mcp_analytics/package.json
@@ -10,7 +10,8 @@
"@posthog/quill-primitives": "workspace:*",
"kea": "catalog:",
"kea-loaders": "catalog:",
- "kea-router": "catalog:"
+ "kea-router": "catalog:",
+ "posthog-js": "catalog:"
},
"devDependencies": {
"kea-test-utils": "catalog:"