Skip to content

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

Rename switch for MCP inline charts in admin settings (#75859)

Phoomparin Manobe2fb45f223b
diff --git a/e2e/test/scenarios/metabot/mcp-apps-settings.cy.spec.ts b/e2e/test/scenarios/metabot/mcp-apps-settings.cy.spec.ts
index baa9291ed14..fc92930fe22 100644
--- a/e2e/test/scenarios/metabot/mcp-apps-settings.cy.spec.ts
+++ b/e2e/test/scenarios/metabot/mcp-apps-settings.cy.spec.ts
@@ -10,7 +10,7 @@ describe("admin > MCP apps settings > Cursor install link", () => {
cy.visit("/admin/metabot/mcp");
H.main().within(() => {
- cy.findByText("Supported MCP clients").scrollIntoView();
+ cy.findByText("Show inline charts in these MCP clients").scrollIntoView();
cy.log("link is hidden by default");
cy.findByRole("link", { name: "Install in Cursor" }).should("not.exist");
diff --git a/frontend/src/metabase/admin/ai/McpAppsSettings.tsx b/frontend/src/metabase/admin/ai/McpAppsSettings.tsx
index 000d0d33df6..472d3ebb157 100644
--- a/frontend/src/metabase/admin/ai/McpAppsSettings.tsx
+++ b/frontend/src/metabase/admin/ai/McpAppsSettings.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useState } from "react";
+import { type ReactNode, useCallback, useState } from "react";
import { jt, t } from "ttag";
import { SettingsSection } from "metabase/admin/components/SettingsSection";
@@ -11,27 +11,35 @@ import { Box, Flex, Stack, Switch, Text, TextInput } from "metabase/ui";
import { CursorInstallLink } from "./CursorInstallLink";
import { McpServerUrlSection } from "./MCPServerUrlSection";
-const getMcpClients = (enabledClients: string[]) =>
- [
- {
- key: "claude",
- label: t`Claude`,
- },
- {
- key: "cursor-vscode",
- label: (
- <Stack gap="xs">
- <span>{t`Cursor and VS Code`}</span>
+type McpClient = {
+ key: string;
+ label: ReactNode;
+ ariaLabel: string;
+};
- {enabledClients.includes("cursor-vscode") && <CursorInstallLink />}
- </Stack>
- ),
- },
- {
- key: "chatgpt",
- label: t`ChatGPT`,
- },
- ] as const;
+const getMcpClients = (enabledClients: string[]): McpClient[] => [
+ {
+ key: "claude",
+ label: t`Claude`,
+ ariaLabel: t`Claude`,
+ },
+ {
+ key: "cursor-vscode",
+ label: (
+ <Stack gap="xs">
+ <span>{t`Cursor and VS Code`}</span>
+
+ {enabledClients.includes("cursor-vscode") && <CursorInstallLink />}
+ </Stack>
+ ),
+ ariaLabel: t`Cursor and VS Code`,
+ },
+ {
+ key: "chatgpt",
+ label: t`ChatGPT`,
+ ariaLabel: t`ChatGPT`,
+ },
+];
export const McpAppsSettings = ({ id }: { id?: string }) => {
const {
@@ -114,13 +122,14 @@ function CommonMcpClientsSection() {
<Box>
<SettingHeader
id="common-mcp-clients"
- title={t`Supported MCP clients`}
- description={t`Select which MCP clients you want to allow. Their sandbox domains will be automatically added to the CORS allowlist.`}
+ title={t`Show inline charts in these MCP clients`}
+ description={t`Select which MCP clients can display inline charts generated by Metabase. Their sandbox domains will be automatically added to the CORS allowlist.`}
/>
<Stack gap="md" mt="md">
- {mcpClients.map(({ key, label }) => (
+ {mcpClients.map(({ key, label, ariaLabel }) => (
<Switch
key={key}
+ aria-label={ariaLabel}
data-testid={`mcp-client-${key}`}
checked={enabledClients.includes(key)}
onChange={(e) => handleToggle(key, e.target.checked)}
@@ -154,8 +163,8 @@ function CustomMcpOriginsSection() {
<Box>
<SettingHeader
id="custom-mcp-origins"
- title={t`Custom MCP client domains`}
- description={t`For self-hosted MCP clients. Separate values with a space.`}
+ title={t`Custom inline chart origins`}
+ description={t`Add custom origins for MCP clients that should display inline charts. Separate values with a space.`}
/>
<TextInput
mt="md"
diff --git a/frontend/src/metabase/admin/ai/McpAppsSettings.unit.spec.tsx b/frontend/src/metabase/admin/ai/McpAppsSettings.unit.spec.tsx
index 21c03249273..88b02b45de4 100644
--- a/frontend/src/metabase/admin/ai/McpAppsSettings.unit.spec.tsx
+++ b/frontend/src/metabase/admin/ai/McpAppsSettings.unit.spec.tsx
@@ -65,9 +65,38 @@ describe("McpAppsSettings", () => {
it("should show all MCP client toggles", async () => {
await setup();
- expect(await screen.findByText("Claude")).toBeInTheDocument();
- expect(await screen.findByText("Cursor and VS Code")).toBeInTheDocument();
- expect(await screen.findByText("ChatGPT")).toBeInTheDocument();
+ expect(
+ await screen.findByText("Show inline charts in these MCP clients"),
+ ).toBeInTheDocument();
+
+ expect(
+ await screen.findByText(
+ "Select which MCP clients can display inline charts generated by Metabase. Their sandbox domains will be automatically added to the CORS allowlist.",
+ ),
+ ).toBeInTheDocument();
+
+ expect(
+ await screen.findByRole("switch", { name: "Claude" }),
+ ).toBeInTheDocument();
+ expect(
+ await screen.findByRole("switch", { name: "Cursor and VS Code" }),
+ ).toBeInTheDocument();
+ expect(
+ await screen.findByRole("switch", { name: "ChatGPT" }),
+ ).toBeInTheDocument();
+ });
+
+ it("should show custom inline chart origins copy", async () => {
+ await setup();
+
+ expect(
+ await screen.findByText("Custom inline chart origins"),
+ ).toBeInTheDocument();
+ expect(
+ await screen.findByText(
+ "Add custom origins for MCP clients that should display inline charts. Separate values with a space.",
+ ),
+ ).toBeInTheDocument();
});
it("can toggle all MCP clients on", async () => {
@@ -87,6 +116,22 @@ describe("McpAppsSettings", () => {
});
});
+ it("shows 'Install in Cursor' link only when the Cursor and VS Code switch is enabled", async () => {
+ await setup();
+
+ expect(
+ screen.queryByRole("link", { name: "Install in Cursor" }),
+ ).not.toBeInTheDocument();
+
+ await userEvent.click(
+ await screen.findByRole("switch", { name: "Cursor and VS Code" }),
+ );
+
+ expect(
+ await screen.findByRole("link", { name: "Install in Cursor" }),
+ ).toBeInTheDocument();
+ });
+
it("can update custom origins on blur", async () => {
await setup();