From 7cf4eed8e0fe0f92483b013957f29143e001c80f Mon Sep 17 00:00:00 2001 From: nikolay-1986 Date: Tue, 7 Apr 2026 13:39:47 +0600 Subject: [PATCH] Fixes MCP experimental flag being passed to wrong command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `--experimental` flag was being passed to `gk mcp config` (the configuration query command) instead of being appended to the MCP server's runtime args. The CLI's `mcp config` subcommand does not support `--experimental` (warns "unknown flag") and never includes it in the returned args, so the MCP server was always started without experimental features regardless of the setting. Moves `--experimental` injection from the config query args to the returned `config.args` array, so the MCP server itself receives the flag at startup — matching the behavior of manual mcp.json configuration. Also registers the `gitlens.gitkraken.mcp.experimental.enabled` setting in package.json so VS Code recognizes it as a valid configuration. Co-Authored-By: Claude Opus 4.6 --- package.json | 10 ++++++++++ src/env/node/gk/mcp/integrationBase.ts | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) 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 {