@codingame/monaco-vscode-mcp-service-override 26.2.2 → 27.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 (63) hide show
  1. package/index.js +8 -2
  2. package/package.json +2 -2
  3. package/vscode/src/vs/base/common/jsonRpcProtocol.d.ts +66 -0
  4. package/vscode/src/vs/base/common/jsonRpcProtocol.js +216 -0
  5. package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +1 -1
  6. package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +2 -2
  7. package/vscode/src/vs/platform/mcp/common/mcpGateway.d.ts +39 -0
  8. package/vscode/src/vs/platform/mcp/common/mcpGateway.js +6 -0
  9. package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.d.ts +2 -1
  10. package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +12 -6
  11. package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +15 -5
  12. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
  13. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +58 -58
  14. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +27 -28
  15. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.d.ts +18 -0
  16. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js +34 -0
  17. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayToolBrokerContribution.d.ts +6 -0
  18. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayToolBrokerContribution.js +15 -0
  19. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +18 -18
  20. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
  21. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
  22. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +4 -1
  23. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +42 -24
  24. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +1 -1
  25. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +13 -12
  26. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
  27. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +2 -0
  28. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.d.ts +15 -0
  30. package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.js +106 -0
  31. package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
  32. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.d.ts +23 -0
  33. package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.js +202 -0
  34. package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +25 -17
  35. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +3 -5
  36. package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +27 -32
  37. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
  38. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +11 -11
  39. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.d.ts +34 -0
  40. package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +233 -0
  41. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
  42. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +1 -18
  43. package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +88 -142
  44. package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
  45. package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.d.ts +1 -1
  46. package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js +2 -2
  47. package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.d.ts +0 -42
  48. package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.js +0 -105
  49. package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +0 -130
  50. package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +0 -665
  51. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.d.ts +0 -259
  52. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +0 -1225
  53. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +0 -72
  54. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +0 -996
  55. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.d.ts +0 -17
  56. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +0 -49
  57. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.d.ts +0 -5
  58. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +0 -12
  59. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +0 -88
  60. package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +0 -464
  61. package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServerEditor.css +0 -94
  62. package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.d.ts +0 -87
  63. package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.js +0 -702
@@ -1,18 +1,19 @@
1
1
 
2
2
  import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
