: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
fix(mcp): polish MCP hint toast based on user feedback (#59454)
Jovan Sakovic9f0a880e6821
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 35f990fd4776..7838fb27a731 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -885,43 +885,47 @@ snapshots:components-markdown-editor-rich--with-markdown--light:hash: v1.k794b7964.a73d574094e4664a4cfe8a28bbb74d6bf7d6b7cbe0b5f05aeb3a11fc42a8109e.fHAFZolNByYE1LYlKSbW0YVDUxDdmt31lCq06SkXjYAcomponents-mcp-hint-toast--annotations-create--dark:- hash: v1.k794b7964.e8923b86b03653fdd9dd1e001005b306988c37d8c4c5586f308e55e9ac0328bd.iVTGO2Lj2EPrEvqK1-AL07Z5Ad9uFtKuKLfE7lhYSH8+ hash: v1.k794b7964.39d07381b7ff2db278065972a9f29a009270ce736f67e8be8d2df99f70ae0590.cUiBHWD0ZcLFJDIjXooPclOZr2SBDIpGBqCP118NcTQcomponents-mcp-hint-toast--annotations-create--light:- hash: v1.k794b7964.1e4136d99c4ce39a8fd3e015b4a0158fd08cf78192d414db2810692f254b921a.a-8M_Eh9hsmax5NB7pzGqPBDgN5R5pprokV4Cpb3420+ hash: v1.k794b7964.eae8c70a798cc0cbad68137f9a9e83b403fcb8111ae60954c4082e9dcec8afd4.Blt5UbhMjDGo0KYDXmfyGEzZg8qlBK9uNyEio4-cEXMcomponents-mcp-hint-toast--dashboards-create--dark:- hash: v1.k794b7964.5c76e67dd52c29e4aab44804af991cb56fa62b52d6f7ccbca400ebeb68bb3559.AQDTwhI54JFBo1vfGYlq4hB-WW9Cnyz0lxitzvgyfwU+ hash: v1.k794b7964.33d740cde116ac9750e6f6342c3eed0b5c9e78ce2e306f2070e63ee2534719c3.27VH7ajwTFBTEdkO_XaR3N3fsYaPdBMOagbMK3N94Dscomponents-mcp-hint-toast--dashboards-create--light:- hash: v1.k794b7964.8b81e21a229e04aabc535f1a472f20313d73479ff6c8caca7a425b1558a57ce9.Ojv2DKaC5hSV1CEkJTfRHbafXgICJrJnhDMN_n01RK0+ hash: v1.k794b7964.80504fb2df8edbaba91e6d2e5accaba4bd3285cccf362bd79ec88df7bd2e1fad.Bysv48DSgnokpqecteoOcd9gVjtBBxLSYMOjqTZqwkYcomponents-mcp-hint-toast--experiments-create--dark:- hash: v1.k794b7964.98f11b76ee386d0b410e539165e3ad8829ec3d219200d18b27c54d654af4b26c.PzNNTzffL7fdmoz_KEfMWQKCV5lPqjBLdtx5g8NRuD4+ hash: v1.k794b7964.34b52e35a65f7e4834301e3d87126fb94c2c8db4d9f9a472d172de82b57d67c0.B2Pdj-Wo54Ak28hk5AMZWqLpMDuM-qzeG8eFQ-5_6WIcomponents-mcp-hint-toast--experiments-create--light:- hash: v1.k794b7964.a5d118a3460acb1b797fd9bfde641ebd9c7005cc5ab5737a7d418d6e9548137f.pE0DYITm_o3B0Pl8P1pJRU-vl1rUOOodC9Di7FiFLjY+ hash: v1.k794b7964.a5f6209437b780c4f58d52a1f6017419d3fa8e19416e9d19ed1d0ed6ab375dc4.ryUPftBNOUru94qlwhpBLNpNnvHnfEXi3BwS_q0deYwcomponents-mcp-hint-toast--feature-flags-create--dark:- hash: v1.k794b7964.1c3698ce687f72d569f86d58b5dddf6d34144a348b65aa8b94e8d21acfdf93b2.fkvxwpKvMy6nsAonmJ8NI0t-A-98LtsTw62jm_4Bnt0+ hash: v1.k794b7964.8b37ccbeb85b12cfa67ef291ac4f12ba43d3747165830b3233a553d0870a92a0.5yP0xhlATu5GwaVkyJIaPb12z3sVmlOY1qouwzlWlZMcomponents-mcp-hint-toast--feature-flags-create--light:- hash: v1.k794b7964.8c58c34432209f5ee2a55ed3997d55348c73c799a62de416607b37dc8664228c.s7wM0MbZHvjyqTmlb61AzZD_h58Gcg_fBPN-S_W_fxI+ hash: v1.k794b7964.1bdef4d6355dd47d53ffba9b290b9e8b8f2113f7009f6f405a94cfe78552db09.wM6amMYVPD_2Y7HYP5U5ZLiFqzYKZqjj0uVNMzk0CI0+ components-mcp-hint-toast--feature-flags-update-with-name--dark:+ hash: v1.k794b7964.629d7c5a0f26509fa1ab9d86c3eb2fe156a2f1a4cc13b943f1eb90cc8d8743ea.xKMX1j50i6T5B7JPA91AzMLz2J8BB8X8lImO38ZAXgg+ components-mcp-hint-toast--feature-flags-update-with-name--light:+ hash: v1.k794b7964.c89945024132bfc29737a2472813aed61aabdf0d6deda6d08ece434b994061c6.UHRdedgGeswIxNH1A8Mkt9lzH-5nlrDbIjsktZfI1-gcomponents-mcp-hint-toast--sql-execute--dark:- hash: v1.k794b7964.9abc853af0736adc72919e4dd7e77f26323b31bb46c76ac409a3af661533e0e4.rdIk5psJPWxrVlch4TQns3n2EibbetxnAhs1AT4Gbmw+ hash: v1.k794b7964.d91a099335481ad3bac73d2a4d7ad6ea8eeecb9d75c1f7ff2f84294754c01c0a.imR4sDFg8sH31qkL8fc3qsYQVjWn98kIQ7H2-61-JOccomponents-mcp-hint-toast--sql-execute--light:- hash: v1.k794b7964.6784bf784ab4d595b262e4a49d1e7aab97b65225746765ea1904c69e36f6e6d7.QRX0Ocd6tQF6HgHZP-Ksvhf6GxfrQ36g2Nr66Q5NwHY+ hash: v1.k794b7964.28e191e337bda4039e3b4ad99b7314fcd7be7e5f98eab83056dcd5d76d9ec4be.H-e4vATCTlEHzeJMQXrpAjf0UUQ3xDYqkb5TbHwSVSAcomponents-mcp-use-case-card--dashboards-create--dark:- hash: v1.k794b7964.04af6fe4522114ae4379f75652bb570502bbcf209c46d867c58d4721dcbd8fe1.uQg2NWTmlhzWD6u_zntj4laVkntPlyqBD56cX-qp0QE+ hash: v1.k794b7964.1b9fee5da80ac8c75356b8141ac1d8f1037ef9a69703762a2f487eed0a755ef8.eR7jg2MvUbrIkeGVgCxtW8TnNl6xni1ZUV568eUhZ6wcomponents-mcp-use-case-card--dashboards-create--light:hash: v1.k794b7964.98904b53a44dea751589172851e9e3322078fa28a3679acc460a9cb20d6b3114.xjXmNvH0Zl6FdygK7e_owJo3hyPMUJESFOtihyeNLlAcomponents-mcp-use-case-card--experiments-create--dark:- hash: v1.k794b7964.4ede81e14ae124abd4d3391aa6567ac1626855c0cf3c1a11fa85e55fcc90f079.CjXzpRpx5ieOn0l8Dxibw3ydpBxs5esHJy9okJ5Cv4A+ hash: v1.k794b7964.4136a63af577823d0e0387b5552e9efc5db18311de565d85dda29b55af50002a.q3eYgsw_lN5R5Z-tD_C4ioMRBFwpH1k0y6nZFAL3cHIcomponents-mcp-use-case-card--experiments-create--light:hash: v1.k794b7964.1c515e7615430073079e8594504fabd65d531779be92e34c955339ebe4715b50.oMqna3JbwTFaVR0HDASPp1eSQw7STYuK0ps7nCHfJPQcomponents-mcp-use-case-card--feature-flags-create--dark:- hash: v1.k794b7964.64093d9f50efdbe3ecbb1c67e8ec3bf6db297721557a1dd54ea786f095a45c24.w-VCPrf_vdRt3TxCnnp7NCsv0nrxuHBHwCDEKPFlq4s+ hash: v1.k794b7964.9c50a8955c8c71bf1ff721b52bae94bae1dad0e7f0993db535117064fbf220e4.rqCZZxvsqKeIY-vAFIIIY7yPgiHIw-_5REoWGaQRTVkcomponents-mcp-use-case-card--feature-flags-create--light:hash: v1.k794b7964.fe502cf912ab060d610d5d9d0311bd68104258ebaafcc204db39f10d13766c8e.W6nEdOUfZlfwKhigQm5e2KOk2b5dHVO3vU8w8jWZ8vIcomponents-mcp-use-case-card--insights-create--dark:- hash: v1.k794b7964.d1434c786607215c801473467a357a9618fda47427430e6cdfc44ecffdd04caf.DQhNZT4lvzh2XZfXT6wpQ-nFpa6RdY8U-RVI5IGnZ_E+ hash: v1.k794b7964.3b707f421479f37c5e4adf7f5cab1f756c1de74b7e7b33b8e1d3017488b9a125.HjQ2RZP7mzB1ySey9QpL8zk8GwA6f6Zg2vTE6pmIDHkcomponents-mcp-use-case-card--insights-create--light:hash: v1.k794b7964.040adaeb7d81194d0d7c6066d065a761c6697d98b774082f3fbf56adaa7c4c05.bwY3U88xvY2IE07rM1dPjBvztzS9NlCCIYsvFM7r2jkcomponents-mcp-use-case-card--surveys-create--dark:- hash: v1.k794b7964.606cdb1a08cd4fbc1c850096762d999c55ecd616aad0ff169eb413581b2b67ec.HjfMQSGB1aJiR0xOi2kEj7-cF9BDksxvhnawmayJsQ8+ hash: v1.k794b7964.6d2d6f5f02c00b1d36defeffb6f08afc7616cd3cc377b09b0d349b23644851ae.cvkd4-v_WXRpfHNbCFnmmhpjoDDEMxkKxA_iWgQEsaccomponents-mcp-use-case-card--surveys-create--light:hash: v1.k794b7964.846d0ba248549a9039f905d6ccdbc66d23669f66d49018db039be53e2603414a.XCmKKI8ul7EsB2gB6GIpeaelV-il2E4Z9mQunZeo3gQcomponents-networkrequest-navigationitem--all-slow--dark:@@ -1945,9 +1949,9 @@ snapshots:filters-taxonomic-filter-headless--properties--light:hash: v1.k794b7964.afa422fd784363e602da5668ab488a823260acba8c2b1168dc85bcbf434d3ddf.Wjl32UIE5KhBda_SpJYwXKZ2FGmnlFbtzv4uKDaJRIsfilters-taxonomic-filter-headless--suggested-filters-with-recents--dark:- hash: v1.k794b7964.c3a6cd419610bc486261efa753816547f080f00c838bde0b8720cf12067b3b22.nxBtExiDfJ3USkhV9RY1VPU_U2dGyEYCMFbhvtOcuVs+ hash: v1.k794b7964.790efb08b3bdf38ac511b9b1d59c7b7227814bcdb8785b8a5809230680b6b417.ZIuweOHfzKGmmiyQhhfUZd9P9VKijDjyHRl3PiEbJMIfilters-taxonomic-filter-headless--suggested-filters-with-recents--light:- hash: v1.k794b7964.4f32ff8f6d683e83acb75ed1d73c5a5b2ac7721e4d2ed465b00a9cad04c28ca9.QfKnCFIFEcOxhu-Psm9bnVF--BScHN_ZqPe_9XCL0sU+ hash: v1.k794b7964.d5655d5578410b405bd03d3bbcdccfdafac058bc524edb5d0ae4976d109519cf.LKBprxgu92aVJ2cJZ-RQs_ESvjYQheVBDAsrkcLq18kfilters-taxonomic-filter-menu-rebuild--data-warehouse-config--dark:hash: v1.k794b7964.c09183f21589b0f11a3013a6e359d23c8d5b17b1e6ed61476ba45da75bcdc73f.tzexSMIoGf0LgGmzdG3-O0g7vd9Isx6MRQ_TWltg4Fofilters-taxonomic-filter-menu-rebuild--data-warehouse-config--light:@@ -4889,7 +4893,7 @@ snapshots:scenes-app-insights-funnels--funnel-left-to-right-edit--dark:hash: v1.k794b7964.293297b83994468984576e5c15fa2cbbb2c4c0a7a8234959b9deba539efa383b.xupnP9sdcp25xPBOMzrhSHwtRpKPLKHaqLDBncapvQAscenes-app-insights-funnels--funnel-left-to-right-edit--light:- hash: v1.k794b7964.6c391cbc05b64230fbd8defdbb960b131fd433409817497873fb9ffc705cd360.dtIb8VK_HAoAvzi8YbVjGpt2Y8yONsVV7mEiD9DrclQ+ hash: v1.k794b7964.c63132bb5b13cbe97938ebdb2e59e320ebc338bd12b2d3bfd6af81e56270650a.3gc3UBg-8GVo4HkNBH7UrogK2q1uh9pXPDjTdYGT8ncscenes-app-insights-funnels--funnel-left-to-right-edit-viewports--medium--dark:hash: v1.k794b7964.dad9df902a133cafd6b3314a3800fcb45dabbbb59a0766c87c226549392104fc.u8mciTuIKrwI-d3yiUx6dVpr3oLoJJ7tgvRU7hutwhUscenes-app-insights-funnels--funnel-left-to-right-edit-viewports--medium--light:@@ -4901,7 +4905,7 @@ snapshots:scenes-app-insights-funnels--funnel-left-to-right-edit-viewports--wide--dark:hash: v1.k794b7964.293297b83994468984576e5c15fa2cbbb2c4c0a7a8234959b9deba539efa383b.O7SwG4Drfr3z02hcLNC1LsLsGWddouhybBp4xZaUE-Ascenes-app-insights-funnels--funnel-left-to-right-edit-viewports--wide--light:- hash: v1.k794b7964.6c391cbc05b64230fbd8defdbb960b131fd433409817497873fb9ffc705cd360.EIwByuofuT77yP259A9ffqfjSFwW9MrUDOvsZNA_aZM+ hash: v1.k794b7964.c63132bb5b13cbe97938ebdb2e59e320ebc338bd12b2d3bfd6af81e56270650a.KSiw8WpvjWXIDh87ExL4cPnopVJlTXvzU8N8ruh6Hi8scenes-app-insights-funnels--funnel-time-to-convert--dark:hash: v1.k794b7964.d64808d2bfc36017f89b57feeaa373e20188738a622801207fa1beb59d02fdd9.cFuKF_Ow887Z3X3BoNhtTvkUWY2vips9HDBe-B02eQEscenes-app-insights-funnels--funnel-time-to-convert--light:diff --git a/frontend/src/lib/components/CommandBlock/CommandBlock.tsx b/frontend/src/lib/components/CommandBlock/CommandBlock.tsxindex 231e9a3f773b..7995f2c1d18d 100644--- a/frontend/src/lib/components/CommandBlock/CommandBlock.tsx+++ b/frontend/src/lib/components/CommandBlock/CommandBlock.tsx@@ -31,6 +31,9 @@ interface CommandBlockProps {/** Fired after each copy click, with a monotonically increasing key. Lets callers* trigger their own keyed remount animations (e.g. the wizard hedgehog cast). */onCopy?: (copyKey: number) => void+ /** Skip the "Copied … to clipboard" toast. Set when this block lives inside another+ * long-lived toast that would otherwise get pushed around by the success info toast. */+ silentCopy?: boolean}export function CommandBlock({@@ -41,13 +44,14 @@ export function CommandBlock({size = 'md',decoration = 'plain',onCopy,+ silentCopy = false,}: CommandBlockProps): JSX.Element {const [copyKey, setCopyKey] = useState(0)const sizeStyle = SIZE_STYLES[size]const isStorybook = inStorybook() || inStorybookTestRunner()const handleCopy = (): void => {- void copyToClipboard(command, copyLabel)+ void copyToClipboard(command, copyLabel, { silent: silentCopy })const next = copyKey + 1setCopyKey(next)onCopy?.(next)diff --git a/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsx b/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsxindex a13f67ebbd2e..eb5665809e5a 100644--- a/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsx+++ b/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsx@@ -25,8 +25,8 @@ export function AgentBadgeRotator({ className }: { className?: string }): JSX.Elreturn (<span className={cn('inline-flex relative', className)} aria-live="polite"><span- key={AGENTS[index]}- className={cn('font-semibold rainbow-text', {+ key={index}+ className={cn('font-semibold rainbow-text-fading', {'rainbow-text-animating': !isStorybook,})}>diff --git a/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsx b/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsxindex 5b56b156f7f2..d28d821fcf04 100644--- a/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsx+++ b/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsx@@ -26,6 +26,10 @@ export const FeatureFlagsCreate: Story = {args: { surfaceKey: 'feature_flags.create' },}+export const FeatureFlagsUpdateWithName: Story = {+ args: { surfaceKey: 'feature_flags.update', context: { entityName: 'jovan-test-flag' } },+}+export const DashboardsCreate: Story = {args: { surfaceKey: 'dashboards.create' },}diff --git a/frontend/src/lib/components/MCPHint/MCPHintToast.tsx b/frontend/src/lib/components/MCPHint/MCPHintToast.tsxindex 8171ff8678d7..4fe7d9a7c164 100644--- a/frontend/src/lib/components/MCPHint/MCPHintToast.tsx+++ b/frontend/src/lib/components/MCPHint/MCPHintToast.tsx@@ -1,24 +1,17 @@-import { useActions } from 'kea'-import { useState } from 'react'-import { IconSparkles } from '@posthog/icons'-import { Tooltip } from '@posthog/lemon-ui'--import { cn } from 'lib/utils/css-classes'import { AgentBadgeRotator } from './AgentBadgeRotator'-import { mcpHintLogic } from './mcpHintLogic'import { MCPInstallCommand } from './MCPInstallCommand'-import { SURFACE_PROMPTS, type SurfaceKey } from './prompts'--const linkClass =- 'text-xs text-muted hover:text-default underline underline-offset-2 cursor-pointer bg-transparent border-0 !p-0 !m-0'+import { SURFACE_PROMPTS, type SurfaceKey, type SurfacePromptContext } from './prompts'-export function MCPHintToast({ surfaceKey }: { surfaceKey: SurfaceKey }): JSX.Element {- const { dismissSurface, dismissAll } = useActions(mcpHintLogic)- const [showHideOptions, setShowHideOptions] = useState(false)-- const prompt = SURFACE_PROMPTS[surfaceKey].toast+export function MCPHintToast({+ surfaceKey,+ context,+}: {+ surfaceKey: SurfaceKey+ context?: SurfacePromptContext+}): JSX.Element {+ const prompt = SURFACE_PROMPTS[surfaceKey].toast(context)return (<div className="flex flex-col gap-1 py-1 pr-1 text-default min-w-0 items-start">@@ -29,42 +22,7 @@ export function MCPHintToast({ surfaceKey }: { surfaceKey: SurfaceKey }): JSX.El</span></div><div className="text-xs italic text-muted leading-snug">{prompt}</div>- <MCPInstallCommand size="sm" className="mt-1" />- <div className="flex items-baseline flex-wrap">- <button- type="button"- className={linkClass}- onClick={() => setShowHideOptions((v) => !v)}- data-attr="mcp-hint-hide"- >- Hide{showHideOptions ? <> > </> : <> MCP hints</>}- </button>- {showHideOptions && (- <div className="flex items-baseline gap-0.5 ml-1.5">- <Tooltip title="Stop suggesting MCP for this kind of action. You'll still see hints for other actions, at most once a week.">- <button- type="button"- className={linkClass}- onClick={() => dismissSurface(surfaceKey)}- data-attr="mcp-hint-hide-surface"- >- this hint- </button>- </Tooltip>- <span className="text-xs text-muted">/</span>- <Tooltip title="Turn off MCP hints everywhere. If you keep them on, you'll only see one at most per week.">- <button- type="button"- className={cn(linkClass, '!text-danger hover:!opacity-80')}- onClick={() => dismissAll()}- data-attr="mcp-hint-hide-all"- >- all MCP hints- </button>- </Tooltip>- </div>- )}- </div>+ <MCPInstallCommand size="sm" silentCopy /></div>)}diff --git a/frontend/src/lib/components/MCPHint/MCPInstallCommand.tsx b/frontend/src/lib/components/MCPHint/MCPInstallCommand.tsxindex c68283ffffbb..82c1bf344b7c 100644--- a/frontend/src/lib/components/MCPHint/MCPInstallCommand.tsx+++ b/frontend/src/lib/components/MCPHint/MCPInstallCommand.tsx@@ -8,7 +8,16 @@ import { MCP_INSTALL_COMMAND } from './constants'type Size = 'sm' | 'md'-export function MCPInstallCommand({ size = 'sm', className }: { size?: Size; className?: string }): JSX.Element | null {+export function MCPInstallCommand({+ size = 'sm',+ className,+ silentCopy = false,+}: {+ size?: Size+ className?: string+ /** Skip the "Copied … to clipboard" toast (used when the parent is itself a toast). */+ silentCopy?: boolean+}): JSX.Element | null {const { isCloudOrDev } = useValues(preflightLogic)if (!isCloudOrDev) {@@ -22,6 +31,7 @@ export function MCPInstallCommand({ size = 'sm', className }: { size?: Size; claariaLabel="Copy MCP install command"size={size}decoration="rainbow"+ silentCopy={silentCopy}className={cn('bg-surface-secondary border border-primary !m-0 hover:border-accent', className)}/>)diff --git a/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx b/frontend/src/lib/components/MCPHint/mcpHintLogic.tsxindex 00b75d8d4d3a..c9b09c2b9075 100644--- a/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx+++ b/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx@@ -1,7 +1,10 @@import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'import { toast } from 'react-toastify'+import { IconX } from '@posthog/icons'+import { FEATURE_FLAGS } from 'lib/constants'+import { LemonButton } from 'lib/lemon-ui/LemonButton'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { eventUsageLogic } from 'lib/utils/eventUsageLogic'import { userLogic } from 'scenes/userLogic'@@ -10,20 +13,24 @@ import { UserType } from '~/types'import type { mcpHintLogicType } from './mcpHintLogicType'import { MCPHintToast } from './MCPHintToast'-import type { SurfaceKey } from './prompts'+import type { SurfaceKey, SurfacePromptContext } from './prompts'++// In production the toast auto-dismisses after a few seconds so it doesn't linger;+// in development we keep it open so it's easier to inspect.+const AUTO_DISMISS_MS = process.env.NODE_ENV === 'development' ? false : 15000// A full week between hints, regardless of surface — these are promotional,// so we err heavily on the side of not overloading people.const COOLDOWN_MS = 7 * 24 * 60 * 60 * 1000-export function tryShowMCPHint(surfaceKey: SurfaceKey): void {+export function tryShowMCPHint(surfaceKey: SurfaceKey, context?: SurfacePromptContext): void {try {const mounted = mcpHintLogic.findMounted()if (!mounted?.values.featureEnabled) {return}- mounted.actions.tryShowHint(surfaceKey)+ mounted.actions.tryShowHint(surfaceKey, context)} catch (error) {console.warn('[mcpHint] dispatch failed; host listener will continue', { surfaceKey, error })}@@ -36,7 +43,7 @@ export const mcpHintLogic = kea<mcpHintLogicType>([actions: [userLogic, ['updateUser'], eventUsageLogic, ['reportMCPHintShown', 'reportMCPHintDismissed']],})),actions({- tryShowHint: (surfaceKey: SurfaceKey) => ({ surfaceKey }),+ tryShowHint: (surfaceKey: SurfaceKey, context?: SurfacePromptContext) => ({ surfaceKey, context }),recordShown: (now: number) => ({ now }),dismissSurface: (surfaceKey: SurfaceKey) => ({ surfaceKey }),dismissAll: true,@@ -80,7 +87,7 @@ export const mcpHintLogic = kea<mcpHintLogicType>([],}),listeners(({ values, actions }) => ({- tryShowHint: ({ surfaceKey }) => {+ tryShowHint: ({ surfaceKey, context }) => {const now = Date.now()const sinceLast = values.lastShownAt ? now - values.lastShownAt : Infinityconst cooldownActive = values.lastShownAt !== null && sinceLast < COOLDOWN_MS@@ -90,13 +97,27 @@ export const mcpHintLogic = kea<mcpHintLogicType>([}try {- toast.info(<MCPHintToast surfaceKey={surfaceKey} />, {+ toast.info(<MCPHintToast surfaceKey={surfaceKey} context={context} />, {toastId: `mcp-hint-${surfaceKey}-${now}`,- autoClose: false,+ autoClose: AUTO_DISMISS_MS,closeOnClick: false,draggable: false,hideProgressBar: true,icon: false,+ // Clicking the X is the only way to permanently hide this surface — auto-dismiss+ // (timeout) shouldn't count, so we wire dismissSurface here, not in onClose.+ closeButton: ({ closeToast }) => (+ <LemonButton+ type="tertiary"+ size="small"+ icon={<IconX />}+ onClick={(e) => {+ actions.dismissSurface(surfaceKey)+ closeToast(e)+ }}+ data-attr="mcp-hint-close"+ />+ ),})actions.recordShown(now)actions.reportMCPHintShown(surfaceKey)diff --git a/frontend/src/lib/components/MCPHint/prompts.ts b/frontend/src/lib/components/MCPHint/prompts.tsindex 942758b64dce..9a09607bebb5 100644--- a/frontend/src/lib/components/MCPHint/prompts.ts+++ b/frontend/src/lib/components/MCPHint/prompts.ts@@ -18,14 +18,22 @@ export const SURFACE_KEYS = [export type SurfaceKey = (typeof SURFACE_KEYS)[number]+export type SurfacePromptContext = {+ /** Human-readable name/key of the entity the user just acted on (e.g. a feature flag key). */+ entityName?: string+}+export type SurfacePrompts = {- toast: string+ toast: (ctx?: SurfacePromptContext) => stringexamples: string[]}+const quote = (name: string | undefined, fallback: string): string => name?.trim() || fallback+export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {'feature_flags.create': {- toast: '"Create a feature flag called new-checkout rolled out to 20% of users"',+ toast: (ctx) =>+ `"Create a feature flag called ${quote(ctx?.entityName, 'new-checkout')} rolled out to 20% of users"`,examples: ['"Create a feature flag for the new pricing page"','"Roll out checkout-v2 to 25% of EU users"',@@ -33,7 +41,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'feature_flags.update': {- toast: '"Bump rollout for new-checkout to 50%"',+ toast: (ctx) => `"Bump rollout for ${quote(ctx?.entityName, 'new-checkout')} to 50%"`,examples: ['"Bump rollout for new-checkout to 50%"','"Disable beta-banner flag"',@@ -41,7 +49,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'experiments.create': {- toast: '"Create an A/B experiment for the new pricing page"',+ toast: () => '"Create an A/B experiment for the new pricing page"',examples: ['"Create an A/B experiment for the new pricing page"','"Launch a multivariate test on the signup CTA"',@@ -49,7 +57,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'experiments.launch': {- toast: '"Launch experiment pricing-test"',+ toast: (ctx) => `"Launch experiment ${quote(ctx?.entityName, 'pricing-test')}"`,examples: ['"Launch experiment pricing-test"','"Archive the old signup-cta experiment"',@@ -57,7 +65,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'dashboards.create': {- toast: '"Build a retention dashboard for signups last 30 days"',+ toast: () => '"Build a retention dashboard for signups last 30 days"',examples: ['"Build a retention dashboard for signups last 30 days"','"Make me a dashboard tracking checkout funnel drop-off"',@@ -65,7 +73,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'insights.create': {- toast: '"Run a trends query for signup_completed last 30 days"',+ toast: () => '"Run a trends query for signup_completed last 30 days"',examples: ['"Show me sign-up trends for the last 30 days"','"Build a funnel for the onboarding flow"',@@ -73,7 +81,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'surveys.create': {- toast: '"Create an NPS survey targeted at paid users"',+ toast: () => '"Create an NPS survey targeted at paid users"',examples: ['"Create an NPS survey targeted at paid users"','"Ask churned users why they left"',@@ -81,7 +89,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'alerts.create': {- toast: '"Alert me if signups drop more than 20% week over week"',+ toast: () => '"Alert me if signups drop more than 20% week over week"',examples: ['"Alert me if signups drop more than 20% week over week"','"Notify the team when checkout errors spike"',@@ -89,7 +97,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'cohorts.create': {- toast: '"Build a cohort of users who signed up last week and never returned"',+ toast: () => '"Build a cohort of users who signed up last week and never returned"',examples: ['"Build a cohort of users who signed up last week and never returned"','"Make a cohort of EU paid customers"',@@ -97,7 +105,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'actions.create': {- toast: '"Create an action for clicks on the upgrade button"',+ toast: () => '"Create an action for clicks on the upgrade button"',examples: ['"Create an action for clicks on the upgrade button"','"Define a pageview action for the pricing page"',@@ -105,7 +113,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'annotations.create': {- toast: '"Annotate today as the launch of v2 checkout"',+ toast: () => '"Annotate today as the launch of v2 checkout"',examples: ['"Annotate today as the launch of v2 checkout"','"Mark the deploy on the conversion dashboard"',@@ -113,7 +121,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'error_tracking.assign': {- toast: '"Assign all TypeError issues to the frontend team"',+ toast: () => '"Assign all TypeError issues to the frontend team"',examples: ['"Assign all TypeError issues to the frontend team"','"Show me the top 10 unresolved errors this week"',@@ -121,7 +129,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'early_access_features.create': {- toast: '"Create an early-access feature for the new editor"',+ toast: () => '"Create an early-access feature for the new editor"',examples: ['"Create an early-access feature for the new editor"','"Promote ai-suggestions to general availability"',@@ -129,7 +137,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'sql.execute': {- toast: '"Run this SQL: select count() from events where event = $pageview"',+ toast: () => '"Run this SQL: select count() from events where event = $pageview"',examples: ['"How many users viewed the pricing page yesterday?"','"What\'s our DAU trend for the last 90 days?"',@@ -137,7 +145,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {],},'workflows.create': {- toast: '"Build a workflow that emails new signups a welcome message after 1 day"',+ toast: () => '"Build a workflow that emails new signups a welcome message after 1 day"',examples: ['"Build a workflow that emails new signups a welcome message after 1 day"','"Send a Slack alert when a paid user hits the error_rate threshold"',diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 4332f445cb41..acb0567143ab 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -365,7 +365,7 @@ export const FEATURE_FLAGS = {MAX_HANDS_FREE: 'max-hands-free', // owner: #team-posthog-aiMCP_ANALYTICS: 'mcp-analytics', // owner: #project-mcp-analyticsMCP_ANALYTICS_INTENT_ROUTING: 'mcp-analytics-intent-routing', // owner: #project-mcp-analytics- MCP_HINTS: 'mcp-hints', // owner: @rafaeelaudibert #team-growth, gates in-app MCP hint toasts and empty-state cards+ MCP_HINTS: 'mcp-hints', // owner: @rafaeelaudibert #team-growth multivariate=control,testMCP_SERVERS: 'mcp-servers', // owner: #team-posthog-aiMESSAGING_SES: 'messaging-ses', // owner #team-workflowsMETRICS: 'metrics', // owner: #team-apm (@jonmcwest, @frankh)diff --git a/frontend/src/lib/utils/copyToClipboard.tsx b/frontend/src/lib/utils/copyToClipboard.tsxindex b5578cd21a50..90fca957998c 100644--- a/frontend/src/lib/utils/copyToClipboard.tsx+++ b/frontend/src/lib/utils/copyToClipboard.tsx@@ -1,17 +1,28 @@import { IconCopy } from '@posthog/icons'import { lemonToast } from '@posthog/lemon-ui'-export async function copyToClipboard(value: string, description: string = 'text'): Promise<boolean> {+export async function copyToClipboard(+ value: string,+ description: string = 'text',+ { silent = false }: { silent?: boolean } = {}+): Promise<boolean> {if (!navigator.clipboard) {lemonToast.warning('Oops! Clipboard capabilities are only available over HTTPS or on localhost')return false}- try {- await navigator.clipboard.writeText(value)+ const notifySuccess = (): void => {+ if (silent) {+ return+ }lemonToast.info(`Copied ${description} to clipboard`, {icon: <IconCopy />,})+ }++ try {+ await navigator.clipboard.writeText(value)+ notifySuccess()return true} catch {// If the Clipboard API fails, fallback to textarea method@@ -22,9 +33,7 @@ export async function copyToClipboard(value: string, description: string = 'texttextArea.select()document.execCommand('copy')document.body.removeChild(textArea)- lemonToast.info(`Copied ${description} to clipboard`, {- icon: <IconCopy />,- })+ notifySuccess()return true} catch (err) {lemonToast.error(`Could not copy ${description} to clipboard: ${err}`)diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsxindex d65a601cfd4d..e00899f25155 100644--- a/frontend/src/scenes/experiments/experimentLogic.tsx+++ b/frontend/src/scenes/experiments/experimentLogic.tsx@@ -1422,7 +1422,9 @@ export const experimentLogic = kea<experimentLogicType>([actions.refreshExperimentResults(false, 'manual')actions.setUnmodifiedExperiment(structuredClone(experimentWithMetricOrdering))globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.LaunchExperiment)- tryShowMCPHint('experiments.launch')+ tryShowMCPHint('experiments.launch', {+ entityName: values.experiment?.feature_flag_key || values.experiment?.name,+ })} catch (error: any) {lemonToast.error(error.detail || 'Failed to launch experiment')} finally {diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.tsindex e1f2a4c6228b..6491e9d08b3f 100644--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts@@ -1823,7 +1823,9 @@ export const featureFlagLogic = kea<featureFlagLogicType>([},saveFeatureFlagSuccess: ({ featureFlag }) => {lemonToast.success('Feature flag saved')- tryShowMCPHint(props.id === 'new' ? 'feature_flags.create' : 'feature_flags.update')+ tryShowMCPHint(props.id === 'new' ? 'feature_flags.create' : 'feature_flags.update', {+ entityName: featureFlag.key,+ })actions.setFeatureFlag(featureFlag)actions.updateFlag(featureFlag)featureFlag.id && router.actions.replace(urls.featureFlag(featureFlag.id))diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scssindex dc6eb27238f2..36e392ddd86c 100644--- a/frontend/src/styles/base.scss+++ b/frontend/src/styles/base.scss@@ -1087,6 +1087,18 @@--data-color-5: #f0474f;--data-color-6: #b36114;--data-color-10: #6576b3;++ // Rainbow brand gradient (dark mode) — lighter shades so the gradient stays+ // readable inside toasts and command blocks. See light-mode definition below.+ --rainbow-gradient: linear-gradient(+ 90deg,+ #5b8def 0%,+ #7aa6ff 24%,+ #ff7a59 47%,+ #ffa170 66%,+ #ffc55c 83%,+ #5b8def 100%+ );}@layer base {@@ -2067,6 +2079,7 @@// classes below. The text variants use `background-clip: text` so the gradient// fills the glyphs; `*-fading` additionally plays a one-shot fade-in on mount,// useful for elements that swap content via a key change.+// Dark mode override lives in the consolidated `[theme='dark']` block above.:root {--rainbow-gradient: linear-gradient(90deg,diff --git a/posthog/management/commands/sync_feature_flags.py b/posthog/management/commands/sync_feature_flags.pyindex 6c0b91ec221a..a2a93df612c8 100644--- a/posthog/management/commands/sync_feature_flags.py+++ b/posthog/management/commands/sync_feature_flags.py@@ -27,6 +27,8 @@ INACTIVE_FLAGS = ["webhooks-denylist","insight-horizontal-controls","flagged-feature-indicator",+ "read-only-mode",+ "mcp-hints",]