Skip to content

Commit c281871

Browse files
committed
Allows MCP banner to show on all hosts
1 parent c3a337f commit c281871

File tree

3 files changed

+15
-28
lines changed

3 files changed

+15
-28
lines changed

src/plus/gk/utils/-webview/mcp.utils.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
import { lm, version } from 'vscode';
2-
import { getPlatform, isWeb } from '@env/platform';
2+
import { isWeb } from '@env/platform';
33
import type { Container } from '../../../../container';
44
import { configuration } from '../../../../system/-webview/configuration';
5-
import { getHostAppName } from '../../../../system/-webview/vscode';
65
import { satisfies } from '../../../../system/version';
76

8-
export async function isMcpBannerEnabled(container: Container, showAutoRegistration = false): Promise<boolean> {
7+
export function isMcpBannerEnabled(container: Container, showAutoRegistration = false): boolean {
98
// Check if running on web or automatically registrable
109
if (isWeb || (!showAutoRegistration && mcpExtensionRegistrationAllowed())) {
1110
return false;
1211
}
1312

14-
// Check platform
15-
const platform = getPlatform();
16-
if (platform !== 'windows' && platform !== 'macOS' && platform !== 'linux') {
17-
return false;
18-
}
19-
20-
if (container.storage.get('mcp:banner:dismissed', false)) return false;
21-
22-
// Check host app
23-
const hostAppName = await getHostAppName();
24-
const supportedApps = ['code', 'code-insiders', 'cursor', 'windsurf'];
25-
26-
return hostAppName != null && supportedApps.includes(hostAppName);
13+
return !container.storage.get('mcp:banner:dismissed', false);
2714
}
2815

2916
export function supportsMcpExtensionRegistration(): boolean {

src/webviews/home/homeWebview.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
246246

247247
private onStorageChanged(e: StorageChangeEvent) {
248248
if (!e.workspace && e.keys.includes('mcp:banner:dismissed')) {
249-
void this.onMcpBannerChanged();
249+
this.onMcpBannerChanged();
250250
}
251251
}
252252

@@ -802,8 +802,8 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
802802
return this.container.storage.get('home:sections:collapsed')?.includes('feb2025AmaBanner') ?? false;
803803
}
804804

805-
private async getMcpBannerCollapsed() {
806-
return !(await isMcpBannerEnabled(this.container, true));
805+
private getMcpBannerCollapsed() {
806+
return !isMcpBannerEnabled(this.container, true);
807807
}
808808

809809
private getMcpCanAutoRegister() {
@@ -901,7 +901,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
901901
previewEnabled: this.getPreviewEnabled(),
902902
newInstall: getContext('gitlens:install:new', false),
903903
amaBannerCollapsed: this.getAmaBannerCollapsed(),
904-
mcpBannerCollapsed: await this.getMcpBannerCollapsed(),
904+
mcpBannerCollapsed: this.getMcpBannerCollapsed(),
905905
mcpCanAutoRegister: this.getMcpCanAutoRegister(),
906906
};
907907
}
@@ -1136,11 +1136,11 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
11361136
void this.host.notify(DidChangeAiAllAccessBanner, await this.getAiAllAccessBannerCollapsed());
11371137
}
11381138

1139-
private async onMcpBannerChanged() {
1139+
private onMcpBannerChanged() {
11401140
if (!this.host.visible) return;
11411141

11421142
void this.host.notify(DidChangeMcpBanner, {
1143-
mcpBannerCollapsed: await this.getMcpBannerCollapsed(),
1143+
mcpBannerCollapsed: this.getMcpBannerCollapsed(),
11441144
mcpCanAutoRegister: this.getMcpCanAutoRegister(),
11451145
});
11461146
}

src/webviews/plus/graph/graphWebview.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,18 +1040,18 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
10401040

10411041
private onStorageChanged(e: StorageChangeEvent) {
10421042
if (!e.workspace && e.keys.includes('mcp:banner:dismissed')) {
1043-
void this.onMcpBannerChanged();
1043+
this.onMcpBannerChanged();
10441044
}
10451045
}
10461046

1047-
private async onMcpBannerChanged() {
1047+
private onMcpBannerChanged() {
10481048
if (!this.host.visible) return;
10491049

1050-
void this.host.notify(DidChangeMcpBanner, await this.getMcpBannerCollapsed());
1050+
void this.host.notify(DidChangeMcpBanner, this.getMcpBannerCollapsed());
10511051
}
10521052

1053-
private async getMcpBannerCollapsed() {
1054-
return !(await isMcpBannerEnabled(this.container));
1053+
private getMcpBannerCollapsed() {
1054+
return !isMcpBannerEnabled(this.container);
10551055
}
10561056

10571057
private onThemeChanged(theme: ColorTheme) {
@@ -2792,7 +2792,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
27922792
useNaturalLanguageSearch: useNaturalLanguageSearch,
27932793
featurePreview: featurePreview,
27942794
orgSettings: this.getOrgSettings(),
2795-
mcpBannerCollapsed: await this.getMcpBannerCollapsed(),
2795+
mcpBannerCollapsed: this.getMcpBannerCollapsed(),
27962796
};
27972797
}
27982798

0 commit comments

Comments
 (0)