3
- import { assertNever } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
4
- import { IntervalTimer, DeferredPromise, disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
3
+ import { softAssertNever, assertNever } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
4
+ import { IntervalTimer, isThenable, DeferredPromise, disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
5
5
  import { CancellationToken, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
6
6
  import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
7
7
  import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
8
8
  import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
9
+ import { JsonRpcProtocol, JsonRpcError } from '../../../../base/common/jsonRpcProtocol.js';
9
10
  import { Disposable, DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
10
11
  import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
11
12
  import { LogLevel, canLog, log } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';
12
13
  import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
13
14
  import { McpConnectionState, MpcResponseError, McpError } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
14
15
  import { translateMcpLogMessage, isTaskResult } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypesUtils';
15
- import { MCP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/modelContextProtocol';
16
+ import { MCP } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/modelContextProtocol';
16
17
  import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
17
18
  import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
18
19
  import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
@@ -111,8 +112,6 @@ class McpServerRequestHandler extends Disposable {
111
112
  }
112
113
  ) {
113
114
  super();
114
- this._nextRequestId = 1;
115
- this._pendingRequests = ( new Map());
116
115
  this._hasAnnouncedRoots = false;
117
116
  this._roots = [];
118
117
  this._onDidReceiveCancelledNotification = this._register(( new Emitter()));
@@ -135,6 +134,10 @@ class McpServerRequestHandler extends Disposable {
135
134
  this._createMessageRequestHandler = createMessageRequestHandler;
136
135
  this._elicitationRequestHandler = elicitationRequestHandler;
137
136
  this._taskManager = taskManager;
137
+ this._rpc = this._register(( new JsonRpcProtocol(message => this.send(message), {
138
+ handleRequest: (request, token) => this.handleServerRequest(request, token),
139
+ handleNotification: notification => this.handleServerNotification(notification)
140
+ })));
138
141
  this._taskManager.setHandler(this);
139
142
  this._register(this._taskManager.onDidUpdateTask(task => {
140
143
  this.send({
@@ -144,7 +147,16 @@ class McpServerRequestHandler extends Disposable {
144
147
  });
145
148
  }));
146
149
  this._register(toDisposable(() => this._taskManager.setHandler(undefined)));
147
- this._register(launch.onDidReceiveMessage(message => this.handleMessage(message)));
150
+ this._register(launch.onDidReceiveMessage(message => {
151
+ if (canLog(this.logger.getLevel(), this._requestLogLevel)) {
152
+ log(
153
+ this.logger,
154
+ this._requestLogLevel,
155
+ `[server -> editor] ${JSON.stringify(message)}`
156
+ );
157
+ }
158
+ void this._rpc.handleMessage(message);
159
+ }));
148
160
  this._register(autorun(reader => {
149
161
  const state = launch.state.read(reader).state;
150
162
  if (state === McpConnectionState.Kind.Error || state === McpConnectionState.Kind.Stopped) {
@@ -159,35 +171,17 @@ class McpServerRequestHandler extends Disposable {
159
171
  if (this._store.isDisposed) {
160
172
  return Promise.reject(( new CancellationError()));
161
173
  }
162
- const id = this._nextRequestId++;
163
- const jsonRpcRequest = {
164
- jsonrpc: MCP.JSONRPC_VERSION,
165
- id,
166
- ...request
167
- };
168
- const promise = ( new DeferredPromise());
169
- this._pendingRequests.set(id, {
170
- promise
171
- });
172
- const cancelListener = token.onCancellationRequested(() => {
173
- if (!promise.isSettled) {
174
- this._pendingRequests.delete(id);
175
- this.sendNotification({
176
- method: "notifications/cancelled",
177
- params: {
178
- requestId: id
179
- }
180
- });
181
- promise.cancel();
174
+ return this._rpc.sendRequest(request, token, id => this.sendNotification({
175
+ method: "notifications/cancelled",
176
+ params: {
177
+ requestId: id
182
178
  }
183
- cancelListener.dispose();
184
- });
185
- this.send(jsonRpcRequest);
186
- const ret = promise.p.finally(() => {
187
- cancelListener.dispose();
188
- this._pendingRequests.delete(id);
179
+ })).catch(error => {
180
+ if (error instanceof JsonRpcError) {
181
+ throw ( new MpcResponseError(error.message, error.code, error.data));
182
+ }
183
+ throw error;
189
184
  });
190
- return ret;
191
185
  }
192
186
  send(mcp) {
193
187
  if (canLog(this.logger.getLevel(), this._requestLogLevel)) {
@@ -220,54 +214,21 @@ class McpServerRequestHandler extends Disposable {
220
214
  jsonrpc: MCP.JSONRPC_VERSION
221
215
  });
222
216
  }
223
- handleMessage(message) {
224
- if (canLog(this.logger.getLevel(), this._requestLogLevel)) {
225
- log(
226
- this.logger,
227
- this._requestLogLevel,
228
- `[server -> editor] ${JSON.stringify(message)}`
229
- );
230
- }
231
- if ("id" in message) {
232
- if ("result" in message) {
233
- this.handleResult(message);
234
- } else if ("error" in message) {
235
- this.handleError(message);
236
- }
237
- }
238
- if ("method" in message) {
239
- if ("id" in message) {
240
- this.handleServerRequest(message);
241
- } else {
242
- this.handleServerNotification(message);
243
- }
244
- }
245
- }
246
- handleResult(response) {
247
- if (response.id !== undefined) {
248
- const request = this._pendingRequests.get(response.id);
249
- if (request) {
250
- this._pendingRequests.delete(response.id);
251
- request.promise.complete(response.result);
217
+ handleServerRequest(request, token) {
218
+ const mapError = error => {
219
+ if (error instanceof McpError) {
220
+ return ( new JsonRpcError(error.code, error.message, error.data));
252
221
  }
253
- }
254
- }
255
- handleError(response) {
256
- if (response.id !== undefined) {
257
- const request = this._pendingRequests.get(response.id);
258
- if (request) {
259
- this._pendingRequests.delete(response.id);
260
- request.promise.error(( new MpcResponseError(response.error.message, response.error.code, response.error.data)));
261
- }
262
- }
263
- }
264
- async handleServerRequest(request) {
222
+ this.logger.error(`Error handling request ${request.method}:`, error);
223
+ const mcpError = McpError.unknown(error instanceof Error ? error : ( new Error(String(error))));
224
+ return ( new JsonRpcError(mcpError.code, mcpError.message, mcpError.data));
225
+ };
265
226
  try {
266
- let response;
227
+ let result;
267
228
  if (request.method === "ping") {
268
- response = this.handlePing(request);
229
+ result = this.handlePing(request);
269
230
  } else if (request.method === "roots/list") {
270
- response = this.handleRootsList(request);
231
+ result = this.handleRootsList(request);
271
232
  } else if (request.method === "sampling/createMessage" && this._createMessageRequestHandler) {
272
233
  if (request.params.task) {
273
234
  const taskResult = this._taskManager.createTask(
@@ -278,9 +239,9 @@ class McpServerRequestHandler extends Disposable {
278
239
  taskResult._meta["io.modelcontextprotocol/related-task"] = {
279
240
  taskId: taskResult.task.taskId
280
241
  };
281
- response = taskResult;
242
+ result = taskResult;
282
243
  } else {
283
- response = await this._createMessageRequestHandler(request.params);
244
+ result = this._createMessageRequestHandler(request.params, token);
284
245
  }
285
246
  } else if (request.method === "elicitation/create" && this._elicitationRequestHandler) {
286
247
  if (request.params.task) {
@@ -292,89 +253,75 @@ class McpServerRequestHandler extends Disposable {
292
253
  taskResult._meta["io.modelcontextprotocol/related-task"] = {
293
254
  taskId: taskResult.task.taskId
294
255
  };
295
- response = taskResult;
256
+ result = taskResult;
296
257
  } else {
297
- response = await this._elicitationRequestHandler(request.params);
258
+ result = this._elicitationRequestHandler(request.params, token);
298
259
  }
299
260
  } else if (request.method === "tasks/get") {
300
- response = this._taskManager.getTask(request.params.taskId);
261
+ result = this._taskManager.getTask(request.params.taskId);
301
262
  } else if (request.method === "tasks/result") {
302
- response = await this._taskManager.getTaskResult(request.params.taskId);
263
+ result = this._taskManager.getTaskResult(request.params.taskId);
303
264
  } else if (request.method === "tasks/cancel") {
304
- response = this._taskManager.cancelTask(request.params.taskId);
265
+ result = this._taskManager.cancelTask(request.params.taskId);
305
266
  } else if (request.method === "tasks/list") {
306
- response = this._taskManager.listTasks();
267
+ result = this._taskManager.listTasks();
307
268
  } else {
308
269
  throw McpError.methodNotFound(request.method);
309
270
  }
310
- this.respondToRequest(request, response);
311
- } catch (e) {
312
- if (!(e instanceof McpError)) {
313
- this.logger.error(`Error handling request ${request.method}:`, e);
314
- e = McpError.unknown(e);
271
+ if (isThenable(result)) {
272
+ return result.then(undefined, error => {
273
+ throw mapError(error);
274
+ });
315
275
  }
316
- const errorResponse = {
317
- jsonrpc: MCP.JSONRPC_VERSION,
318
- id: request.id,
319
- error: {
320
- code: e.code,
321
- message: e.message,
322
- data: e.data
323
- }
324
- };
325
- this.send(errorResponse);
276
+ return result;
277
+ } catch (e) {
278
+ throw mapError(e);
326
279
  }
327
280
  }
328
281
  handleServerNotification(request) {
329
- switch (request.method) {
330
- case "notifications/message":
331
- return this.handleLoggingNotification(request);
332
- case "notifications/cancelled":
333
- this._onDidReceiveCancelledNotification.fire(request);
334
- return this.handleCancelledNotification(request);
335
- case "notifications/progress":
336
- this._onDidReceiveProgressNotification.fire(request);
337
- return;
338
- case "notifications/resources/list_changed":
339
- this._onDidChangeResourceList.fire();
340
- return;
341
- case "notifications/resources/updated":
342
- this._onDidUpdateResource.fire(request);
343
- return;
344
- case "notifications/tools/list_changed":
345
- this._onDidChangeToolList.fire();
346
- return;
347
- case "notifications/prompts/list_changed":
348
- this._onDidChangePromptList.fire();
349
- return;
350
- case "notifications/elicitation/complete":
351
- this._onDidReceiveElicitationCompleteNotification.fire(request);
352
- return;
353
- case "notifications/tasks/status":
354
- this._taskManager.getClientTask(request.params.taskId)?.onDidUpdateState(request.params);
355
- return;
282
+ try {
283
+ switch (request.method) {
284
+ case "notifications/message":
285
+ return this.handleLoggingNotification(request);
286
+ case "notifications/cancelled":
287
+ this._onDidReceiveCancelledNotification.fire(request);
288
+ return this.handleCancelledNotification(request);
289
+ case "notifications/progress":
290
+ this._onDidReceiveProgressNotification.fire(request);
291
+ return;
292
+ case "notifications/resources/list_changed":
293
+ this._onDidChangeResourceList.fire();
294
+ return;
295
+ case "notifications/resources/updated":
296
+ this._onDidUpdateResource.fire(request);
297
+ return;
298
+ case "notifications/tools/list_changed":
299
+ this._onDidChangeToolList.fire();
300
+ return;
301
+ case "notifications/prompts/list_changed":
302
+ this._onDidChangePromptList.fire();
303
+ return;
304
+ case "notifications/elicitation/complete":
305
+ this._onDidReceiveElicitationCompleteNotification.fire(request);
306
+ return;
307
+ case "notifications/tasks/status":
308
+ this._taskManager.getClientTask(request.params.taskId)?.onDidUpdateState(request.params);
309
+ return;
310
+ default:
311
+ softAssertNever(request);
312
+ }
313
+ } catch (error) {
314
+ this.logger.error(`Error handling notification ${request.method}:`, error);
356
315
  }
357
316
  }
358
317
  handleCancelledNotification(request) {
359
318
  if (request.params.requestId) {
360
- const pendingRequest = this._pendingRequests.get(request.params.requestId);
361
- if (pendingRequest) {
362
- this._pendingRequests.delete(request.params.requestId);
363
- pendingRequest.promise.cancel();
364
- }
319
+ this._rpc.cancelPendingRequest(request.params.requestId);
365
320
  }
366
321
  }
367
322
  handleLoggingNotification(request) {
368
323
  translateMcpLogMessage(this.logger, request.params);
369
324
  }
370
- respondToRequest(request, result) {
371
- const response = {
372
- jsonrpc: MCP.JSONRPC_VERSION,
373
- id: request.id,
374
- result
375
- };
376
- this.send(response);
377
- }
378
325
  handlePing(_request) {
379
326
  return {};
380
327
  }
@@ -385,8 +332,7 @@ class McpServerRequestHandler extends Disposable {
385
332
  };
386
333
  }
387
334
  cancelAllRequests() {
388
- this._pendingRequests.forEach(pending => pending.promise.cancel());
389
- this._pendingRequests.clear();
335
+ this._rpc.cancelAllRequests();
390
336
  }
391
337
  dispose() {
392
338
  this.cancelAllRequests();
@@ -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(14298, "Sign in requested"))));
123
+ const badge = ( new NumberBadge(numberOfRequests, () => ( localize(15226, "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
- 14299,
197
+ 15227,
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(14300, "&&Allow")),
204
+ label: ( localize(15228, "&&Allow")),
205
205
  run: () => SessionPromptChoice.Allow
206
206
  }, {
207
- label: ( localize(14301, "&&Deny")),
207
+ label: ( localize(15229, "&&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(14302, "Sign in to another account"))
249
+ label: ( localize(15230, "Sign in to another account"))
250
250
  });
251
251
  quickPick.items = items;
252
252
  quickPick.title = ( localize(
253
- 14303,
253
+ 15231,
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
- 14304,
259
+ 15232,
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(14305, "Grant access to {0} for {1}... (1)", provider.label, mcpServerName))
339
+ title: ( localize(15233, "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(14306, "Sign in with {0} to use {1} (1)", provider.label, mcpServerName))
383
+ title: ( localize(15234, "Sign in with {0} to use {1} (1)", provider.label, mcpServerName))
384
384
  }
385
385
  }));
386
386
  const signInCommand = CommandsRegistry.registerCommand({
@@ -5,7 +5,7 @@ import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/plat
5
5
  import { IRemoteAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
6
6
  import { IUserDataProfilesService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile.service";
7
7
  import { IRemoteUserDataProfilesService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.service";
8
- import { WorkbenchMcpManagementService as BaseWorkbenchMcpManagementService } from "../common/mcpWorkbenchManagementService.js";
8
+ import { WorkbenchMcpManagementService as BaseWorkbenchMcpManagementService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkbenchManagementService";
9
9
  import { IAllowedMcpServersService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
10
10
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
11
11
  export declare class WorkbenchMcpManagementService extends BaseWorkbenchMcpManagementService {
@@ -8,9 +8,9 @@ import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/plat
8
8
  import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
9
9
  import { IUserDataProfilesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
10
10
  import { IRemoteUserDataProfilesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.service';
11
- import { WorkbenchMcpManagementService as WorkbenchMcpManagementService$1 } from '../common/mcpWorkbenchManagementService.js';
11
+ import { WorkbenchMcpManagementService as WorkbenchMcpManagementService$1 } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkbenchManagementService';
12
12
  import { IAllowedMcpServersService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
13
- import { McpManagementService } from '../../../../platform/mcp/common/mcpManagementService.js';
13
+ import { McpManagementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagementService';
14
14
  import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
15
15
 
16
16
  let WorkbenchMcpManagementService = class WorkbenchMcpManagementService extends WorkbenchMcpManagementService$1 {
@@ -1,42 +0,0 @@
1
- import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
2
- import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
3
- import { IURITransformer } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uriIpc";
4
- import { IChannel, IServerChannel } from "@codingame/monaco-vscode-api/vscode/vs/base/parts/ipc/common/ipc";
5
- import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
6
- import { RemoteAgentConnectionContext } from "@codingame/monaco-vscode-api/vscode/vs/platform/remote/common/remoteAgentEnvironment";
7
- import { DidUninstallMcpServerEvent, IGalleryMcpServer, ILocalMcpServer, IInstallableMcpServer, InstallMcpServerEvent, InstallMcpServerResult, InstallOptions, UninstallMcpServerEvent, UninstallOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement";
8
- import { IAllowedMcpServersService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
9
- import { IMcpManagementService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
10
- import { AbstractMcpManagementService } from "./mcpManagementService.js";
11
- export declare class McpManagementChannel<TContext = RemoteAgentConnectionContext | string> implements IServerChannel<TContext> {
12
- private service;
13
- private getUriTransformer;
14
- readonly onInstallMcpServer: Event<InstallMcpServerEvent>;
15
- readonly onDidInstallMcpServers: Event<readonly InstallMcpServerResult[]>;
16
- readonly onDidUpdateMcpServers: Event<readonly InstallMcpServerResult[]>;
17
- readonly onUninstallMcpServer: Event<UninstallMcpServerEvent>;
18
- readonly onDidUninstallMcpServer: Event<DidUninstallMcpServerEvent>;
19
- constructor(service: IMcpManagementService, getUriTransformer: (requestContext: TContext) => IURITransformer | null);
20
- listen<T>(context: TContext, event: string): Event<T>;
21
- call<T>(context: TContext, command: string, args?: unknown): Promise<T>;
22
- }
23
- export declare class McpManagementChannelClient extends AbstractMcpManagementService implements IMcpManagementService {
24
- private readonly channel;
25
- readonly _serviceBrand: undefined;
26
- private readonly _onInstallMcpServer;
27
- get onInstallMcpServer(): Event<InstallMcpServerEvent>;
28
- private readonly _onDidInstallMcpServers;
29
- get onDidInstallMcpServers(): Event<readonly InstallMcpServerResult[]>;
30
- private readonly _onUninstallMcpServer;
31
- get onUninstallMcpServer(): Event<UninstallMcpServerEvent>;
32
- private readonly _onDidUninstallMcpServer;
33
- get onDidUninstallMcpServer(): Event<DidUninstallMcpServerEvent>;
34
- private readonly _onDidUpdateMcpServers;
35
- get onDidUpdateMcpServers(): Event<InstallMcpServerResult[]>;
36
- constructor(channel: IChannel, allowedMcpServersService: IAllowedMcpServersService, logService: ILogService);
37
- install(server: IInstallableMcpServer, options?: InstallOptions): Promise<ILocalMcpServer>;
38
- installFromGallery(extension: IGalleryMcpServer, installOptions?: InstallOptions): Promise<ILocalMcpServer>;
39
- uninstall(extension: ILocalMcpServer, options?: UninstallOptions): Promise<void>;
40
- getInstalled(mcpResource?: URI): Promise<ILocalMcpServer[]>;
41
- updateMetadata(local: ILocalMcpServer, gallery: IGalleryMcpServer, mcpResource?: URI): Promise<ILocalMcpServer>;
42
- }
@@ -1,105 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
5
- import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
6
- import { DefaultURITransformer, transformAndReviveIncomingURIs } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uriIpc';
7
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
8
- import { IAllowedMcpServersService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
9
- import { AbstractMcpManagementService } from './mcpManagementService.js';
10
-
11
- function transformIncomingURI(uri, transformer) {
12
- return uri ? URI.revive(uri) : undefined;
13
- }
14
- function transformIncomingServer(mcpServer, transformer) {
15
- transformer = transformer ? transformer : DefaultURITransformer;
16
- const manifest = mcpServer.manifest;
17
- const transformed = transformAndReviveIncomingURIs({
18
- ...mcpServer,
19
- ...{
20
- manifest: undefined
21
- }
22
- }, transformer);
23
- return {
24
- ...transformed,
25
- ...{
26
- manifest
27
- }
28
- };
29
- }
30
- let McpManagementChannelClient = class McpManagementChannelClient extends AbstractMcpManagementService {
31
- get onInstallMcpServer() {
32
- return this._onInstallMcpServer.event;
33
- }
34
- get onDidInstallMcpServers() {
35
- return this._onDidInstallMcpServers.event;
36
- }
37
- get onUninstallMcpServer() {
38
- return this._onUninstallMcpServer.event;
39
- }
40
- get onDidUninstallMcpServer() {
41
- return this._onDidUninstallMcpServer.event;
42
- }
43
- get onDidUpdateMcpServers() {
44
- return this._onDidUpdateMcpServers.event;
45
- }
46
- constructor(channel, allowedMcpServersService, logService) {
47
- super(allowedMcpServersService, logService);
48
- this.channel = channel;
49
- this._onInstallMcpServer = this._register(( new Emitter()));
50
- this._onDidInstallMcpServers = this._register(( new Emitter()));
51
- this._onUninstallMcpServer = this._register(( new Emitter()));
52
- this._onDidUninstallMcpServer = this._register(( new Emitter()));
53
- this._onDidUpdateMcpServers = this._register(( new Emitter()));
54
- this._register(
55
- this.channel.listen("onInstallMcpServer")(e => this._onInstallMcpServer.fire(({
56
- ...e,
57
- mcpResource: transformIncomingURI(e.mcpResource)
58
- })))
59
- );
60
- this._register(
61
- this.channel.listen("onDidInstallMcpServers")(results => this._onDidInstallMcpServers.fire(( results.map(e => ({
62
- ...e,
63
- local: e.local ? transformIncomingServer(e.local, null) : e.local,
64
- mcpResource: transformIncomingURI(e.mcpResource)
65
- })))))
66
- );
67
- this._register(
68
- this.channel.listen("onDidUpdateMcpServers")(results => this._onDidUpdateMcpServers.fire(( results.map(e => ({
69
- ...e,
70
- local: e.local ? transformIncomingServer(e.local, null) : e.local,
71
- mcpResource: transformIncomingURI(e.mcpResource)
72
- })))))
73
- );
74
- this._register(
75
- this.channel.listen("onUninstallMcpServer")(e => this._onUninstallMcpServer.fire(({
76
- ...e,
77
- mcpResource: transformIncomingURI(e.mcpResource)
78
- })))
79
- );
80
- this._register(
81
- this.channel.listen("onDidUninstallMcpServer")(e => this._onDidUninstallMcpServer.fire(({
82
- ...e,
83
- mcpResource: transformIncomingURI(e.mcpResource)
84
- })))
85
- );
86
- }
87
- install(server, options) {
88
- return Promise.resolve(this.channel.call("install", [server, options])).then(local => transformIncomingServer(local, null));
89
- }
90
- installFromGallery(extension, installOptions) {
91
- return Promise.resolve(this.channel.call("installFromGallery", [extension, installOptions])).then(local => transformIncomingServer(local, null));
92
- }
93
- uninstall(extension, options) {
94
- return Promise.resolve(this.channel.call("uninstall", [extension, options]));
95
- }
96
- getInstalled(mcpResource) {
97
- return Promise.resolve(this.channel.call("getInstalled", [mcpResource])).then(servers => ( servers.map(server => transformIncomingServer(server, null))));
98
- }
99
- updateMetadata(local, gallery, mcpResource) {
100
- return Promise.resolve(this.channel.call("updateMetadata", [local, gallery, mcpResource])).then(local => transformIncomingServer(local, null));
101
- }
102
- };
103
- McpManagementChannelClient = ( __decorate([( __param(1, IAllowedMcpServersService)), ( __param(2, ILogService))], McpManagementChannelClient));
104
-
105
- export { McpManagementChannelClient };