Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c975069
Adds support for mcp server installation
axosoft-ramint Jun 25, 2025
68d4130
Updates storage key and splits automatic and manual installation subt…
axosoft-ramint Aug 25, 2025
9866673
Adds gates and deeplink command support
axosoft-ramint Aug 25, 2025
e6f1a80
Updates to include new params
axosoft-ramint Aug 26, 2025
8a9c4a7
Updates terminology and adds telemetry
axosoft-ramint Aug 26, 2025
b516f1c
Includes source and CLI version in telemetry
axosoft-ramint Aug 26, 2025
298e760
Uses built-in app name function and always passes to mcp install command
axosoft-ramint Aug 26, 2025
747e708
Improvements from feedback
axosoft-ramint Aug 27, 2025
f44e4c0
Sends status from installCLI
axosoft-ramint Aug 27, 2025
72c5b99
Install command always verifies path existence to proxy
axosoft-ramint Aug 27, 2025
b055ea1
Fixes wording inconsistencies on error messages
axosoft-ramint Aug 27, 2025
7583dea
install -> setup
axosoft-ramint Aug 27, 2025
60d468a
Leaves out auto-install (for now)
axosoft-ramint Aug 27, 2025
57bca03
Points release server to supported environment
axosoft-ramint Aug 27, 2025
32ab1ef
Fixes 'checking for updates' CLI response from causing error with flow
axosoft-ramint Sep 4, 2025
afc433a
Adds messaging to complete setup manually on unsupported apps
axosoft-ramint Sep 4, 2025
ff9eb4e
Updates unsupported app modal and wording
axosoft-ramint Sep 4, 2025
52c24f0
Creates MCP banner and adds to Home and Graph
axosoft-ramint Aug 28, 2025
57592f0
Adds to visual file history
axosoft-ramint Aug 29, 2025
2ed2bba
Updates MCP banner placements
d13 Sep 4, 2025
4ec02e2
Uses constant for help center link
axosoft-ramint Sep 4, 2025
549e6cb
Adds registerMcpServerDefinitionProvider (wip)
d13 Sep 4, 2025
6ef8128
Adds provideMcpServerDefinitions
d13 Sep 5, 2025
421cb84
Update provideMcpServerDefinitions to get MCP config from CLI
d13 Sep 5, 2025
78292e9
Prevents older ide versions throwing errors due to McpProvider
d13 Sep 5, 2025
647687c
Ensures mcp banners are not displayed when automatically registrable
d13 Sep 8, 2025
6a289d4
Consolidates runCLICommand
d13 Sep 8, 2025
83104d0
Removes unused code
d13 Sep 8, 2025
b3ab1c0
Updates GkMcpProvider for mcp registration
d13 Sep 9, 2025
f8cf7b4
Updates banner when gk mcp can be auto registered
d13 Sep 10, 2025
cc31725
Removes unneeded mcp server registration attempt
d13 Sep 10, 2025
29aae3d
Updates mcp provider telemetry and removes unwanted toast
d13 Sep 10, 2025
602773c
Updates checks for cli and mcp auto installation
d13 Sep 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions contributions.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@
"icon": "$(sparkle)",
"commandPalette": "gitlens:enabled && !gitlens:untrusted && gitlens:gk:organization:ai:enabled"
},
"gitlens.ai.mcp.install": {
"label": "Install GitKraken MCP Server",
"commandPalette": "gitlens:enabled && !gitlens:untrusted && gitlens:gk:organization:ai:enabled"
},
"gitlens.ai.rebaseOntoCommit:graph": {
"label": "AI Rebase Current Branch onto Commit (Preview)...",
"icon": "$(sparkle)",
Expand Down
2 changes: 2 additions & 0 deletions docs/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ _{prefix}/command/{command}_

- _inspect_ - Runs the `GitLens: Inspect Commit Details` command.

- _install-mcp_ - Runs the `GitLens: Install MCP` command.

- _login_ - Runs the `GitLens: Sign In to GitKraken...` command.

- _signup_ - Runs the `GitLens: Sign Up for GitKraken...` command.
Expand Down
233 changes: 153 additions & 80 deletions docs/telemetry-events.md

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
}
},
"contributes": {
"mcpServerDefinitionProviders": [
{
"id": "gitlens.gkMcpProvider",
"label": "GitKraken (bundled with GitLens)"
}
],
"configuration": [
{
"id": "current-line-blame",
Expand Down Expand Up @@ -4105,6 +4111,16 @@
"experimental"
]
},
"gitlens.gitkraken.cli.autoInstall.enabled": {
"type": "boolean",
"default": false,
"markdownDescription": "Specifies whether to automatically install the GitKraken CLI",
"scope": "window",
"order": 40,
"tags": [
"experimental"
]
},
"gitlens.terminal.overrideGitEditor": {
"type": "boolean",
"default": true,
Expand Down Expand Up @@ -6296,6 +6312,11 @@
"category": "GitLens",
"icon": "$(sparkle)"
},
{
"command": "gitlens.ai.mcp.install",
"title": "Install GitKraken MCP Server",
"category": "GitLens"
},
{
"command": "gitlens.ai.rebaseOntoCommit:graph",
"title": "AI Rebase Current Branch onto Commit (Preview)...",
Expand Down Expand Up @@ -11070,6 +11091,10 @@
"command": "gitlens.ai.generateRebase",
"when": "gitlens:enabled && !gitlens:untrusted && gitlens:gk:organization:ai:enabled"
},
{
"command": "gitlens.ai.mcp.install",
"when": "gitlens:enabled && !gitlens:untrusted && gitlens:gk:organization:ai:enabled"
},
{
"command": "gitlens.ai.rebaseOntoCommit:graph",
"when": "false"
Expand Down
184 changes: 184 additions & 0 deletions src/@types/vscode.lm.mcp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
* See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

/**
* Type Definition for Visual Studio Code 1.101 Extension API
* See https://code.visualstudio.com/api for more information
*/

declare module 'vscode' {
/**
* McpStdioServerDefinition represents an MCP server available by running
* a local process and operating on its stdin and stdout streams. The process
* will be spawned as a child process of the extension host and by default
* will not run in a shell environment.
*/
export class McpStdioServerDefinition {
/**
* The human-readable name of the server.
*/
readonly label: string;

/**
* The working directory used to start the server.
*/
cwd?: Uri;

/**
* The command used to start the server. Node.js-based servers may use
* `process.execPath` to use the editor's version of Node.js to run the script.
*/
command: string;

/**
* Additional command-line arguments passed to the server.
*/
args: string[];

/**
* Optional additional environment information for the server. Variables
* in this environment will overwrite or remove (if null) the default
* environment variables of the editor's extension host.
*/
env: Record<string, string | number | null>;

/**
* Optional version identification for the server. If this changes, the
* editor will indicate that tools have changed and prompt to refresh them.
*/
version?: string;

/**
* @param label The human-readable name of the server.
* @param command The command used to start the server.
* @param args Additional command-line arguments passed to the server.
* @param env Optional additional environment information for the server.
* @param version Optional version identification for the server.
*/
constructor(
label: string,
command: string,
args?: string[],
env?: Record<string, string | number | null>,
version?: string,
);
}

/**
* McpHttpServerDefinition represents an MCP server available using the
* Streamable HTTP transport.
*/
export class McpHttpServerDefinition {
/**
* The human-readable name of the server.
*/
readonly label: string;

/**
* The URI of the server. The editor will make a POST request to this URI
* to begin each session.
*/
uri: Uri;

/**
* Optional additional heads included with each request to the server.
*/
headers: Record<string, string>;

/**
* Optional version identification for the server. If this changes, the
* editor will indicate that tools have changed and prompt to refresh them.
*/
version?: string;

/**
* @param label The human-readable name of the server.
* @param uri The URI of the server.
* @param headers Optional additional heads included with each request to the server.
*/
constructor(label: string, uri: Uri, headers?: Record<string, string>, version?: string);
}

/**
* Definitions that describe different types of Model Context Protocol servers,
* which can be returned from the {@link McpServerDefinitionProvider}.
*/
export type McpServerDefinition = McpStdioServerDefinition | McpHttpServerDefinition;

/**
* A type that can provide Model Context Protocol server definitions. This
* should be registered using {@link lm.registerMcpServerDefinitionProvider}
* during extension activation.
*/
export interface McpServerDefinitionProvider<T extends McpServerDefinition = McpServerDefinition> {
/**
* Optional event fired to signal that the set of available servers has changed.
*/
readonly onDidChangeMcpServerDefinitions?: Event<void>;

/**
* Provides available MCP servers. The editor will call this method eagerly
* to ensure the availability of servers for the language model, and so
* extensions should not take actions which would require user
* interaction, such as authentication.
*
* @param token A cancellation token.
* @returns An array of MCP available MCP servers
*/
provideMcpServerDefinitions(token: CancellationToken): ProviderResult<T[]>;

/**
* This function will be called when the editor needs to start a MCP server.
* At this point, the extension may take any actions which may require user
* interaction, such as authentication. Any non-`readonly` property of the
* server may be modified, and the extension should return the resolved server.
*
* The extension may return undefined to indicate that the server
* should not be started, or throw an error. If there is a pending tool
* call, the editor will cancel it and return an error message to the
* language model.
*
* @param server The MCP server to resolve
* @param token A cancellation token.
* @returns The resolved server or thenable that resolves to such. This may
* be the given `server` definition with non-readonly properties filled in.
*/
resolveMcpServerDefinition?(server: T, token: CancellationToken): ProviderResult<T>;
}

export namespace lm {
/**
* Registers a provider that publishes Model Context Protocol servers for the editor to
* consume. This allows MCP servers to be dynamically provided to the editor in
* addition to those the user creates in their configuration files.
*
* Before calling this method, extensions must register the `contributes.mcpServerDefinitionProviders`
* extension point with the corresponding {@link id}, for example:
*
* ```js
* "contributes": {
* "mcpServerDefinitionProviders": [
* {
* "id": "cool-cloud-registry.mcp-servers",
* "label": "Cool Cloud Registry",
* }
* ]
* }
* ```
*
* When a new McpServerDefinitionProvider is available, the editor will present a 'refresh'
* action to the user to discover new servers. To enable this flow, extensions should
* call `registerMcpServerDefinitionProvider` during activation.
* @param id The ID of the provider, which is unique to the extension.
* @param provider The provider to register
* @returns A disposable that unregisters the provider when disposed.
*/
export function registerMcpServerDefinitionProvider(
id: string,
provider: McpServerDefinitionProvider,
): Disposable;
}
}
3 changes: 3 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ interface GitKrakenCliConfig {
readonly integration: {
readonly enabled: boolean;
};
readonly autoInstall: {
readonly enabled: boolean;
};
}

export interface GraphConfig {
Expand Down
1 change: 1 addition & 0 deletions src/constants.commands.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ export type ContributedPaletteCommands =
| 'gitlens.ai.generateChangelog'
| 'gitlens.ai.generateCommitMessage'
| 'gitlens.ai.generateRebase'
| 'gitlens.ai.mcp.install'
| 'gitlens.ai.switchProvider'
| 'gitlens.applyPatchFromClipboard'
| 'gitlens.associateIssueWithBranch'
Expand Down
1 change: 1 addition & 0 deletions src/constants.commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ type InternalGlCommands =
| 'gitlens.refreshHover'
| 'gitlens.regenerateMarkdownDocument'
| 'gitlens.showComposerPage'
| 'gitlens.storage.store'
| 'gitlens.toggleFileBlame:codelens'
| 'gitlens.toggleFileBlame:mode'
| 'gitlens.toggleFileBlame:statusbar'
Expand Down
4 changes: 4 additions & 0 deletions src/constants.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ export type GlobalStorage = {
// Value based on `currentOnboardingVersion` in composer's protocol
'composer:onboarding:dismissed': string;
'composer:onboarding:stepReached': number;
'gk:cli:install': { status: 'attempted' | 'unsupported' | 'completed'; attempts: number; version?: string };
'gk:cli:corePath': string;
'gk:cli:path': string;
'home:sections:collapsed': string[];
'home:walkthrough:dismissed': boolean;
'mcp:banner:dismissed': boolean;
'launchpad:groups:collapsed': StoredLaunchpadGroup[];
'launchpad:indicator:hasLoaded': boolean;
'launchpad:indicator:hasInteracted': string;
Expand Down
53 changes: 53 additions & 0 deletions src/constants.telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownE
/** Sent when user opts in to AI All Access */
'aiAllAccess/optedIn': void;

/** Sent when a CLI install attempt is started */
'cli/install/started': CLIInstallStartedEvent;
/** Sent when a CLI install attempt succeeds */
'cli/install/succeeded': CLIInstallSucceededEvent;
/** Sent when a CLI install attempt fails */
'cli/install/failed': CLIInstallFailedEvent;

/** Sent when connecting to one or more cloud-based integrations */
'cloudIntegrations/connecting': CloudIntegrationsConnectingEvent;

Expand Down Expand Up @@ -238,6 +245,13 @@ export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownE
/** Sent when a launchpad operation is taking longer than a set timeout to complete */
'launchpad/operation/slow': LaunchpadOperationSlowEvent;

/** Sent when GitKraken MCP setup is started */
'mcp/setup/started': MCPSetupStartedEvent;
/** Sent when GitKraken MCP setup is completed */
'mcp/setup/completed': MCPSetupCompletedEvent;
/** Sent when GitKraken MCP setup fails */
'mcp/setup/failed': MCPSetupFailedEvent;

/** Sent when a PR review was started in the inspect overview */
openReviewMode: OpenReviewModeEvent;

Expand Down Expand Up @@ -472,6 +486,43 @@ export interface AIFeedbackEvent extends AIEventDataBase {
'unhelpful.custom'?: string;
}

export interface CLIInstallStartedEvent {
source?: Sources;
autoInstall: boolean;
attempts: number;
}

export interface CLIInstallSucceededEvent {
autoInstall: boolean;
attempts: number;
source?: Sources;
version?: string;
}

export interface CLIInstallFailedEvent {
autoInstall: boolean;
attempts: number;
'error.message'?: string;
source?: Sources;
}

export interface MCPSetupStartedEvent {
source: Sources;
}

export interface MCPSetupCompletedEvent {
source: Sources;
'cli.version'?: string;
requiresUserCompletion: boolean;
}

export interface MCPSetupFailedEvent {
source: Sources;
reason: string;
'cli.version'?: string;
'error.message'?: string;
}

interface CloudIntegrationsConnectingEvent {
'integration.ids': string | undefined;
}
Expand Down Expand Up @@ -1169,6 +1220,8 @@ export type Sources =
| 'editor:hover'
| 'feature-badge'
| 'feature-gate'
| 'gk-cli-integration'
| 'gk-mcp-provider'
| 'graph'
| 'home'
| 'inspect'
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const urls = Object.freeze({
githubDiscussions: `https://github.com/gitkraken/vscode-gitlens/discussions/?${utm}`,
helpCenter: `https://help.gitkraken.com/gitlens/gitlens-start-here/?${utm}`,
helpCenterHome: `https://help.gitkraken.com/gitlens/home-view/?${utm}`,
helpCenterMCP: `https://help.gitkraken.com/mcp/mcp-getting-started/?${utm}`,
releaseNotes: `https://help.gitkraken.com/gitlens/gitlens-release-notes-current/?${utm}`,

acceleratePrReviews: `https://help.gitkraken.com/gitlens/gitlens-start-here/?${utm}#accelerate-pr-reviews`,
Expand Down
Loading
Loading