Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
23 changes: 19 additions & 4 deletions src/env/node/gk/mcp/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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) {
Expand All @@ -142,4 +144,17 @@ export class GkMcpProvider implements McpServerDefinitionProvider, Disposable {
'cli.version': cliVersion,
});
}

@debug()
private async uninstallExternalMcp(cliPath: string, appName: string): Promise<void> {
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}`);
}
}
}
Loading