@@ -90,12 +90,11 @@ export class GkCliIntegrationProvider implements Disposable {
9090 }
9191
9292 let appName = 'vscode' ;
93- let isInsiders = false ;
9493 switch ( env . appName ) {
9594 case 'Visual Studio Code' :
9695 break ;
9796 case 'Visual Studio Code - Insiders' :
98- isInsiders = true ;
97+ appName = 'vscode-insiders' ;
9998 break ;
10099 case 'Cursor' :
101100 appName = 'cursor' ;
@@ -132,35 +131,36 @@ export class GkCliIntegrationProvider implements Disposable {
132131 return ;
133132 }
134133
135- // TODO: REMOVE THIS ONCE VSCODE-INSIDERS IS ADDED AS AN OFFICIAL PROVIDER TO MCP INSTALL COMMAND
136- if ( appName === 'vscode' && isInsiders ) {
137- const mcpFileName = getPlatform ( ) === 'windows' ? 'gk.exe' : 'gk' ;
138- const mcpProxyPath = Uri . joinPath ( Uri . file ( mcpPath ) , mcpFileName ) ;
139- const config = {
140- name : 'GitKraken' ,
141- command : mcpProxyPath . fsPath ,
142- args : [ 'mcp' ] ,
143- type : 'stdio' ,
144- } ;
145- const installDeepLinkUrl = `vscode-insiders:mcp/install?${ encodeURIComponent ( JSON . stringify ( config ) ) } ` ;
146- await openUrl ( installDeepLinkUrl ) ;
147- } else {
148- if ( appName !== 'cursor' && appName !== 'vscode' ) {
149- const confirmation = await window . showInformationMessage (
150- `MCP configured successfully. Click 'Finish' to add it to your MCP server list and complete the installation.` ,
151- { modal : true } ,
152- { title : 'Finish' } ,
153- { title : 'Cancel' , isCloseAffordance : true } ,
154- ) ;
155- if ( confirmation == null || confirmation . title === 'Cancel' ) return ;
156- }
134+ if ( appName !== 'cursor' && appName !== 'vscode' ) {
135+ const confirmation = await window . showInformationMessage (
136+ `MCP configured successfully. Click 'Finish' to add it to your MCP server list and complete the installation.` ,
137+ { modal : true } ,
138+ { title : 'Finish' } ,
139+ { title : 'Cancel' , isCloseAffordance : true } ,
140+ ) ;
141+ if ( confirmation == null || confirmation . title === 'Cancel' ) return ;
142+ }
157143
158- const _output = await this . runMcpCommand ( [ 'mcp' , 'install' , appName , '--source=gitlens' ] , {
144+ let output = await this . runMcpCommand (
145+ [ 'mcp' , 'install' , appName , '--source=gitlens' , `--scheme=${ env . uriScheme } ` ] ,
146+ {
159147 cwd : mcpPath ,
160- } ) ;
161- // TODO: GET THE INSTALL LINK FROM THE OUTPUT IF IT EXISTS AND OPEN IT.
162- // CURRENTLY THE CLI TRIES TO DO SO BUT THE LINK DOES NOT WORK SINCE IT IS IN THE CHILD PROCESS.
148+ } ,
149+ ) ;
150+
151+ output = output . trim ( ) ;
152+ if ( output === 'GitKraken MCP Server Successfully Installed!' ) {
153+ return ;
163154 }
155+
156+ // Check if the output is a valid url. If so, run it
157+ try {
158+ new URL ( output ) ;
159+ } catch {
160+ throw new Error ( 'Failed to install MCP integration: unexpected output from mcp install command' ) ;
161+ }
162+
163+ await openUrl ( output ) ;
164164 } catch ( ex ) {
165165 Logger . error ( `Error during MCP installation: ${ ex } ` , scope ) ;
166166
0 commit comments