From 17b24e8c7b15fb2c27932d66e56b40a07f108132 Mon Sep 17 00:00:00 2001 From: Gabrielsv01 Date: Wed, 6 May 2026 10:55:01 -0300 Subject: [PATCH] fix(config): correct MCP discovery merge patch behavior --- .../src/components/config/config-page.tsx | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/web/frontend/src/components/config/config-page.tsx b/web/frontend/src/components/config/config-page.tsx index 469ec34d8..d099346c7 100644 --- a/web/frontend/src/components/config/config-page.tsx +++ b/web/frontend/src/components/config/config-page.tsx @@ -268,18 +268,26 @@ export function ConfigPage() { ) const mcpDiscoveryValidationEnabled = form.mcpEnabled && form.mcpDiscoveryEnabled - const mcpDiscoveryTTL = mcpDiscoveryValidationEnabled - ? parseIntField(form.mcpDiscoveryTTL, "MCP discovery ttl", { + const mcpDiscoveryPatch: Record = { + enabled: form.mcpDiscoveryEnabled, + use_bm25: form.mcpDiscoveryUseBM25, + use_regex: form.mcpDiscoveryUseRegex, + } + + if (mcpDiscoveryValidationEnabled) { + mcpDiscoveryPatch.ttl = parseIntField( + form.mcpDiscoveryTTL, + "MCP discovery ttl", + { min: 0, - }) - : Number.parseInt(EMPTY_FORM.mcpDiscoveryTTL, 10) - const mcpDiscoveryMaxSearchResults = mcpDiscoveryValidationEnabled - ? parseIntField( - form.mcpDiscoveryMaxSearchResults, - "MCP discovery max search results", - { min: 0 }, - ) - : Number.parseInt(EMPTY_FORM.mcpDiscoveryMaxSearchResults, 10) + }, + ) + mcpDiscoveryPatch.max_search_results = parseIntField( + form.mcpDiscoveryMaxSearchResults, + "MCP discovery max search results", + { min: 0 }, + ) + } const execConfigPatch: Record = { enabled: form.execEnabled, } @@ -328,10 +336,7 @@ export function ConfigPage() { .map((name) => [name, null] as const) const upsertServerEntries = normalizedServers.map((server) => { - const deferredPatch = - server.deferredOverride === null - ? {} - : { deferred: server.deferredOverride } + const deferredPatch = { deferred: server.deferredOverride } if (server.type !== "stdio") { if (server.url === "") { @@ -447,13 +452,7 @@ export function ConfigPage() { exec: execConfigPatch, mcp: { enabled: form.mcpEnabled, - discovery: { - enabled: form.mcpDiscoveryEnabled, - ttl: mcpDiscoveryTTL, - max_search_results: mcpDiscoveryMaxSearchResults, - use_bm25: form.mcpDiscoveryUseBM25, - use_regex: form.mcpDiscoveryUseRegex, - }, + discovery: mcpDiscoveryPatch, servers: mcpServersPatch, }, },