@@ -260,6 +260,7 @@ export class GkCliIntegrationProvider implements Disposable {
260260
261261 // Check using stat to make sure the newly extracted file exists.
262262 await workspace . fs . stat ( mcpExtractedPath ) ;
263+ await this . container . storage . store ( 'ai:mcp:installPath' , mcpExtractedFolderPath . fsPath ) ;
263264 } catch ( error ) {
264265 const errorMsg = `Failed to extract MCP installer: ${ error } ` ;
265266 Logger . error ( errorMsg ) ;
@@ -397,31 +398,13 @@ export class GkCliIntegrationProvider implements Disposable {
397398 throw new Error ( errorMsg ) ;
398399 }
399400 } finally {
400- // Always clean up downloaded/extracted files, even if something failed
401401 if ( mcpInstallerPath != null ) {
402402 try {
403403 await workspace . fs . delete ( mcpInstallerPath ) ;
404404 } catch ( error ) {
405405 Logger . warn ( `Failed to delete MCP installer zip file: ${ error } ` ) ;
406406 }
407407 }
408-
409- if ( mcpExtractedPath != null ) {
410- try {
411- await workspace . fs . delete ( mcpExtractedPath ) ;
412- } catch ( error ) {
413- Logger . warn ( `Failed to delete MCP extracted executable: ${ error } ` ) ;
414- }
415- }
416-
417- if ( mcpExtractedFolderPath != null ) {
418- try {
419- await workspace . fs . delete ( Uri . joinPath ( mcpExtractedFolderPath , 'README.md' ) ) ;
420- await workspace . fs . delete ( mcpExtractedFolderPath ) ;
421- } catch ( error ) {
422- Logger . warn ( `Failed to delete MCP extracted folder: ${ error } ` ) ;
423- }
424- }
425408 }
426409 } ;
427410
@@ -458,13 +441,14 @@ export class GkCliIntegrationProvider implements Disposable {
458441
459442 private async onSubscriptionChanged ( e : SubscriptionChangeEvent ) : Promise < void > {
460443 const mcpInstallStatus = this . container . storage . get ( 'ai:mcp:attemptInstall' ) ;
461- const mcpDirectoryPath = this . container . storage . get ( 'gk:cli:installedPath' ) ;
444+ const mcpInstallPath = this . container . storage . get ( 'ai:mcp:installPath' ) ;
445+
462446 const platform = getPlatform ( ) ;
463447 if (
464448 e . current ?. account ?. id != null &&
465449 e . current . account . id !== e . previous ?. account ?. id &&
466450 mcpInstallStatus === 'completed' &&
467- mcpDirectoryPath != null
451+ mcpInstallPath != null
468452 ) {
469453 const currentSessionToken = ( await this . container . subscription . getAuthenticationSession ( ) ) ?. accessToken ;
470454 if ( currentSessionToken != null ) {
@@ -473,7 +457,7 @@ export class GkCliIntegrationProvider implements Disposable {
473457 platform === 'windows' ? 'gk.exe' : './gk' ,
474458 [ 'auth' , 'login' , '-t' , currentSessionToken ] ,
475459 'utf8' ,
476- { cwd : mcpDirectoryPath } ,
460+ { cwd : mcpInstallPath } ,
477461 ) ;
478462 } catch { }
479463 }
0 commit comments