Disable MCP discovery options based on mutual exclusivity in config section

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Gabrielsv01 2026-05-04 23:03:14 -03:00
parent a6a13b701c
commit 6e8e346964
2 changed files with 12 additions and 1 deletions

View file

@ -310,6 +310,9 @@ export function MCPSection({
hint={t("pages.config.mcp_discovery_use_bm25_hint")}
layout="setting-row"
checked={form.mcpDiscoveryUseBM25}
disabled={
form.mcpDiscoveryUseBM25 && !form.mcpDiscoveryUseRegex
}
onCheckedChange={(checked) =>
onFieldChange("mcpDiscoveryUseBM25", checked)
}
@ -320,6 +323,9 @@ export function MCPSection({
hint={t("pages.config.mcp_discovery_use_regex_hint")}
layout="setting-row"
checked={form.mcpDiscoveryUseRegex}
disabled={
form.mcpDiscoveryUseRegex && !form.mcpDiscoveryUseBM25
}
onCheckedChange={(checked) =>
onFieldChange("mcpDiscoveryUseRegex", checked)
}

View file

@ -180,7 +180,12 @@ function mapMCPServers(value: unknown): MCPServerForm[] {
? cfg.args.filter((item): item is string => typeof item === "string")
: []
const url = asString(cfg.url)
const type = cfg.type === undefined ? (url ? "sse" : "stdio") : toMCPServerType(cfg.type)
const type =
cfg.type === undefined
? url
? "sse"
: "stdio"
: toMCPServerType(cfg.type)
const env = asRecord(cfg.env)
const headers = asRecord(cfg.headers)