@@ -90,12 +90,11 @@ export class GkCliIntegrationProvider implements Disposable {
90
90
}
91
91
92
92
let appName = 'vscode' ;
93
- let isInsiders = false ;
94
93
switch ( env . appName ) {
95
94
case 'Visual Studio Code' :
96
95
break ;
97
96
case 'Visual Studio Code - Insiders' :
98
- isInsiders = true ;
97
+ appName = 'vscode-insiders' ;
99
98
break ;
100
99
case 'Cursor' :
101
100
appName = 'cursor' ;
@@ -132,35 +131,36 @@ export class GkCliIntegrationProvider implements Disposable {
132
131
return ;
133
132
}
134
133
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
+ }
157
143
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
+ {
159
147
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 ;
163
154
}
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 ) ;
164
164
} catch ( ex ) {
165
165
Logger . error ( `Error during MCP installation: ${ ex } ` , scope ) ;
166
166
0 commit comments