Skip to content

Commit 075937d

Browse files
committed
Uninstalls duplicate GK MCP servers
(#4626, #4746)
1 parent c00c630 commit 075937d

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
7171

7272
### Fixed
7373

74+
- Fixes duplication of GitKraken MCP [#4626](https://github.com/gitkraken/vscode-gitlens/issues/4626)
7475
- Fixes an issue where the _Home_ view would not update when switching repositories ([#4717](https://github.com/gitkraken/vscode-gitlens/issues/4717))
7576
- Fixes intermittent stuck loading state on the _Commit Graph_ ([#4669](https://github.com/gitkraken/vscode-gitlens/issues/4669))
7677
- Fixes underlines showing on home branch actions ([#4703](https://github.com/gitkraken/vscode-gitlens/issues/4703))

src/env/node/gk/mcp/integration.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class GkMcpProvider implements McpServerDefinitionProvider, Disposable {
109109
throw new Error(`Invalid MCP configuration: missing required properties (${output})`);
110110
}
111111

112-
this.onRegistrationCompleted(cliInstall.version);
112+
this.onRegistrationCompleted(cliPath, appName, cliInstall.version);
113113

114114
return {
115115
name: config.name ?? 'GitKraken',
@@ -126,10 +126,12 @@ export class GkMcpProvider implements McpServerDefinitionProvider, Disposable {
126126
return undefined;
127127
}
128128

129-
private onRegistrationCompleted(_cliVersion?: string | undefined) {
130-
if (!this.container.telemetry.enabled) return;
129+
private async onRegistrationCompleted(cliPath: string, appName: string, _cliVersion?: string) {
130+
if (this.container.telemetry.enabled) {
131+
this.container.telemetry.setGlobalAttribute('gk.mcp.registrationCompleted', true);
132+
}
131133

132-
this.container.telemetry.setGlobalAttribute('gk.mcp.registrationCompleted', true);
134+
await this.uninstallExternalMcp(cliPath, appName);
133135
}
134136

135137
private onRegistrationFailed(reason: string, message?: string | undefined, cliVersion?: string | undefined) {
@@ -142,4 +144,17 @@ export class GkMcpProvider implements McpServerDefinitionProvider, Disposable {
142144
'cli.version': cliVersion,
143145
});
144146
}
147+
148+
@debug()
149+
private async uninstallExternalMcp(cliPath: string, appName: string): Promise<void> {
150+
try {
151+
Logger.log(`Uninstalling external MCP configuration for ${appName}...`);
152+
const output = await runCLICommand(['mcp', 'uninstall', appName], {
153+
cwd: cliPath,
154+
});
155+
Logger.log(`External MCP configuration uninstalled successfully: ${output}`);
156+
} catch (ex) {
157+
Logger.warn(`Failed to uninstall external MCP configuration: ${ex}`);
158+
}
159+
}
145160
}

0 commit comments

Comments
 (0)