From bc563bee07c6d97d526d40eafb1b85830355287a Mon Sep 17 00:00:00 2001 From: Itay Paz Date: Sun, 8 Jun 2025 14:40:54 +0300 Subject: [PATCH] Add support in ai mcp config --- src/main/wrapper/CxConstants.ts | 4 +++- src/main/wrapper/CxWrapper.ts | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/wrapper/CxConstants.ts b/src/main/wrapper/CxConstants.ts index 13eb042e..7c97c64e 100644 --- a/src/main/wrapper/CxConstants.ts +++ b/src/main/wrapper/CxConstants.ts @@ -108,5 +108,7 @@ export enum CxConstants { STATE_CONFIRMED = "confirmed", CMD_LEARN_MORE = "learn-more", IDE_SCANS_KEY = " scan.config.plugins.ideScans", - AI_GUIDED_REMEDIATION_KEY = " scan.config.plugins.aiGuidedRemediation" + AI_GUIDED_REMEDIATION_KEY = " scan.config.plugins.aiGuidedRemediation", + AI_MCP_SERVER_KEY = "scan.config.plugins.aiMcpServer" + } diff --git a/src/main/wrapper/CxWrapper.ts b/src/main/wrapper/CxWrapper.ts index 18028455..eb1ecdf8 100644 --- a/src/main/wrapper/CxWrapper.ts +++ b/src/main/wrapper/CxWrapper.ts @@ -369,6 +369,16 @@ export class CxWrapper { return output.has(CxConstants.AI_GUIDED_REMEDIATION_KEY) && output.get(CxConstants.AI_GUIDED_REMEDIATION_KEY).toLowerCase() === " true"; } + + async aiMcpServerEnabled(): Promise { + const commands: string[] = [CxConstants.CMD_UTILS, CxConstants.SUB_CMD_TENANT]; + commands.push(...this.initializeCommands(false)); + const exec = new ExecutionService(); + const output = await exec.executeMapTenantOutputCommands(this.config.pathToExecutable, commands); + return output.has(CxConstants.AI_MCP_SERVER_KEY) && + output.get(CxConstants.AI_MCP_SERVER_KEY).toLowerCase() === "true"; +} + async kicsChat(apikey: string, file: string, line: number, severity: string, vulnerability: string, input: string, conversationId?: string, model?: string): Promise { const commands: string[] = [ CxConstants.CMD_CHAT,