Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Hide feedback buttons for MCP Apps when not on cloud (#74742)

Phoomparin Manoa0f8e76a887c
diff --git a/frontend/src/metabase/embedding/mcp/McpCardFooter.tsx b/frontend/src/metabase/embedding/mcp/McpCardFooter.tsx
index d5dcc11e328..1b7cc2a3075 100644
--- a/frontend/src/metabase/embedding/mcp/McpCardFooter.tsx
+++ b/frontend/src/metabase/embedding/mcp/McpCardFooter.tsx
@@ -11,6 +11,7 @@ export interface McpCardFooterProps {
app: App | null;
footerStyle: CSSProperties;
instanceUrl: string;
+ isFeedbackEnabled: boolean;
isSubmittingFeedback: boolean;
onSelectFeedback: (feedback: McpFeedbackChoice) => void;
submittedFeedback: McpFeedbackChoice | null;
@@ -20,6 +21,7 @@ export const McpCardFooter = ({
app,
footerStyle,
instanceUrl,
+ isFeedbackEnabled,
isSubmittingFeedback,
onSelectFeedback,
submittedFeedback,
@@ -32,11 +34,13 @@ export const McpCardFooter = ({
style={footerStyle}
>
<Flex align="center" gap="xs">
- <McpFeedbackButtons
- isSubmitting={isSubmittingFeedback}
- submittedFeedback={submittedFeedback}
- onSelectFeedback={onSelectFeedback}
- />
+ {isFeedbackEnabled && (
+ <McpFeedbackButtons
+ isSubmitting={isSubmittingFeedback}
+ submittedFeedback={submittedFeedback}
+ onSelectFeedback={onSelectFeedback}
+ />
+ )}
</Flex>
<McpExploreButton app={app} instanceUrl={instanceUrl} />
diff --git a/frontend/src/metabase/embedding/mcp/McpCardFooter.unit.spec.tsx b/frontend/src/metabase/embedding/mcp/McpCardFooter.unit.spec.tsx
new file mode 100644
index 00000000000..4dd660ac0ca
--- /dev/null
+++ b/frontend/src/metabase/embedding/mcp/McpCardFooter.unit.spec.tsx
@@ -0,0 +1,41 @@
+import { renderWithProviders, screen } from "__support__/ui";
+
+import { McpCardFooter } from "./McpCardFooter";
+
+jest.mock("./McpExploreButton", () => ({
+ McpExploreButton: () => <button>Explore in Metabase</button>,
+}));
+
+function setup({ isFeedbackEnabled }: { isFeedbackEnabled: boolean }) {
+ renderWithProviders(
+ <McpCardFooter
+ app={null}
+ footerStyle={{}}
+ instanceUrl=""
+ isFeedbackEnabled={isFeedbackEnabled}
+ isSubmittingFeedback={false}
+ onSelectFeedback={jest.fn()}
+ submittedFeedback={null}
+ />,
+ );
+}
+
+describe("McpCardFooter", () => {
+ it("shows feedback choices when feedback is enabled", () => {
+ setup({ isFeedbackEnabled: true });
+
+ expect(screen.getByTestId("mcp-feedback-thumbs-up")).toBeInTheDocument();
+ expect(screen.getByTestId("mcp-feedback-thumbs-down")).toBeInTheDocument();
+ });
+
+ it("hides feedback choices when feedback is not enabled", () => {
+ setup({ isFeedbackEnabled: false });
+
+ expect(
+ screen.queryByTestId("mcp-feedback-thumbs-up"),
+ ).not.toBeInTheDocument();
+ expect(
+ screen.queryByTestId("mcp-feedback-thumbs-down"),
+ ).not.toBeInTheDocument();
+ });
+});
diff --git a/frontend/src/metabase/embedding/mcp/McpUiAppRoute.tsx b/frontend/src/metabase/embedding/mcp/McpUiAppRoute.tsx
index 2a7c21b6f95..034f83027d1 100644
--- a/frontend/src/metabase/embedding/mcp/McpUiAppRoute.tsx
+++ b/frontend/src/metabase/embedding/mcp/McpUiAppRoute.tsx
@@ -4,6 +4,8 @@ import { SdkError } from "embedding-sdk-bundle/components/private/PublicComponen
import { ComponentProvider } from "embedding-sdk-bundle/components/public/ComponentProvider";
import { SdkQuestion } from "embedding-sdk-bundle/components/public/SdkQuestion";
import { getSdkStore } from "embedding-sdk-bundle/store";
+import { useSelector } from "metabase/redux";
+import { getIsHosted } from "metabase/setup";
import { Flex } from "metabase/ui";
import type { ResolvedColorScheme } from "metabase/utils/color-scheme";
@@ -97,6 +99,7 @@ function McpUiAppRouteContent({
sessionToken,
}: McpUiAppRouteContentProps) {
const handleDrillThrough = useHandleMcpDrillThrough(app);
+ const isHosted = useSelector(getIsHosted);
const { mcpSessionId = "" } =
(window.metabaseConfig as McpMetabaseConfig) ?? {};
@@ -192,6 +195,7 @@ function McpUiAppRouteContent({
app={app}
footerStyle={footerStyle}
instanceUrl={instanceUrl}
+ isFeedbackEnabled={Boolean(isHosted)}
isSubmittingFeedback={isSubmittingFeedback}
onSelectFeedback={setSelectedFeedback}
submittedFeedback={submittedFeedback}