diff --git a/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.test.tsx b/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.test.tsx index 6e4d656..bfe1b13 100644 --- a/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.test.tsx +++ b/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.test.tsx @@ -54,7 +54,10 @@ function options(): McpConfigChoiceOption[] { ]; } -function renderDialog(mode: "adopt" | "resolve" = "adopt") { +function renderDialog( + mode: "adopt" | "resolve" = "adopt", + dialogOptions: McpConfigChoiceOption[] = options(), +) { const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } }, }); @@ -66,7 +69,7 @@ function renderDialog(mode: "adopt" | "resolve" = "adopt") { open mode={mode} serverName="context7" - options={options()} + options={dialogOptions} pending={false} onClose={vi.fn()} onConfirm={onConfirm} @@ -91,6 +94,9 @@ describe("McpConfigChoiceDialog", () => { renderDialog(); expect(screen.getByRole("heading", { name: "Choose config to adopt" })).toBeInTheDocument(); + expect(screen.getByText("Observed harness: Cursor")).toBeInTheDocument(); + expect(screen.getByText("Observed harness: Claude")).toBeInTheDocument(); + expect(screen.getByText("Recommended")).toBeInTheDocument(); fireEvent.click(screen.getByText("Claude")); fireEvent.click(screen.getByRole("button", { name: "Adopt" })); @@ -106,4 +112,20 @@ describe("McpConfigChoiceDialog", () => { await waitFor(() => expect(onConfirm).toHaveBeenCalled()); }); + + it("labels managed config options", () => { + const [managed] = options(); + renderDialog("resolve", [ + { + ...managed, + id: "managed", + sourceKind: "managed", + observedHarness: null, + label: "Skill Manager Config", + recommended: false, + }, + ]); + + expect(screen.getByText("Managed MCP config")).toBeInTheDocument(); + }); }); diff --git a/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.tsx b/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.tsx index 7cf04b9..71af9cf 100644 --- a/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.tsx +++ b/frontend/src/features/mcp/components/edit/McpConfigChoiceDialog.tsx @@ -68,6 +68,10 @@ export function McpConfigChoiceDialog({ ? copy.detail.configChoice.adoptDescription : copy.detail.configChoice.resolveDescription; const confirmLabel = mode === "adopt" ? copy.detail.configChoice.adoptConfirm : copy.detail.configChoice.applyConfig; + const sourceLabel = (option: McpConfigChoiceOption) => + option.sourceKind === "managed" + ? copy.detail.configChoice.managedConfig + : copy.detail.configChoice.observedHarness(option.label); async function handleCommit(): Promise { if (!chosen) return; @@ -135,6 +139,7 @@ export function McpConfigChoiceDialog({
{option.label} + {sourceLabel(option)} {isRecommended ? ( {copy.detail.configChoice.recommended} ) : null} diff --git a/frontend/src/features/mcp/i18n.ts b/frontend/src/features/mcp/i18n.ts index 9c7b2ce..50b395a 100644 --- a/frontend/src/features/mcp/i18n.ts +++ b/frontend/src/features/mcp/i18n.ts @@ -165,6 +165,8 @@ const englishMcpCopy = { ariaLabel: (title: string, serverName: string) => `${title} for ${serverName}`, close: "Close config choice dialog", recommended: "Recommended", + observedHarness: (label: string) => `Observed harness: ${label}`, + managedConfig: "Managed MCP config", credentialInUrl: "Credential in URL", noEnvironmentValues: "No environment values", showPreview: "Show config preview", @@ -370,6 +372,8 @@ export const mcpCopy = { ariaLabel: (title: string, serverName: string) => `${serverName}:${title}`, close: "关闭配置选择对话框", recommended: "推荐", + observedHarness: (label: string) => `观察到的 harness:${label}`, + managedConfig: "托管 MCP 配置", credentialInUrl: "URL 中包含凭据", noEnvironmentValues: "没有环境变量值", showPreview: "显示配置预览",