diff --git a/package.json b/package.json index b3ed2a3c2deb6..6e1d6cf2a60e8 100644 --- a/package.json +++ b/package.json @@ -4197,6 +4197,16 @@ "scope": "window", "order": 50 }, + "gitlens.gitkraken.mcp.experimental.enabled": { + "type": "boolean", + "default": false, + "markdownDescription": "Specifies whether to enable experimental features for the GitKraken MCP server (passes `--experimental` flag to the CLI)", + "scope": "window", + "order": 55, + "tags": [ + "experimental" + ] + }, "gitlens.terminal.overrideGitEditor": { "type": "boolean", "default": true, diff --git a/src/env/node/gk/mcp/integrationBase.ts b/src/env/node/gk/mcp/integrationBase.ts index 62ffbd364d6cf..32db804eb9f4a 100644 --- a/src/env/node/gk/mcp/integrationBase.ts +++ b/src/env/node/gk/mcp/integrationBase.ts @@ -141,9 +141,6 @@ export abstract class GkMcpProviderBase implements Disposable { try { const args = ['mcp', 'config', appName, '--source=gitlens', `--scheme=${env.uriScheme}`]; - if (configuration.get('gitkraken.mcp.experimental.enabled')) { - args.push('--experimental'); - } if (configuration.get('gitkraken.cli.insiders.enabled')) { args.push('--insiders'); } @@ -168,6 +165,12 @@ export abstract class GkMcpProviderBase implements Disposable { throw new Error(`Invalid MCP configuration: missing required properties (${output})`); } + // Append --experimental to the MCP server args (not the config command) + // so the server itself runs with experimental features enabled + if (configuration.get('gitkraken.mcp.experimental.enabled') && !config.args.includes('--experimental')) { + config.args.push('--experimental'); + } + this.onRegistrationCompleted(cliInstall.version); return {