@codingame/monaco-vscode-mcp-service-override 26.0.1 → 26.1.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-mcp-service-override",
3
- "version": "26.0.1",
3
+ "version": "26.1.1",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - mcp service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "26.0.1"
18
+ "@codingame/monaco-vscode-api": "26.1.1"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -10,6 +10,8 @@ import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/pla
10
10
  import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service";
11
11
  import { StorageScope } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage";
12
12
  import { IWorkspaceFolderData } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace";
13
+ import { IWorkspaceTrustRequestService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service";
14
+ import { IWorkspaceTrustManagementService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service";
13
15
  import { IConfigurationResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service";
14
16
  import { IResolvedValue } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolverExpression";
15
17
  import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
@@ -25,6 +27,8 @@ export declare class McpRegistry extends Disposable implements IMcpRegistry {
25
27
  private readonly _quickInputService;
26
28
  private readonly _labelService;
27
29
  private readonly _logService;
30
+ private readonly _workspaceTrustManagementService;
31
+ private readonly _workspaceTrustRequestService;
28
32
  readonly _serviceBrand: undefined;
29
33
  private readonly _collections;
30
34
  private readonly _delegates;
@@ -40,7 +44,7 @@ export declare class McpRegistry extends Disposable implements IMcpRegistry {
40
44
  get delegates(): IObservable<readonly IMcpHostDelegate[]>;
41
45
  private readonly _onDidChangeInputs;
42
46
  readonly onDidChangeInputs: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
43
- constructor(_instantiationService: IInstantiationService, _configurationResolverService: IConfigurationResolverService, _dialogService: IDialogService, _notificationService: INotificationService, _editorService: IEditorService, configurationService: IConfigurationService, _quickInputService: IQuickInputService, _labelService: ILabelService, _logService: ILogService);
47
+ constructor(_instantiationService: IInstantiationService, _configurationResolverService: IConfigurationResolverService, _dialogService: IDialogService, _notificationService: INotificationService, _editorService: IEditorService, configurationService: IConfigurationService, _quickInputService: IQuickInputService, _labelService: ILabelService, _logService: ILogService, _workspaceTrustManagementService: IWorkspaceTrustManagementService, _workspaceTrustRequestService: IWorkspaceTrustRequestService);
44
48
  registerDelegate(delegate: IMcpHostDelegate): IDisposable;
45
49
  registerCollection(collection: McpCollectionDefinition): IDisposable;
46
50
  getServerDefinition(collectionRef: McpDefinitionReference, definitionRef: McpDefinitionReference): IObservable<{
@@ -24,6 +24,7 @@ import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/pla
24
24
  import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
25
25
  import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
26
26
  import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
27
+ import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service';
27
28
  import { IConfigurationResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service';
28
29
  import { ConfigurationResolverExpression } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolverExpression';
29
30
  import { AUX_WINDOW_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
@@ -31,7 +32,7 @@ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench
31
32
  import { IMcpDevModeDebugging } from './mcpDevMode.service.js';
32
33
  import { McpRegistryInputStorage } from './mcpRegistryInputStorage.js';
33
34
  import { McpServerConnection } from './mcpServerConnection.js';
34
- import { LazyCollectionState, McpServerTrust, UserInteractionRequiredError, McpStartServerInteraction } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
35
+ import { LazyCollectionState, UserInteractionRequiredError, McpServerTrust, McpStartServerInteraction } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
35
36
  import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
36
37
  import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
37
38
  import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
@@ -51,7 +52,9 @@ let McpRegistry = class McpRegistry extends Disposable {
51
52
  configurationService,
52
53
  _quickInputService,
53
54
  _labelService,
54
- _logService
55
+ _logService,
56
+ _workspaceTrustManagementService,
57
+ _workspaceTrustRequestService
55
58
  ) {
56
59
  super();
57
60
  this._instantiationService = _instantiationService;
@@ -62,6 +65,8 @@ let McpRegistry = class McpRegistry extends Disposable {
62
65
  this._quickInputService = _quickInputService;
63
66
  this._labelService = _labelService;
64
67
  this._logService = _logService;
68
+ this._workspaceTrustManagementService = _workspaceTrustManagementService;
69
+ this._workspaceTrustRequestService = _workspaceTrustRequestService;
65
70
  this._collections = observableValue("collections", []);
66
71
  this._delegates = observableValue("delegates", []);
67
72
  this.collections = derived(reader => {
@@ -215,6 +220,15 @@ let McpRegistry = class McpRegistry extends Disposable {
215
220
  errorOnUserInteraction = false
216
221
  }
217
222
  ) {
223
+ if (collection.scope === StorageScope.WORKSPACE && !this._workspaceTrustManagementService.isWorkspaceTrusted()) {
224
+ if (errorOnUserInteraction) {
225
+ throw ( new UserInteractionRequiredError("workspaceTrust"));
226
+ } else if (!(await this._workspaceTrustRequestService.requestWorkspaceTrust({
227
+ message: ( localize(9350, "This MCP server definition is defined in your workspace files."))
228
+ }))) {
229
+ return false;
230
+ }
231
+ }
218
232
  if (collection.trustBehavior === McpServerTrust.Kind.Trusted) {
219
233
  this._logService.trace(`MCP server ${definition.id} is trusted, no trust prompt needed`);
220
234
  return true;
@@ -288,7 +302,7 @@ let McpRegistry = class McpRegistry extends Disposable {
288
302
  const originURI = r.definition.presentation?.origin?.uri || r.collection.presentation?.origin;
289
303
  let labelWithOrigin = originURI ? `[\`${r.definition.label}\`](${originURI})` : "`" + r.definition.label + "`";
290
304
  if (r.collection.source instanceof ExtensionIdentifier) {
291
- labelWithOrigin += ` (${( localize(9350, "from {0}", r.collection.source.value))})`;
305
+ labelWithOrigin += ` (${( localize(9351, "from {0}", r.collection.source.value))})`;
292
306
  }
293
307
  return labelWithOrigin;
294
308
  }
@@ -298,12 +312,12 @@ let McpRegistry = class McpRegistry extends Disposable {
298
312
  const {
299
313
  result
300
314
  } = await this._dialogService.prompt({
301
- message: ( localize(9351, "Trust and run MCP server {0}?", def.definition.label)),
315
+ message: ( localize(9352, "Trust and run MCP server {0}?", def.definition.label)),
302
316
  custom: {
303
317
  icon: Codicon.shield,
304
318
  markdownDetails: [{
305
319
  markdown: ( new MarkdownString(( localize(
306
- 9352,
320
+ 9353,
307
321
  "The MCP server {0} was updated. MCP servers may add context to your chat session and lead to unexpected behavior. Do you want to trust and run this server?",
308
322
  labelFor(def)
309
323
  )))),
@@ -316,10 +330,10 @@ let McpRegistry = class McpRegistry extends Disposable {
316
330
  }]
317
331
  },
318
332
  buttons: [{
319
- label: ( localize(9353, "Trust")),
333
+ label: ( localize(9354, "Trust")),
320
334
  run: () => true
321
335
  }, {
322
- label: ( localize(9354, "Do not trust")),
336
+ label: ( localize(9355, "Do not trust")),
323
337
  run: () => false
324
338
  }]
325
339
  });
@@ -329,12 +343,12 @@ let McpRegistry = class McpRegistry extends Disposable {
329
343
  const {
330
344
  result
331
345
  } = await this._dialogService.prompt({
332
- message: ( localize(9355, "Trust and run {0} MCP servers?", definitions.length)),
346
+ message: ( localize(9356, "Trust and run {0} MCP servers?", definitions.length)),
333
347
  custom: {
334
348
  icon: Codicon.shield,
335
349
  markdownDetails: [{
336
350
  markdown: ( new MarkdownString(( localize(
337
- 9356,
351
+ 9357,
338
352
  "Several updated MCP servers were discovered:\n\n{0}\n\n MCP servers may add context to your chat session and lead to unexpected behavior. Do you want to trust and run these server?",
339
353
  list
340
354
  )))),
@@ -347,13 +361,13 @@ let McpRegistry = class McpRegistry extends Disposable {
347
361
  }]
348
362
  },
349
363
  buttons: [{
350
- label: ( localize(9353, "Trust")),
364
+ label: ( localize(9354, "Trust")),
351
365
  run: () => "all"
352
366
  }, {
353
- label: ( localize(9357, "Pick Trusted")),
367
+ label: ( localize(9358, "Pick Trusted")),
354
368
  run: () => "pick"
355
369
  }, {
356
- label: ( localize(9354, "Do not trust")),
370
+ label: ( localize(9355, "Do not trust")),
357
371
  run: () => "none"
358
372
  }]
359
373
  });
@@ -510,14 +524,14 @@ let McpRegistry = class McpRegistry extends Disposable {
510
524
  }
511
525
  this._notificationService.notify({
512
526
  severity: Severity.Error,
513
- message: ( localize(9358, "Error starting {0}: {1}", definition.label, String(e))),
527
+ message: ( localize(9359, "Error starting {0}: {1}", definition.label, String(e))),
514
528
  actions: {
515
529
  primary: collection.presentation?.origin && [{
516
530
  id: "mcp.launchError.openConfig",
517
531
  class: undefined,
518
532
  enabled: true,
519
533
  tooltip: "",
520
- label: ( localize(9359, "Open Configuration")),
534
+ label: ( localize(9360, "Open Configuration")),
521
535
  run: () => this._editorService.openEditor({
522
536
  resource: collection.presentation.origin,
523
537
  options: {
@@ -541,6 +555,6 @@ let McpRegistry = class McpRegistry extends Disposable {
541
555
  );
542
556
  }
543
557
  };
544
- McpRegistry = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IConfigurationResolverService)), ( __param(2, IDialogService)), ( __param(3, INotificationService)), ( __param(4, IEditorService)), ( __param(5, IConfigurationService)), ( __param(6, IQuickInputService)), ( __param(7, ILabelService)), ( __param(8, ILogService))], McpRegistry));
558
+ McpRegistry = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IConfigurationResolverService)), ( __param(2, IDialogService)), ( __param(3, INotificationService)), ( __param(4, IEditorService)), ( __param(5, IConfigurationService)), ( __param(6, IQuickInputService)), ( __param(7, ILabelService)), ( __param(8, ILogService)), ( __param(9, IWorkspaceTrustManagementService)), ( __param(10, IWorkspaceTrustRequestService))], McpRegistry));
545
559
 
546
560
  export { McpRegistry };
@@ -41,7 +41,7 @@ let McpSamplingLog = class McpSamplingLog extends Disposable {
41
41
  }
42
42
  const parts = [];
43
43
  const total = record.bins.reduce((sum, value) => sum + value, 0);
44
- parts.push(( localize(9360, "{0} total requests in the last 7 days.", total)));
44
+ parts.push(( localize(9361, "{0} total requests in the last 7 days.", total)));
45
45
  parts.push(this._formatRecentRequests(record));
46
46
  return parts.join("\n");
47
47
  }
@@ -132,11 +132,11 @@ let McpSamplingService = class McpSamplingService extends Disposable {
132
132
  return this._getMatchingModel(opts);
133
133
  }
134
134
  const retry = await this._showContextual(opts.isDuringToolCall, ( localize(
135
- 9361,
135
+ 9362,
136
136
  "Allow MCP tools from \"{0}\" to make LLM requests?",
137
137
  opts.server.definition.label
138
138
  )), ( localize(
139
- 9362,
139
+ 9363,
140
140
  "The MCP server \"{0}\" has issued a request to make a language model call. Do you want to allow it to make requests during chat?",
141
141
  opts.server.definition.label
142
142
  )), this.allowButtons(opts.server, "allowedDuringChat"));
@@ -150,11 +150,11 @@ let McpSamplingService = class McpSamplingService extends Disposable {
150
150
  return this._getMatchingModel(opts);
151
151
  }
152
152
  const retry = await this._showContextual(opts.isDuringToolCall, ( localize(
153
- 9363,
153
+ 9364,
154
154
  "Allow MCP server \"{0}\" to make LLM requests?",
155
155
  opts.server.definition.label
156
156
  )), ( localize(
157
- 9364,
157
+ 9365,
158
158
  "The MCP server \"{0}\" has issued a request to make a language model call. Do you want to allow it to make requests, outside of tool calls during chat?",
159
159
  opts.server.definition.label
160
160
  )), this.allowButtons(opts.server, "allowedOutsideChat"));
@@ -166,12 +166,12 @@ let McpSamplingService = class McpSamplingService extends Disposable {
166
166
  throw McpError.notAllowed();
167
167
  } else if (model === ModelMatch.NoMatchingModel) {
168
168
  const newlyPickedModels = opts.isDuringToolCall ? await this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server) : await this._notify(( localize(
169
- 9365,
169
+ 9366,
170
170
  "MCP server \"{0}\" triggered a language model request, but it has no allowlisted models.",
171
171
  opts.server.definition.label
172
172
  )), {
173
- [( localize(9366, "Configure"))]: () => this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server),
174
- [( localize(9367, "Cancel"))]: () => Promise.resolve(undefined)
173
+ [( localize(9367, "Configure"))]: () => this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server),
174
+ [( localize(9368, "Cancel"))]: () => Promise.resolve(undefined)
175
175
  });
176
176
  if (newlyPickedModels) {
177
177
  return this._getMatchingModel(opts);
@@ -182,19 +182,19 @@ let McpSamplingService = class McpSamplingService extends Disposable {
182
182
  }
183
183
  allowButtons(server, key) {
184
184
  return {
185
- [( localize(9368, "Allow in this Session"))]: async () => {
185
+ [( localize(9369, "Allow in this Session"))]: async () => {
186
186
  this._sessionSets[key].set(server.definition.id, true);
187
187
  return true;
188
188
  },
189
- [( localize(9369, "Always"))]: async () => {
189
+ [( localize(9370, "Always"))]: async () => {
190
190
  await this.updateConfig(server, c => c[key] = true);
191
191
  return true;
192
192
  },
193
- [( localize(9370, "Not Now"))]: async () => {
193
+ [( localize(9371, "Not Now"))]: async () => {
194
194
  this._sessionSets[key].set(server.definition.id, false);
195
195
  return false;
196
196
  },
197
- [( localize(9371, "Never"))]: async () => {
197
+ [( localize(9372, "Never"))]: async () => {
198
198
  await this.updateConfig(server, c => c[key] = false);
199
199
  return false;
200
200
  }
@@ -49,7 +49,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
49
49
  this._state.set({
50
50
  state: McpConnectionState.Kind.Starting
51
51
  }, undefined);
52
- this._logger.info(( localize(9381, "Starting server {0}", this.definition.label)));
52
+ this._logger.info(( localize(9382, "Starting server {0}", this.definition.label)));
53
53
  try {
54
54
  const launch = this._delegate.start(this._collection, this.definition, this.launchDefinition, {
55
55
  errorOnUserInteraction: this._errorOnUserInteraction
@@ -82,7 +82,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
82
82
  store.add(autorun(reader => {
83
83
  const state = launch.state.read(reader);
84
84
  this._state.set(state, undefined);
85
- this._logger.info(( localize(9382, "Connection state: {0}", (McpConnectionState.toString(state)))));
85
+ this._logger.info(( localize(9383, "Connection state: {0}", (McpConnectionState.toString(state)))));
86
86
  if (state.state === McpConnectionState.Kind.Running && !didStart) {
87
87
  didStart = true;
88
88
  McpServerRequestHandler.create(this._instantiationService, {
@@ -121,7 +121,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
121
121
  };
122
122
  }
123
123
  async stop() {
124
- this._logger.info(( localize(9383, "Stopping server {0}", this.definition.label)));
124
+ this._logger.info(( localize(9384, "Stopping server {0}", this.definition.label)));
125
125
  this._launch.value?.object.stop();
126
126
  await this._waitForState(McpConnectionState.Kind.Stopped, McpConnectionState.Kind.Error);
127
127
  }
@@ -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(14107, "Sign in requested"))));
123
+ const badge = ( new NumberBadge(numberOfRequests, () => ( localize(14108, "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
- 14108,
197
+ 14109,
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(14109, "&&Allow")),
204
+ label: ( localize(14110, "&&Allow")),
205
205
  run: () => SessionPromptChoice.Allow
206
206
  }, {
207
- label: ( localize(14110, "&&Deny")),
207
+ label: ( localize(14111, "&&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(14111, "Sign in to another account"))
249
+ label: ( localize(14112, "Sign in to another account"))
250
250
  });
251
251
  quickPick.items = items;
252
252
  quickPick.title = ( localize(
253
- 14112,
253
+ 14113,
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
- 14113,
259
+ 14114,
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(14114, "Grant access to {0} for {1}... (1)", provider.label, mcpServerName))
339
+ title: ( localize(14115, "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(14115, "Sign in with {0} to use {1} (1)", provider.label, mcpServerName))
383
+ title: ( localize(14116, "Sign in with {0} to use {1} (1)", provider.label, mcpServerName))
384
384
  }
385
385
  }));
386
386
  const signInCommand = CommandsRegistry.registerCommand({