fix(config): correct MCP discovery merge patch behavior
This commit is contained in:
parent
7c989ce26c
commit
17b24e8c7b
1 changed files with 21 additions and 22 deletions
|
|
@ -268,18 +268,26 @@ export function ConfigPage() {
|
||||||
)
|
)
|
||||||
const mcpDiscoveryValidationEnabled =
|
const mcpDiscoveryValidationEnabled =
|
||||||
form.mcpEnabled && form.mcpDiscoveryEnabled
|
form.mcpEnabled && form.mcpDiscoveryEnabled
|
||||||
const mcpDiscoveryTTL = mcpDiscoveryValidationEnabled
|
const mcpDiscoveryPatch: Record<string, unknown> = {
|
||||||
? parseIntField(form.mcpDiscoveryTTL, "MCP discovery ttl", {
|
enabled: form.mcpDiscoveryEnabled,
|
||||||
|
use_bm25: form.mcpDiscoveryUseBM25,
|
||||||
|
use_regex: form.mcpDiscoveryUseRegex,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mcpDiscoveryValidationEnabled) {
|
||||||
|
mcpDiscoveryPatch.ttl = parseIntField(
|
||||||
|
form.mcpDiscoveryTTL,
|
||||||
|
"MCP discovery ttl",
|
||||||
|
{
|
||||||
min: 0,
|
min: 0,
|
||||||
})
|
},
|
||||||
: Number.parseInt(EMPTY_FORM.mcpDiscoveryTTL, 10)
|
)
|
||||||
const mcpDiscoveryMaxSearchResults = mcpDiscoveryValidationEnabled
|
mcpDiscoveryPatch.max_search_results = parseIntField(
|
||||||
? parseIntField(
|
|
||||||
form.mcpDiscoveryMaxSearchResults,
|
form.mcpDiscoveryMaxSearchResults,
|
||||||
"MCP discovery max search results",
|
"MCP discovery max search results",
|
||||||
{ min: 0 },
|
{ min: 0 },
|
||||||
)
|
)
|
||||||
: Number.parseInt(EMPTY_FORM.mcpDiscoveryMaxSearchResults, 10)
|
}
|
||||||
const execConfigPatch: Record<string, unknown> = {
|
const execConfigPatch: Record<string, unknown> = {
|
||||||
enabled: form.execEnabled,
|
enabled: form.execEnabled,
|
||||||
}
|
}
|
||||||
|
|
@ -328,10 +336,7 @@ export function ConfigPage() {
|
||||||
.map((name) => [name, null] as const)
|
.map((name) => [name, null] as const)
|
||||||
|
|
||||||
const upsertServerEntries = normalizedServers.map((server) => {
|
const upsertServerEntries = normalizedServers.map((server) => {
|
||||||
const deferredPatch =
|
const deferredPatch = { deferred: server.deferredOverride }
|
||||||
server.deferredOverride === null
|
|
||||||
? {}
|
|
||||||
: { deferred: server.deferredOverride }
|
|
||||||
|
|
||||||
if (server.type !== "stdio") {
|
if (server.type !== "stdio") {
|
||||||
if (server.url === "") {
|
if (server.url === "") {
|
||||||
|
|
@ -447,13 +452,7 @@ export function ConfigPage() {
|
||||||
exec: execConfigPatch,
|
exec: execConfigPatch,
|
||||||
mcp: {
|
mcp: {
|
||||||
enabled: form.mcpEnabled,
|
enabled: form.mcpEnabled,
|
||||||
discovery: {
|
discovery: mcpDiscoveryPatch,
|
||||||
enabled: form.mcpDiscoveryEnabled,
|
|
||||||
ttl: mcpDiscoveryTTL,
|
|
||||||
max_search_results: mcpDiscoveryMaxSearchResults,
|
|
||||||
use_bm25: form.mcpDiscoveryUseBM25,
|
|
||||||
use_regex: form.mcpDiscoveryUseRegex,
|
|
||||||
},
|
|
||||||
servers: mcpServersPatch,
|
servers: mcpServersPatch,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue