@codingame/monaco-vscode-mcp-service-override 28.4.0 → 29.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 (35) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/base/common/jsonRpcProtocol.d.ts +13 -1
  3. package/vscode/src/vs/base/common/jsonRpcProtocol.js +26 -13
  4. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +1 -1
  5. package/vscode/src/vs/platform/mcp/common/mcpGalleryManifestService.js +2 -1
  6. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +8 -5
  7. package/vscode/src/vs/platform/mcp/common/mcpGateway.d.ts +49 -18
  8. package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +3 -3
  9. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
  10. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +81 -67
  11. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.d.ts +11 -0
  12. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +267 -50
  13. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js +17 -3
  14. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +24 -21
  15. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
  16. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
  17. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +18 -18
  18. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +37 -9
  19. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
  20. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
  21. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.js +11 -3
  22. package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
  23. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.d.ts +8 -9
  24. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.js +147 -132
  25. package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +10 -6
  26. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +14 -14
  27. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +11 -11
  29. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.d.ts +2 -0
  30. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +15 -8
  31. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +7 -22
  32. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +4 -1
  33. package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +16 -4
  34. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
  35. package/vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js +2 -2
@@ -16,8 +16,7 @@ class McpGatewayToolBrokerChannel extends Disposable {
16
16
  this._startupGracePeriodMs = _startupGracePeriodMs;
17
17
  this._onDidChangeTools = this._register(( new Emitter()));
18
18
  this._onDidChangeResources = this._register(( new Emitter()));
19
- this._serverIdMap = ( new Map());
20
- this._nextServerIndex = 0;
19
+ this._onDidChangeServers = this._register(( new Emitter()));
21
20
  this._startupGrace = ( new Map());
22
21
  this._logService.debug("[McpGateway][ToolBroker] Initialized");
23
22
  let toolsInitialized = false;
@@ -44,19 +43,23 @@ class McpGatewayToolBrokerChannel extends Disposable {
44
43
  resourcesInitialized = true;
45
44
  }
46
45
  }));
46
+ let serversInitialized = false;
47
+ this._register(autorun(reader => {
48
+ const servers = this._mcpService.servers.read(reader);
49
+ if (serversInitialized) {
50
+ this._logService.debug("[McpGateway][ToolBroker] Servers changed, firing onDidChangeServers");
51
+ this._onDidChangeServers.fire(( servers.map(s => ({
52
+ id: s.definition.id,
53
+ label: s.definition.label
54
+ }))));
55
+ } else {
56
+ serversInitialized = true;
57
+ }
58
+ }));
47
59
  }
