@@ -260,6 +260,7 @@ export class GkCliIntegrationProvider implements Disposable {
260
260
261
261
// Check using stat to make sure the newly extracted file exists.
262
262
await workspace . fs . stat ( mcpExtractedPath ) ;
263
+ await this . container . storage . store ( 'ai:mcp:installPath' , mcpExtractedFolderPath . fsPath ) ;
263
264
} catch ( error ) {
264
265
const errorMsg = `Failed to extract MCP installer: ${ error } ` ;
265
266
Logger . error ( errorMsg ) ;
@@ -397,31 +398,13 @@ export class GkCliIntegrationProvider implements Disposable {
397
398
throw new Error ( errorMsg ) ;
398
399
}
399
400
} finally {
400
- // Always clean up downloaded/extracted files, even if something failed
401
401
if ( mcpInstallerPath != null ) {
402
402
try {
403
403
await workspace . fs . delete ( mcpInstallerPath ) ;
404
404
} catch ( error ) {
405
405
Logger . warn ( `Failed to delete MCP installer zip file: ${ error } ` ) ;
406
406
}
407
407
}
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
- }
425
408
}
426
409
} ;
427
410
@@ -458,13 +441,14 @@ export class GkCliIntegrationProvider implements Disposable {
458
441
459
442
private async onSubscriptionChanged ( e : SubscriptionChangeEvent ) : Promise < void > {
460
443
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
+
462
446
const platform = getPlatform ( ) ;
463
447
if (
464
448
e . current ?. account ?. id != null &&
465
449
e . current . account . id !== e . previous ?. account ?. id &&
466
450
mcpInstallStatus === 'completed' &&
467
- mcpDirectoryPath != null
451
+ mcpInstallPath != null
468
452
) {
469
453
const currentSessionToken = ( await this . container . subscription . getAuthenticationSession ( ) ) ?. accessToken ;
470
454
if ( currentSessionToken != null ) {
@@ -473,7 +457,7 @@ export class GkCliIntegrationProvider implements Disposable {
473
457
platform === 'windows' ? 'gk.exe' : './gk' ,
474
458
[ 'auth' , 'login' , '-t' , currentSessionToken ] ,
475
459
'utf8' ,
476
- { cwd : mcpDirectoryPath } ,
460
+ { cwd : mcpInstallPath } ,
477
461
) ;
478
462
} catch { }
479
463
}
0 commit comments