479
480
export function applyMcpServerEnablement(customizations: readonly Customization[], desired: readonly Customization[]): readonly Customization[] {
481
>
const desiredById = new Map(getEffectiveMcpServerCustomizations(desired).map(server => [server.id, server.enabled]));
mcpCustomizationController.ts
482
>
return customizations.map(customization => {
483
>
if (customization.type === CustomizationType.McpServer) {
484
return applyMcpEnablement(customization, desiredById);
485
}
487
>
const children = customization.children?.map(child => {
488
const next = child.type === CustomizationType.McpServer ? applyMcpEnablement(child, desiredById) : child;
489
changed ||= next !== child;
490
return next;
492
>
return changed ? { ...customization, children } : customization;
493
>
});
494
>
}
495
496
function applyMcpEnablement<T extends McpServerCustomization | Extract<ChildCustomization, { type: CustomizationType.McpServer }>>(customization: T, desiredById: ReadonlyMap<string, boolean>): T {