48
- _getServerIndex(server) {
49
- const defId = server.definition.id;
50
- let index = this._serverIdMap.get(defId);
51
- if (index === undefined) {
52
- index = this._nextServerIndex++;
53
- this._serverIdMap.set(defId, index);
54
- }
55
- return index;
56
- }
57
- _getServerByIndex(serverIndex) {
60
+ _getServerById(serverId) {
58
61
  for (const server of this._mcpService.servers.get()) {
59
- if (this._getServerIndex(server) === serverIndex) {
62
+ if (server.definition.id === serverId) {
60
63
  return server;
61
64
  }
62
65
  }
@@ -98,181 +101,193 @@ class McpGatewayToolBrokerChannel extends Disposable {
98
101
  return this._onDidChangeTools.event;
99
102
  case "onDidChangeResources":
100
103
  return this._onDidChangeResources.event;
104
+ case "onDidChangeServers":
105
+ return this._onDidChangeServers.event;
101
106
  }
102
107
  throw ( new Error(`Invalid listen: ${event}`));
103
108
  }
104
109
  async call(_ctx, command, arg, cancellationToken) {
105
110
  this._logService.debug(`[McpGateway][ToolBroker] IPC call: ${command}`);
106
111
  switch (command) {
107
- case "listTools":
112
+ case "listServers":
113
+ {
114
+ const servers = this._listServers();
115
+ return servers;
116
+ }
117
+ case "listToolsForServer":
108
118
  {
109
- const tools = await this._listTools();
119
+ const {
120
+ serverId
121
+ } = arg;
122
+ const tools = await this._listToolsForServer(serverId);
110
123
  return tools;
111
124
  }
112
- case "callTool":
125
+ case "callToolForServer":
113
126
  {
114
127
  const {
128
+ serverId,
115
129
  name,
116
130
  args
117
131
  } = arg;
118
- const result = await this._callTool(name, args || {}, cancellationToken);
132
+ const result = await this._callToolForServer(serverId, name, args || {}, cancellationToken);
119
133
  return result;
120
134
  }
121
- case "listResources":
135
+ case "listResourcesForServer":
122
136
  {
123
- const resources = await this._listResources();
137
+ const {
138
+ serverId
139
+ } = arg;
140
+ const resources = await this._listResourcesForServer(serverId);
124
141
  return resources;
125
142
  }
126
- case "readResource":
143
+ case "readResourceForServer":
127
144
  {
128
145
  const {
129
- serverIndex,
146
+ serverId,
130
147
  uri
131
148
  } = arg;
132
- const result = await this._readResource(serverIndex, uri, cancellationToken);
149
+ const result = await this._readResourceForServer(serverId, uri, cancellationToken);
133
150
  return result;
134
151
  }
135
- case "listResourceTemplates":
152
+ case "listResourceTemplatesForServer":
136
153
  {
137
- const templates = await this._listResourceTemplates();
154
+ const {
155
+ serverId
156
+ } = arg;
157
+ const templates = await this._listResourceTemplatesForServer(serverId);
138
158
  return templates;
139
159
  }
140
160
  }
141
161
  throw ( new Error(`Invalid call: ${command}`));
142
162
  }
143
- async _listTools() {
163
+ _listServers() {
144
164
  const servers = this._mcpService.servers.get();
145
- const perServer = await Promise.all(( servers.map(async server => {
146
- if (!(await this._shouldUseCachedData(server))) {
147
- this._logService.debug(
148
- `[McpGateway][ToolBroker] Server '${server.definition.id}' not ready, skipping tool listing`
149
- );
150
- return [];
151
- }
152
- return ( server.tools.get().filter(t => t.visibility & McpToolVisibility.Model).map(t => t.definition));
153
- })));
154
- const mcpTools = perServer.flat();
165
+ const result = [];
166
+ for (const server of servers) {
167
+ result.push({
168
+ id: server.definition.id,
169
+ label: server.definition.label
170
+ });
171
+ }
155
172
  this._logService.debug(
156
- `[McpGateway][ToolBroker] listTools result: ${mcpTools.length} tool(s): [${( mcpTools.map(t => t.name)).join(", ")}]`
173
+ `[McpGateway][ToolBroker] listServers result: ${result.length} server(s): [${( result.map(s => s.label)).join(", ")}]`
157
174
  );
158
- return mcpTools;
175
+ return result;
159
176
  }
160
- async _callTool(name, args, token = CancellationToken.None) {
161
- this._logService.debug(
162
- `[McpGateway][ToolBroker] callTool '${name}' with args: ${JSON.stringify(args)}`
163
- );
164
- for (const server of this._mcpService.servers.get()) {
165
- const tool = server.tools.get().find(
166
- t => t.definition.name === name && (t.visibility & McpToolVisibility.Model)
177
+ async _listToolsForServer(serverId) {
178
+ const server = this._getServerById(serverId);
179
+ if (!server) {
180
+ this._logService.warn(
181
+ `[McpGateway][ToolBroker] listToolsForServer: unknown server '${serverId}'`
167
182
  );
168
- if (tool) {
169
- this._logService.debug(
170
- `[McpGateway][ToolBroker] Found tool '${name}' on server '${server.definition.id}' (index=${this._getServerIndex(server)})`
171
- );
172
- const result = await tool.call(args, undefined, token);
173
- this._logService.debug(
174
- `[McpGateway][ToolBroker] Tool '${name}' completed (isError=${result.isError ?? false}, content blocks=${result.content.length})`
175
- );
176
- return {
177
- result,
178
- serverIndex: this._getServerIndex(server)
179
- };
180
- }
183
+ return [];
184
+ }
185
+ if (!(await this._shouldUseCachedData(server))) {
186
+ this._logService.debug(
187
+ `[McpGateway][ToolBroker] Server '${serverId}' not ready, skipping tool listing`
188
+ );
189
+ return [];
181
190
  }
182
- this._logService.warn(`[McpGateway][ToolBroker] Tool '${name}' not found on any server`);
183
- throw ( new Error(`Unknown tool: ${name}`));
191
+ const tools = ( server.tools.get().filter(t => t.visibility & McpToolVisibility.Model).map(t => t.definition));
192
+ this._logService.debug(
193
+ `[McpGateway][ToolBroker] listToolsForServer '${serverId}': ${tools.length} tool(s)`
194
+ );
195
+ return tools;
184
196
  }
185
- async _listResources() {
186
- const results = [];
187
- const servers = this._mcpService.servers.get();
197
+ async _callToolForServer(serverId, name, args, token = CancellationToken.None) {
188
198
  this._logService.debug(
189
- `[McpGateway][ToolBroker] listResources: ${servers.length} server(s) known`
199
+ `[McpGateway][ToolBroker] callToolForServer '${serverId}' tool '${name}' with args: ${JSON.stringify(args)}`
190
200
  );
191
- await Promise.all(( servers.map(async server => {
192
- if (!(await this._shouldUseCachedData(server))) {
193
- return;
194
- }
195
- const capabilities = server.capabilities.get();
196
- if (!capabilities || !(capabilities & McpCapability.Resources)) {
197
- this._logService.debug(
198
- `[McpGateway][ToolBroker] Server '${server.definition.id}' has no resource capability, skipping`
199
- );
200
- return;
201
- }
202
- try {
203
- const resources = await McpServer.callOn(server, h => h.listResources());
204
- this._logService.debug(
205
- `[McpGateway][ToolBroker] Server '${server.definition.id}' (index=${this._getServerIndex(server)}) listed ${resources.length} resource(s)`
206
- );
207
- results.push({
208
- serverIndex: this._getServerIndex(server),
209
- resources
210
- });
211
- } catch (error) {
212
- this._logService.warn(
213
- `[McpGateway][ToolBroker] Server '${server.definition.id}' failed to list resources`,
214
- error
215
- );
216
- }
217
- })));
201
+ const server = this._getServerById(serverId);
202
+ if (!server) {
203
+ throw ( new Error(`Unknown server: ${serverId}`));
204
+ }
205
+ const tool = server.tools.get().find(
206
+ t => t.definition.name === name && (t.visibility & McpToolVisibility.Model)
207
+ );
208
+ if (!tool) {
209
+ throw ( new Error(`Unknown tool '${name}' on server '${serverId}'`));
210
+ }
211
+ const result = await tool.call(args, undefined, token);
218
212
  this._logService.debug(
219
- `[McpGateway][ToolBroker] listResources result: ${results.length} server(s) with resources`
213
+ `[McpGateway][ToolBroker] Tool '${name}' on '${serverId}' completed (isError=${result.isError ?? false}, content blocks=${result.content.length})`
220
214
  );
221
- return results;
215
+ return result;
222
216
  }
223
- async _readResource(serverIndex, uri, token = CancellationToken.None) {
224
- const server = this._getServerByIndex(serverIndex);
217
+ async _listResourcesForServer(serverId) {
218
+ const server = this._getServerById(serverId);
225
219
  if (!server) {
226
220
  this._logService.warn(
227
- `[McpGateway][ToolBroker] readResource: unknown server index ${serverIndex}`
221
+ `[McpGateway][ToolBroker] listResourcesForServer: unknown server '${serverId}'`
222
+ );
223
+ return [];
224
+ }
225
+ if (!(await this._shouldUseCachedData(server))) {
226
+ return [];
227
+ }
228
+ const capabilities = server.capabilities.get();
229
+ if (!capabilities || !(capabilities & McpCapability.Resources)) {
230
+ this._logService.debug(`[McpGateway][ToolBroker] Server '${serverId}' has no resource capability`);
231
+ return [];
232
+ }
233
+ try {
234
+ const resources = await McpServer.callOn(server, h => h.listResources());
235
+ this._logService.debug(
236
+ `[McpGateway][ToolBroker] Server '${serverId}' listed ${resources.length} resource(s)`
237
+ );
238
+ return resources;
239
+ } catch (error) {
240
+ this._logService.warn(
241
+ `[McpGateway][ToolBroker] Server '${serverId}' failed to list resources`,
242
+ error
228
243
  );
229
- throw ( new Error(`Unknown server index: ${serverIndex}`));
244
+ return [];
245
+ }
246
+ }
247
+ async _readResourceForServer(serverId, uri, token = CancellationToken.None) {
248
+ const server = this._getServerById(serverId);
249
+ if (!server) {
250
+ throw ( new Error(`Unknown server: ${serverId}`));
230
251
  }
231
252
  this._logService.debug(
232
- `[McpGateway][ToolBroker] readResource '${uri}' from server '${server.definition.id}' (index=${serverIndex})`
253
+ `[McpGateway][ToolBroker] readResourceForServer '${uri}' from server '${serverId}'`
233
254
  );
234
255
  const result = await McpServer.callOn(server, h => h.readResource({
235
256
  uri
236
257
  }, token), token);
237
258
  this._logService.debug(
238
- `[McpGateway][ToolBroker] readResource returned ${result.contents.length} content(s)`
259
+ `[McpGateway][ToolBroker] readResourceForServer returned ${result.contents.length} content(s)`
239
260
  );
240
261
  return result;
241
262
  }
242
- async _listResourceTemplates() {
243
- const results = [];
244
- const servers = this._mcpService.servers.get();
245
- this._logService.debug(
246
- `[McpGateway][ToolBroker] listResourceTemplates: ${servers.length} server(s) known`
247
- );
248
- await Promise.all(( servers.map(async server => {
249
- if (!(await this._shouldUseCachedData(server))) {
250
- return;
251
- }
252
- const capabilities = server.capabilities.get();
253
- if (!capabilities || !(capabilities & McpCapability.Resources)) {
254
- return;
255
- }
256
- try {
257
- const resourceTemplates = await McpServer.callOn(server, h => h.listResourceTemplates());
258
- this._logService.debug(
259
- `[McpGateway][ToolBroker] Server '${server.definition.id}' (index=${this._getServerIndex(server)}) listed ${resourceTemplates.length} resource template(s)`
260
- );
261
- results.push({
262
- serverIndex: this._getServerIndex(server),
263
- resourceTemplates
264
- });
265
- } catch (error) {
266
- this._logService.warn(
267
- `[McpGateway][ToolBroker] Server '${server.definition.id}' failed to list resource templates`,
268
- error
269
- );
270
- }
271
- })));
272
- this._logService.debug(
273
- `[McpGateway][ToolBroker] listResourceTemplates result: ${results.length} server(s) with templates`
274
- );
275
- return results;
263
+ async _listResourceTemplatesForServer(serverId) {
264
+ const server = this._getServerById(serverId);
265
+ if (!server) {
266
+ this._logService.warn(
267
+ `[McpGateway][ToolBroker] listResourceTemplatesForServer: unknown server '${serverId}'`
268
+ );
269
+ return [];
270
+ }
271
+ if (!(await this._shouldUseCachedData(server))) {
272
+ return [];
273
+ }
274
+ const capabilities = server.capabilities.get();
275
+ if (!capabilities || !(capabilities & McpCapability.Resources)) {
276
+ return [];
277
+ }
278
+ try {
279
+ const resourceTemplates = await McpServer.callOn(server, h => h.listResourceTemplates());
280
+ this._logService.debug(
281
+ `[McpGateway][ToolBroker] Server '${serverId}' listed ${resourceTemplates.length} resource template(s)`
282
+ );
283
+ return resourceTemplates;
284
+ } catch (error) {
285
+ this._logService.warn(
286
+ `[McpGateway][ToolBroker] Server '${serverId}' failed to list resource templates`,
287
+ error
288
+ );
289
+ return [];
290
+ }
276
291
  }
277
292
  async _ensureServerReady(server) {
278
293
  const cacheState = server.cacheState.get();
@@ -17,6 +17,7 @@ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
17
17
  import { mcpAppsEnabledConfig } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement';
18
18
  import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
19
19
  import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
20
+ import { isContributionEnabled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
20
21
  import { getAttachableImageExtension, ChatResponseResource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel';
21
22
  import { LanguageModelPartAudience } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
22
23
  import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
@@ -49,6 +50,9 @@ let McpLanguageModelToolContribution = class McpLanguageModelToolContribution ex
49
50
  const servers = mcpService.servers.read(reader);
50
51
  const toDelete = ( new Set(( previous.keys())));
51
52
  for (const server of servers) {
53
+ if (!isContributionEnabled(server.enablement.read(reader))) {
54
+ continue;
55
+ }
52
56
  const previousRec = previous.get(server);
53
57
  if (previousRec) {
54
58
  toDelete.delete(server);
@@ -67,7 +71,7 @@ let McpLanguageModelToolContribution = class McpLanguageModelToolContribution ex
67
71
  const toolSet = store.add(
68
72
  this._toolsService.createToolSet(source, server.definition.id, referenceName, {
69
73
  icon: Codicon.mcp,
70
- description: ( localize(10423, "{0}: All Tools", server.definition.label))
74
+ description: ( localize(10673, "{0}: All Tools", server.definition.label))
71
75
  })
72
76
  );
73
77
  return {
@@ -187,7 +191,7 @@ let McpToolImplementation = class McpToolImplementation {
187
191
  });
188
192
  const isSandboxedServer = sandboxEnabled === true;
189
193
  const mcpToolWarning = ( localize(
190
- 10424,
194
+ 10674,
191
195
  "Note that MCP servers or malicious conversation content may attempt to misuse '{0}' through tools.",
192
196
  this._productService.nameShort
193
197
  ));
@@ -196,7 +200,7 @@ let McpToolImplementation = class McpToolImplementation {
196
200
  if (!isSandboxedServer) {
197
201
  confirm = {};
198
202
  if (!tool.definition.annotations?.readOnlyHint) {
199
- confirm.title = ( new MarkdownString(( localize(10425, "Run {0}", title))));
203
+ confirm.title = ( new MarkdownString(( localize(10675, "Run {0}", title))));
200
204
  confirm.message = ( new MarkdownString(tool.definition.description, {
201
205
  supportThemeIcons: true
202
206
  }));
@@ -210,9 +214,9 @@ let McpToolImplementation = class McpToolImplementation {
210
214
  const mcpUiEnabled = this._configurationService.getValue(mcpAppsEnabledConfig);
211
215
  return {
212
216
  confirmationMessages: confirm,
213
- invocationMessage: ( new MarkdownString(( localize(10426, "Running {0}", title)))),
214
- pastTenseMessage: ( new MarkdownString(( localize(10427, "Ran {0} ", title)))),
215
- originMessage: ( localize(10428, "{0} (MCP Server)", server.definition.label)),
217
+ invocationMessage: ( new MarkdownString(( localize(10676, "Running {0}", title)))),
218
+ pastTenseMessage: ( new MarkdownString(( localize(10677, "Ran {0} ", title)))),
219
+ originMessage: ( localize(10678, "{0} (MCP Server)", server.definition.label)),
216
220
  toolSpecificData: {
217
221
  kind: "input",
218
222
  rawInput: context.parameters,
@@ -34,10 +34,10 @@ import { McpRegistryInputStorage } from './mcpRegistryInputStorage.js';
34
34
  import { IMcpSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpSandboxService.service';
35
35
  import { McpServerConnection } from './mcpServerConnection.js';
36
36
  import { LazyCollectionState, UserInteractionRequiredError, McpServerTrust, McpStartServerInteraction } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
37
- import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
38
37
  import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
39
38
  import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
40
39
  import { autorunSelfDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
40
+ import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
41
41
 
42
42
  const notTrustedNonce = "__vscode_not_trusted";
43
43
  let McpRegistry = class McpRegistry extends Disposable {
@@ -227,7 +227,7 @@ let McpRegistry = class McpRegistry extends Disposable {
227
227
  if (errorOnUserInteraction) {
228
228
  throw ( new UserInteractionRequiredError("workspaceTrust"));
229
229
  } else if (!(await this._workspaceTrustRequestService.requestWorkspaceTrust({
230
- message: ( localize(10429, "This MCP server definition is defined in your workspace files."))
230
+ message: ( localize(10679, "This MCP server definition is defined in your workspace files."))
231
231
  }))) {
232
232
  return false;
233
233
  }
@@ -305,7 +305,7 @@ let McpRegistry = class McpRegistry extends Disposable {
305
305
  const originURI = r.definition.presentation?.origin?.uri || r.collection.presentation?.origin;
306
306
  let labelWithOrigin = originURI ? `[\`${r.definition.label}\`](${originURI})` : "`" + r.definition.label + "`";
307
307
  if (r.collection.source instanceof ExtensionIdentifier) {
308
- labelWithOrigin += ` (${( localize(10430, "from {0}", r.collection.source.value))})`;
308
+ labelWithOrigin += ` (${( localize(10680, "from {0}", r.collection.source.value))})`;
309
309
  }
310
310
  return labelWithOrigin;
311
311
  }
@@ -315,12 +315,12 @@ let McpRegistry = class McpRegistry extends Disposable {
315
315
  const {
316
316
  result
317
317
  } = await this._dialogService.prompt({
318
- message: ( localize(10431, "Trust and run MCP server {0}?", def.definition.label)),
318
+ message: ( localize(10681, "Trust and run MCP server {0}?", def.definition.label)),
319
319
  custom: {
320
320
  icon: Codicon.shield,
321
321
  markdownDetails: [{
322
322
  markdown: ( new MarkdownString(( localize(
323
- 10432,
323
+ 10682,
324
324
  "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?",
325
325
  labelFor(def)
326
326
  )))),
@@ -333,10 +333,10 @@ let McpRegistry = class McpRegistry extends Disposable {
333
333
  }]
334
334
  },
335
335
  buttons: [{
336
- label: ( localize(10433, "Trust")),
336
+ label: ( localize(10683, "Trust")),
337
337
  run: () => true
338
338
  }, {
339
- label: ( localize(10434, "Do not trust")),
339
+ label: ( localize(10684, "Do not trust")),
340
340
  run: () => false
341
341
  }]
342
342
  });
@@ -346,12 +346,12 @@ let McpRegistry = class McpRegistry extends Disposable {
346
346
  const {
347
347
  result
348
348
  } = await this._dialogService.prompt({
349
- message: ( localize(10435, "Trust and run {0} MCP servers?", definitions.length)),
349
+ message: ( localize(10685, "Trust and run {0} MCP servers?", definitions.length)),
350
350
  custom: {
351
351
  icon: Codicon.shield,
352
352
  markdownDetails: [{
353
353
  markdown: ( new MarkdownString(( localize(
354
- 10436,
354
+ 10686,
355
355
  "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?",
356
356
  list
357
357
  )))),
@@ -364,13 +364,13 @@ let McpRegistry = class McpRegistry extends Disposable {
364
364
  }]
365
365
  },
366
366
  buttons: [{
367
- label: ( localize(10433, "Trust")),
367
+ label: ( localize(10683, "Trust")),
368
368
  run: () => "all"
369
369
  }, {
370
- label: ( localize(10437, "Pick Trusted")),
370
+ label: ( localize(10687, "Pick Trusted")),
371
371
  run: () => "pick"
372
372
  }, {
373
- label: ( localize(10434, "Do not trust")),
373
+ label: ( localize(10684, "Do not trust")),
374
374
  run: () => "none"
375
375
  }]
376
376
  });
@@ -533,14 +533,14 @@ let McpRegistry = class McpRegistry extends Disposable {
533
533
  }
534
534
  this._notificationService.notify({
535
535
  severity: Severity.Error,
536
- message: ( localize(10438, "Error starting {0}: {1}", definition.label, String(e))),
536
+ message: ( localize(10688, "Error starting {0}: {1}", definition.label, String(e))),
537
537
  actions: {
538
538
  primary: collection.presentation?.origin && [{
539
539
  id: "mcp.launchError.openConfig",
540
540
  class: undefined,
541
541
  enabled: true,
542
542
  tooltip: "",
543
- label: ( localize(10439, "Open Configuration")),
543
+ label: ( localize(10689, "Open Configuration")),
544
544
  run: () => this._editorService.openEditor({
545
545
  resource: collection.presentation.origin,
546
546
  options: {
@@ -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(10440, "{0} total requests in the last 7 days.", total)));
44
+ parts.push(( localize(10690, "{0} total requests in the last 7 days.", total)));
45
45
  parts.push(this._formatRecentRequests(record));
46
46
  return parts.join("\n");
47
47
  }
@@ -131,11 +131,11 @@ let McpSamplingService = class McpSamplingService extends Disposable {
131
131
  return this._getMatchingModel(opts);
132
132
  }
133
133
  const retry = await this._showContextual(opts.isDuringToolCall, ( localize(
134
- 10441,
134
+ 10691,
135
135
  "Allow MCP tools from \"{0}\" to make LLM requests?",
136
136
  opts.server.definition.label
137
137
  )), ( localize(
138
- 10442,
138
+ 10692,
139
139
  "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?",
140
140
  opts.server.definition.label
141
141
  )), this.allowButtons(opts.server, "allowedDuringChat"));
@@ -149,11 +149,11 @@ let McpSamplingService = class McpSamplingService extends Disposable {
149
149
  return this._getMatchingModel(opts);
150
150
  }
151
151
  const retry = await this._showContextual(opts.isDuringToolCall, ( localize(
152
- 10443,
152
+ 10693,
153
153
  "Allow MCP server \"{0}\" to make LLM requests?",
154
154
  opts.server.definition.label
155
155
  )), ( localize(
156
- 10444,
156
+ 10694,
157
157
  "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?",
158
158
  opts.server.definition.label
159
159
  )), this.allowButtons(opts.server, "allowedOutsideChat"));
@@ -165,12 +165,12 @@ let McpSamplingService = class McpSamplingService extends Disposable {
165
165
  throw McpError.notAllowed();
166
166
  } else if (model === ModelMatch.NoMatchingModel) {
167
167
  const newlyPickedModels = opts.isDuringToolCall ? await this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server) : await this._notify(( localize(
168
- 10445,
168
+ 10695,
169
169
  "MCP server \"{0}\" triggered a language model request, but it has no allowlisted models.",
170
170
  opts.server.definition.label
171
171
  )), {
172
- [( localize(10446, "Configure"))]: () => this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server),
173
- [( localize(10447, "Cancel"))]: () => Promise.resolve(undefined)
172
+ [( localize(10696, "Configure"))]: () => this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server),
173
+ [( localize(10697, "Cancel"))]: () => Promise.resolve(undefined)
174
174
  });
175
175
  if (newlyPickedModels) {
176
176
  return this._getMatchingModel(opts);
@@ -181,19 +181,19 @@ let McpSamplingService = class McpSamplingService extends Disposable {
181
181
  }
182
182
  allowButtons(server, key) {
183
183
  return {
184
- [( localize(10448, "Allow in this Session"))]: async () => {
184
+ [( localize(10698, "Allow in this Session"))]: async () => {
185
185
  this._sessionSets[key].set(server.definition.id, true);
186
186
  return true;
187
187
  },
188
- [( localize(10449, "Always"))]: async () => {
188
+ [( localize(10699, "Always"))]: async () => {
189
189
  await this.updateConfig(server, c => c[key] = true);
190
190
  return true;
191
191
  },
192
- [( localize(10450, "Not Now"))]: async () => {
192
+ [( localize(10700, "Not Now"))]: async () => {
193
193
  this._sessionSets[key].set(server.definition.id, false);
194
194
  return false;
195
195
  },
196
- [( localize(10451, "Never"))]: async () => {
196
+ [( localize(10701, "Never"))]: async () => {
197
197
  await this.updateConfig(server, c => c[key] = false);
198
198
  return false;
199
199
  }
@@ -23,6 +23,7 @@ export declare class McpSandboxService extends Disposable implements IMcpSandbox
23
23
  private _sandboxSettingsId;
24
24
  private _remoteEnvDetailsPromise;
25
25
  private readonly _defaultAllowedDomains;
26
+ private _defaultAllowWritePaths;
26
27
  private _sandboxConfigPerConfigurationTarget;
27
28
  constructor(_fileService: IFileService, _environmentService: IEnvironmentService, _logService: ILogService, _mcpResourceScannerService: IMcpResourceScannerService, _remoteAgentService: IRemoteAgentService);
28
29
  isEnabled(serverDef: McpServerDefinition, remoteAuthority?: string): Promise<boolean>;
@@ -44,4 +45,5 @@ export declare class McpSandboxService extends Disposable implements IMcpSandbox
44
45
  private _getDefaultAllowWrite;
45
46
  private _pathJoin;
46
47
  private _getPathDelimiter;
48
+ private _quoteShellArgument;
47
49
  }