diff --git a/.gitignore b/.gitignore index ced5e09ef008d..8db93c9fc489d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,8 @@ gitlens-*.vsix product.json tsconfig*.tsbuildinfo localdev*.instructions.md +*localdev.instructions.md +localdev*.prompt.md +*localdev.prompt.md +localdev*.chatmode.md +*localdev.chatmode.md diff --git a/CHANGELOG.md b/CHANGELOG.md index a3efdecd64635..463975f01f9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes duplication of GitKraken MCP [#4626](https://github.com/gitkraken/vscode-gitlens/issues/4626) - Fixes an issue where the _Home_ view would not update when switching repositories ([#4717](https://github.com/gitkraken/vscode-gitlens/issues/4717)) - Fixes intermittent stuck loading state on the _Commit Graph_ ([#4669](https://github.com/gitkraken/vscode-gitlens/issues/4669)) - Fixes underlines showing on home branch actions ([#4703](https://github.com/gitkraken/vscode-gitlens/issues/4703)) diff --git a/src/env/node/gk/mcp/integration.ts b/src/env/node/gk/mcp/integration.ts index 94f48e479229f..72003b5de7174 100644 --- a/src/env/node/gk/mcp/integration.ts +++ b/src/env/node/gk/mcp/integration.ts @@ -109,7 +109,7 @@ export class GkMcpProvider implements McpServerDefinitionProvider, Disposable { throw new Error(`Invalid MCP configuration: missing required properties (${output})`); } - this.onRegistrationCompleted(cliInstall.version); + void this.onRegistrationCompleted(cliPath, appName, cliInstall.version); return { name: config.name ?? 'GitKraken', @@ -126,10 +126,12 @@ export class GkMcpProvider implements McpServerDefinitionProvider, Disposable { return undefined; } - private onRegistrationCompleted(_cliVersion?: string | undefined) { - if (!this.container.telemetry.enabled) return; + private async onRegistrationCompleted(cliPath: string, appName: string, _cliVersion?: string) { + if (this.container.telemetry.enabled) { + this.container.telemetry.setGlobalAttribute('gk.mcp.registrationCompleted', true); + } - this.container.telemetry.setGlobalAttribute('gk.mcp.registrationCompleted', true); + await this.uninstallExternalMcp(cliPath, appName); } private onRegistrationFailed(reason: string, message?: string | undefined, cliVersion?: string | undefined) { @@ -142,4 +144,17 @@ export class GkMcpProvider implements McpServerDefinitionProvider, Disposable { 'cli.version': cliVersion, }); } + + @debug() + private async uninstallExternalMcp(cliPath: string, appName: string): Promise { + try { + Logger.log(`Uninstalling external MCP configuration for ${appName}...`); + const output = await runCLICommand(['mcp', 'uninstall', appName], { + cwd: cliPath, + }); + Logger.log(`External MCP configuration uninstalled successfully: ${output}`); + } catch (ex) { + Logger.warn(`Failed to uninstall external MCP configuration: ${ex}`); + } + } }