@codingame/monaco-vscode-mcp-service-override 31.0.0 → 32.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +1 -1
  3. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +2 -2
  4. package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +7 -11
  5. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
  6. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +80 -80
  7. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +25 -25
  8. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +47 -25
  9. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
  10. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
  11. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +72 -0
  12. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +1023 -0
  13. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.d.ts +17 -0
  14. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +49 -0
  15. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.d.ts +5 -0
  16. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +12 -0
  17. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +88 -0
  18. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +372 -0
  19. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +11 -11
  20. package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServerEditor.css +98 -0
  21. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +6 -5
  22. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +2 -2
  23. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +3 -3
  24. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.js +2 -2
  25. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceDotMcpDiscovery.d.ts +21 -0
  26. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceDotMcpDiscovery.js +92 -0
  27. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +2 -2
  28. package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
  29. package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +10 -8
  30. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +14 -14
  31. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
  32. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +11 -11
  33. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +4 -4
  34. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
  35. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +28 -3
  36. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +88 -3
  37. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
  38. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +0 -59
  39. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +0 -576
  40. package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServersView.css +0 -53
@@ -1,11 +1,12 @@
1
1
  import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
2
  import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
3
- import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
3
+ import { IObservable, IReader, ITransaction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
4
4
  import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
5
5
  import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
6
6
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
7
7
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
8
- import { EnablementModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement";
8
+ import { ContributionEnablementState, EnablementModel, IEnablementModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement";
9
+ import { McpCollisionBehavior } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration";
9
10
  import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
10
11
  import { McpServerMetadataCache } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpServer";
11
12
  import { IAutostartResult, IMcpServer, McpCollectionDefinition } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
@@ -23,7 +24,7 @@ export declare class McpService extends Disposable implements IMcpService {
23
24
  state: import("@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes").LazyCollectionState;
24
25
  collections: McpCollectionDefinition[];
25
26
  }>;
26
- readonly enablementModel: EnablementModel;
27
+ readonly enablementModel: McpCollisionEnablementModel;
27
28
  protected readonly userCache: McpServerMetadataCache;
28
29
  protected readonly workspaceCache: McpServerMetadataCache;
29
30
  constructor(_instantiationService: IInstantiationService, _mcpRegistry: IMcpRegistry, _logService: ILogService, configurationService: IConfigurationService, storageService: IStorageService);
@@ -37,3 +38,27 @@ export declare class McpService extends Disposable implements IMcpService {
37
38
  updateCollectedServers(): void;
38
39
  dispose(): void;
39
40
  }
41
+ /**
42
+ * Wraps an {@link EnablementModel} with collision-aware defaults and
43
+ * mutual-exclusion logic for MCP servers with the same label.
44
+ *
45
+ * When collision behavior is `disable`:
46
+ * - Servers whose label collides with a higher-priority server are disabled
47
+ * by default (unless the user has explicitly toggled them).
48
+ * - Enabling a colliding server disables all other servers with the same label.
49
+ *
50
+ * When collision behavior is `suffix`, delegates everything unchanged.
51
+ */
52
+ export declare class McpCollisionEnablementModel implements IEnablementModel {
53
+ private readonly _base;
54
+ /**
55
+ * For each server definition ID, the list of all definition IDs that share
56
+ * the same (case-insensitive) label, in priority order (lowest collection
57
+ * order first). Empty when collision behavior is `suffix`.
58
+ */
59
+ private readonly _collisionGroups;
60
+ constructor(_base: EnablementModel, registry: IMcpRegistry, collisionBehavior: IObservable<McpCollisionBehavior>);
61
+ readEnabled(key: string, reader?: IReader): ContributionEnablementState;
62
+ setEnabled(key: string, state: ContributionEnablementState, tx?: ITransaction): void;
63
+ remove(key: string): void;
64
+ }
@@ -8,9 +8,11 @@ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
8
8
  import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
9
9
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
10
10
  import { mcpAutoStartConfig, McpAutoStartValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement';
11
+ import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
11
12
  import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
12
13
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
13
- import { EnablementModel, isContributionEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
14
+ import { EnablementModel, isContributionEnabled, ContributionEnablementState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
15
+ import { mcpServerCollisionBehaviorSection, McpCollisionBehavior } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
14
16
  import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
15
17
  import { McpServerMetadataCache, McpServer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpServer';
16
18
  import { IAutostartResult, McpConnectionState, McpServerCacheState, McpStartServerInteraction, UserInteractionRequiredError, McpServerDefinition, McpToolName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
@@ -18,6 +20,7 @@ import { startServerAndWaitForLiveTools } from '@codingame/monaco-vscode-api/vsc
18
20
  import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
19
21
  import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
20
22
  import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
23
+ import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
21
24
 
22
25
  let McpService = class McpService extends Disposable {
23
26
  get lazyCollectionState() {
@@ -38,7 +41,13 @@ let McpService = class McpService extends Disposable {
38
41
  this._currentAutoStarts = ( new Set());
39
42
  this._servers = observableValue(this, []);
40
43
  this.servers = ( this._servers.map(servers => ( servers.map(s => s.object))));
41
- this.enablementModel = this._register(( new EnablementModel("mcp.enablement", storageService)));
44
+ const baseEnablement = this._register(( new EnablementModel("mcp.enablement", storageService)));
45
+ const collisionBehavior = observableConfigValue(
46
+ mcpServerCollisionBehaviorSection,
47
+ McpCollisionBehavior.Disable,
48
+ configurationService
49
+ );
50
+ this.enablementModel = ( new McpCollisionEnablementModel(baseEnablement, this._mcpRegistry, collisionBehavior));
42
51
  this.userCache = this._register(
43
52
  _instantiationService.createInstance(McpServerMetadataCache, StorageScope.PROFILE)
44
53
  );
@@ -225,5 +234,81 @@ class McpPrefixGenerator {
225
234
  return toolPrefix;
226
235
  }
227
236
  }
237
+ class McpCollisionEnablementModel {
238
+ constructor(_base, registry, collisionBehavior) {
239
+ this._base = _base;
240
+ this._collisionGroups = derived(reader => {
241
+ if (collisionBehavior.read(reader) !== McpCollisionBehavior.Disable) {
242
+ return ( new Map());
243
+ }
244
+ const collections = registry.collections.read(reader);
245
+ const labelToIds = ( new Map());
246
+ for (const collection of collections) {
247
+ for (const server of collection.serverDefinitions.read(reader)) {
248
+ const key = server.label.toLowerCase();
249
+ let ids = labelToIds.get(key);
250
+ if (!ids) {
251
+ ids = [];
252
+ labelToIds.set(key, ids);
253
+ }
254
+ ids.push(server.id);
255
+ }
256
+ }
257
+ const groups = ( new Map());
258
+ for (const ids of ( labelToIds.values())) {
259
+ if (ids.length < 2) {
260
+ continue;
261
+ }
262
+ for (const id of ids) {
263
+ groups.set(id, ids);
264
+ }
265
+ }
266
+ return groups;
267
+ });
268
+ }
269
+ readEnabled(key, reader) {
270
+ const baseState = this._base.readEnabled(key, reader);
271
+ if (!isContributionEnabled(baseState)) {
272
+ return baseState;
273
+ }
274
+ const group = this._collisionGroups.read(reader).get(key);
275
+ if (!group) {
276
+ return baseState;
277
+ }
278
+ for (const otherId of group) {
279
+ if (otherId === key) {
280
+ return baseState;
281
+ }
282
+ if (isContributionEnabled(this._base.readEnabled(otherId, reader))) {
283
+ return ContributionEnablementState.DisabledProfile;
284
+ }
285
+ }
286
+ return baseState;
287
+ }
288
+ setEnabled(key, state, tx) {
289
+ const isEnabling = state === ContributionEnablementState.EnabledProfile || state === ContributionEnablementState.EnabledWorkspace;
290
+ const group = isEnabling ? this._collisionGroups.get().get(key) : undefined;
291
+ if (!group) {
292
+ this._base.setEnabled(key, state, tx);
293
+ return;
294
+ }
295
+ const updateGroup = innerTx => {
296
+ this._base.setEnabled(key, state, innerTx);
297
+ for (const otherId of group) {
298
+ if (otherId !== key) {
299
+ this._base.setEnabled(otherId, ContributionEnablementState.DisabledWorkspace, innerTx);
300
+ }
301
+ }
302
+ };
303
+ if (tx) {
304
+ updateGroup(tx);
305
+ } else {
306
+ transaction(innerTx => updateGroup(innerTx));
307
+ }
308
+ }
309
+ remove(key) {
310
+ this._base.remove(key);
311
+ }
312
+ }
228
313
 
229
- export { McpService };
314
+ export { McpCollisionEnablementModel, McpService };
@@ -120,7 +120,7 @@ let AuthenticationMcpService = class AuthenticationMcpService extends Disposable
120
120
  numberOfRequests += ( Object.keys(accessRequest)).length;
121
121
  });
122
122
  if (numberOfRequests > 0) {
123
- const badge = ( new NumberBadge(numberOfRequests, () => ( localize(16022, "Sign in requested"))));
123
+ const badge = ( new NumberBadge(numberOfRequests, () => ( localize(16328, "Sign in requested"))));
124
124
  this._accountBadgeDisposable.value = this.activityService.showAccountsActivity({
125
125
  badge
126
126
  });
@@ -194,17 +194,17 @@ let AuthenticationMcpService = class AuthenticationMcpService extends Disposable
194
194
  } = await this.dialogService.prompt({
195
195
  type: Severity.Info,
196
196
  message: ( localize(
197
- 16023,
197
+ 16329,
198
198
  "The MCP server '{0}' wants to access the {1} account '{2}'.",
199
199
  mcpServerName,
200
200
  provider.label,
201
201
  accountName
202
202
  )),
203
203
  buttons: [{
204
- label: ( localize(16024, "&&Allow")),
204
+ label: ( localize(16330, "&&Allow")),
205
205
  run: () => SessionPromptChoice.Allow
206
206
  }, {
207
- label: ( localize(16025, "&&Deny")),
207
+ label: ( localize(16331, "&&Deny")),
208
208
  run: () => SessionPromptChoice.Deny
209
209
  }],
210
210
  cancelButton: {
@@ -246,17 +246,17 @@ let AuthenticationMcpService = class AuthenticationMcpService extends Disposable
246
246
  }
247
247
  });
248
248
  items.push({
249
- label: ( localize(16026, "Sign in to another account"))
249
+ label: ( localize(16332, "Sign in to another account"))
250
250
  });
251
251
  quickPick.items = items;
252
252
  quickPick.title = ( localize(
253
- 16027,
253
+ 16333,
254
254
  "The MCP server '{0}' wants to access a {1} account",
255
255
  mcpServerName,
256
256
  this._authenticationService.getProvider(providerId).label
257
257
  ));
258
258
  quickPick.placeholder = ( localize(
259
- 16028,
259
+ 16334,
260
260
  "Select an account for '{0}' to use or Esc to cancel",
261
261
  mcpServerName
262
262
  ));
@@ -336,7 +336,7 @@ let AuthenticationMcpService = class AuthenticationMcpService extends Disposable
336
336
  group: "3_accessRequests",
337
337
  command: {
338
338
  id: `${providerId}${mcpServerId}Access`,
339
- title: ( localize(16029, "Grant access to {0} for {1}... (1)", provider.label, mcpServerName))
339
+ title: ( localize(16335, "Grant access to {0} for {1}... (1)", provider.label, mcpServerName))
340
340
  }
341
341
  }));
342
342
  const accessCommand = CommandsRegistry.registerCommand({
@@ -380,7 +380,7 @@ let AuthenticationMcpService = class AuthenticationMcpService extends Disposable
380
380
  group: "2_signInRequests",
381
381
  command: {
382
382
  id: commandId,
383
- title: ( localize(16030, "Sign in with {0} to use {1} (1)", provider.label, mcpServerName))
383
+ title: ( localize(16336, "Sign in with {0} to use {1} (1)", provider.label, mcpServerName))
384
384
  }
385
385
  }));
386
386
  const signInCommand = CommandsRegistry.registerCommand({
@@ -1,59 +0,0 @@
1
- import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
2
- import { IPagedModel } from "@codingame/monaco-vscode-api/vscode/vs/base/common/paging";
3
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
4
- import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
5
- import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
6
- import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
7
- import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
8
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
9
- import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
10
- import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
11
- import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
12
- import { IViewletViewOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/views/viewsViewlet";
13
- import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service";
14
- import { IWorkbenchMcpServer } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
15
- import { IMcpWorkbenchService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service";
16
- import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
17
- import { AbstractExtensionsListView } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/browser/extensionsViews";
18
- import { IWorkbenchLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service";
19
- import { IMcpGalleryManifestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest.service";
20
- import { IMarkdownRendererService } from "@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service";
21
- import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
22
- export interface McpServerListViewOptions {
23
- showWelcome?: boolean;
24
- }
25
- export declare class McpServersListView extends AbstractExtensionsListView<IWorkbenchMcpServer> {
26
- private readonly mpcViewOptions;
27
- private readonly dialogService;
28
- private readonly mcpWorkbenchService;
29
- protected readonly mcpGalleryManifestService: IMcpGalleryManifestService;
30
- private readonly layoutService;
31
- protected readonly markdownRendererService: IMarkdownRendererService;
32
- private readonly logService;
33
- private list;
34
- private listContainer;
35
- private welcomeContainer;
36
- private bodyTemplate;
37
- private readonly contextMenuActionRunner;
38
- private readonly modalNavigationDisposable;
39
- private input;
40
- constructor(mpcViewOptions: McpServerListViewOptions, options: IViewletViewOptions, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, instantiationService: IInstantiationService, themeService: IThemeService, hoverService: IHoverService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, viewDescriptorService: IViewDescriptorService, openerService: IOpenerService, dialogService: IDialogService, mcpWorkbenchService: IMcpWorkbenchService, mcpGalleryManifestService: IMcpGalleryManifestService, layoutService: IWorkbenchLayoutService, markdownRendererService: IMarkdownRendererService, logService: ILogService);
41
- protected renderBody(container: HTMLElement): void;
42
- private onContextMenu;
43
- protected layoutBody(height: number, width: number): void;
44
- show(query: string): Promise<IPagedModel<IWorkbenchMcpServer>>;
45
- private renderInput;
46
- private showWelcomeContent;
47
- private createWelcomeContent;
48
- private updateBody;
49
- private query;
50
- private mergeChangedMcpServers;
51
- }
52
- export declare class DefaultBrowseMcpServersView extends McpServersListView {
53
- protected renderBody(container: HTMLElement): void;
54
- show(): Promise<IPagedModel<IWorkbenchMcpServer>>;
55
- }
56
- export declare class McpServersViewsContribution extends Disposable implements IWorkbenchContribution {
57
- static ID: string;
58
- constructor();
59
- }