@@ -6,6 +6,7 @@ import type { Container } from '../../../../container';
66import type { SubscriptionChangeEvent } from '../../../../plus/gk/subscriptionService' ;
77import { registerCommand } from '../../../../system/-webview/command' ;
88import { configuration } from '../../../../system/-webview/configuration' ;
9+ import { getHostAppName } from '../../../../system/-webview/vscode' ;
910import { openUrl } from '../../../../system/-webview/vscode/uris' ;
1011import { gate } from '../../../../system/decorators/gate' ;
1112import { Logger } from '../../../../system/logger' ;
@@ -97,10 +98,21 @@ export class GkCliIntegrationProvider implements Disposable {
9798 if ( this . container . telemetry . enabled ) {
9899 this . container . telemetry . sendEvent ( 'mcp/setup/started' , { source : commandSource } ) ;
99100 }
101+ const appName = toMcpInstallProvider ( await getHostAppName ( ) ) ;
102+ if ( appName == null ) {
103+ void window . showInformationMessage ( `Failed to install MCP integration: Could not determine app name` ) ;
104+ if ( this . container . telemetry . enabled ) {
105+ this . container . telemetry . sendEvent ( 'mcp/setup/failed' , {
106+ reason : 'no app name' ,
107+ source : commandSource ,
108+ } ) ;
109+ }
110+ return ;
111+ }
100112
101113 try {
102114 if (
103- ( env . appName === 'Visual Studio Code ' || env . appName === 'Visual Studio Code - Insiders ' ) &&
115+ ( appName === 'vscode ' || appName === 'vscode-insiders' || appName === 'vscode-exploration ') &&
104116 compare ( codeVersion , '1.102' ) < 0
105117 ) {
106118 void window . showInformationMessage ( 'Use of this command requires VS Code 1.102 or later.' ) ;
@@ -113,31 +125,6 @@ export class GkCliIntegrationProvider implements Disposable {
113125 return ;
114126 }
115127
116- let appName = 'vscode' ;
117- switch ( env . appName ) {
118- case 'Visual Studio Code' :
119- break ;
120- case 'Visual Studio Code - Insiders' :
121- appName = 'vscode-insiders' ;
122- break ;
123- case 'Cursor' :
124- appName = 'cursor' ;
125- break ;
126- case 'Windsurf' :
127- appName = 'windsurf' ;
128- break ;
129- default : {
130- void window . showInformationMessage ( `MCP installation is not supported for app: ${ env . appName } ` ) ;
131- if ( this . container . telemetry . enabled ) {
132- this . container . telemetry . sendEvent ( 'mcp/setup/failed' , {
133- reason : 'unsupported app' ,
134- source : commandSource ,
135- } ) ;
136- }
137- return ;
138- }
139- }
140-
141128 let cliInstall = this . container . storage . get ( 'gk:cli:install' ) ;
142129 let cliPath = this . container . storage . get ( 'gk:cli:path' ) ;
143130 let cliProxyFileExists = true ;
@@ -248,6 +235,16 @@ export class GkCliIntegrationProvider implements Disposable {
248235 output = output . trim ( ) ;
249236 if ( output === 'GitKraken MCP Server Successfully Installed!' ) {
250237 return ;
238+ } else if ( output . includes ( 'not a supported MCP client' ) ) {
239+ if ( this . container . telemetry . enabled ) {
240+ this . container . telemetry . sendEvent ( 'mcp/setup/failed' , {
241+ reason : 'unsupported app' ,
242+ 'error.message' : `Not a supported MCP client: ${ appName } ` ,
243+ source : commandSource ,
244+ 'cli.version' : cliVersion ,
245+ } ) ;
246+ }
247+ return ;
251248 }
252249
253250 // Check if the output is a valid url. If so, run it
@@ -662,3 +659,16 @@ class CLIInstallError extends Error {
662659 return message ;
663660 }
664661}
662+
663+ function toMcpInstallProvider ( appHostName : string | undefined ) : string | undefined {
664+ switch ( appHostName ) {
665+ case 'code' :
666+ return 'vscode' ;
667+ case 'code-insiders' :
668+ return 'vscode-insiders' ;
669+ case 'code-exploration' :
670+ return 'vscode-exploration' ;
671+ default :
672+ return appHostName ;
673+ }
674+ }
0 commit comments