@codingame/monaco-vscode-mcp-service-override 26.2.1 → 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
package/index.js CHANGED
@@ -7,12 +7,12 @@ import { McpGalleryService } from './vscode/src/vs/platform/mcp/common/mcpGaller
7
7
  import { IAllowedMcpServersService, IMcpGalleryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service';
8
8
  import { McpResourceScannerService } from './vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js';
9
9
  import { IMcpResourceScannerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpResourceScannerService.service';
10
- import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js';
11
10
  import { McpElicitationService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js';
12
11
  import { McpWorkbenchService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js';
13
12
  import { McpRegistry } from './vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js';
14
13
  import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
15
14
  import { McpSamplingService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js';
15
+ import { IMcpSandboxService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpSandboxService.service';
16
16
  import { McpService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpService.js';
17
17
  import { IMcpElicitationService, IMcpSamplingService, IMcpWorkbenchService, IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
18
18
  import { AuthenticationMcpAccessService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js';
@@ -24,6 +24,10 @@ import { IAuthenticationMcpUsageService } from '@codingame/monaco-vscode-api/vsc
24
24
  import { WorkbenchMcpGalleryManifestService } from './vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js';
25
25
  import { WorkbenchMcpManagementService } from './vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js';
26
26
  import { IWorkbenchMcpManagementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.service';
27
+ import { McpSandboxService } from './vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js';
28
+ import { IWorkbenchMcpGatewayService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpGatewayService.service';
29
+ import { BrowserMcpGatewayService } from './vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js';
30
+ import './vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js';
27
31
 
28
32
  function getServiceOverride() {
29
33
  return {
@@ -39,7 +43,9 @@ function getServiceOverride() {
39
43
  [IMcpElicitationService.toString()]: new SyncDescriptor(McpElicitationService, [], true),
40
44
  [IWorkbenchMcpManagementService.toString()]: new SyncDescriptor(WorkbenchMcpManagementService, [], true),
41
45
  [IAllowedMcpServersService.toString()]: new SyncDescriptor(AllowedMcpServersService, [], true),
42
- [IMcpGalleryManifestService.toString()]: new SyncDescriptor(WorkbenchMcpGalleryManifestService, [], true)
46
+ [IMcpGalleryManifestService.toString()]: new SyncDescriptor(WorkbenchMcpGalleryManifestService, [], true),
47
+ [IMcpSandboxService.toString()]: new SyncDescriptor(McpSandboxService, [], true),
48
+ [IWorkbenchMcpGatewayService.toString()]: new SyncDescriptor(BrowserMcpGatewayService, [], true)
43
49
  };
44
50
  }
45
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-mcp-service-override",
3
- "version": "26.2.1",
3
+ "version": "27.0.0",
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.2.1"
18
+ "@codingame/monaco-vscode-api": "27.0.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -0,0 +1,66 @@
1
+ import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
2
+ import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
3
+ export type JsonRpcId = string | number;
4
+ export interface IJsonRpcError {
5
+ code: number;
6
+ message: string;
7
+ data?: unknown;
8
+ }
9
+ export interface IJsonRpcRequest {
10
+ jsonrpc: "2.0";
11
+ id: JsonRpcId;
12
+ method: string;
13
+ params?: unknown;
14
+ }
15
+ export interface IJsonRpcNotification {
16
+ jsonrpc: "2.0";
17
+ method: string;
18
+ params?: unknown;
19
+ }
20
+ export interface IJsonRpcSuccessResponse {
21
+ jsonrpc: "2.0";
22
+ id: JsonRpcId;
23
+ result: unknown;
24
+ }
25
+ export interface IJsonRpcErrorResponse {
26
+ jsonrpc: "2.0";
27
+ id?: JsonRpcId;
28
+ error: IJsonRpcError;
29
+ }
30
+ export type JsonRpcMessage = IJsonRpcRequest | IJsonRpcNotification | IJsonRpcSuccessResponse | IJsonRpcErrorResponse;
31
+ export interface IJsonRpcProtocolHandlers {
32
+ handleRequest?(request: IJsonRpcRequest, token: CancellationToken): Promise<unknown> | unknown;
33
+ handleNotification?(notification: IJsonRpcNotification): void;
34
+ }
35
+ export declare class JsonRpcError extends Error {
36
+ readonly code: number;
37
+ readonly data?: unknown | undefined;
38
+ constructor(code: number, message: string, data?: unknown | undefined);
39
+ }
40
+ /**
41
+ * Generic JSON-RPC 2.0 protocol helper.
42
+ */
43
+ export declare class JsonRpcProtocol extends Disposable {
44
+ private readonly _send;
45
+ private readonly _handlers;
46
+ private static readonly ParseError;
47
+ private static readonly MethodNotFound;
48
+ private static readonly InternalError;
49
+ private _nextRequestId;
50
+ private readonly _pendingRequests;
51
+ constructor(_send: (message: JsonRpcMessage) => void, _handlers: IJsonRpcProtocolHandlers);
52
+ sendNotification(notification: Omit<IJsonRpcNotification, "jsonrpc">): void;
53
+ sendRequest<T = unknown>(request: Omit<IJsonRpcRequest, "jsonrpc" | "id">, token?: CancellationToken, onCancel?: (id: JsonRpcId) => void): Promise<T>;
54
+ handleMessage(message: JsonRpcMessage | JsonRpcMessage[]): Promise<void>;
55
+ cancelPendingRequest(id: JsonRpcId): void;
56
+ cancelAllRequests(): void;
57
+ private _handleMessage;
58
+ private _handleResult;
59
+ private _handleError;
60
+ private _handleRequest;
61
+ dispose(): void;
62
+ static createParseError(message: string, data?: unknown): IJsonRpcErrorResponse;
63
+ }
64
+ export declare function isJsonRpcRequest(message: JsonRpcMessage): message is IJsonRpcRequest;
65
+ export declare function isJsonRpcResponse(message: JsonRpcMessage): message is IJsonRpcSuccessResponse | IJsonRpcErrorResponse;
66
+ export declare function isJsonRpcNotification(message: JsonRpcMessage): message is IJsonRpcNotification;
@@ -0,0 +1,216 @@
1
+
2
+ import { DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
3
+ import { CancellationToken, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
4
+ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
5
+ import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
7
+
8
+ class JsonRpcError extends Error {
9
+ constructor(code, message, data) {
10
+ super(message);
11
+ this.code = code;
12
+ this.data = data;
13
+ }
14
+ }
15
+ class JsonRpcProtocol extends Disposable {
16
+ static {
17
+ this.ParseError = -32700;
18
+ }
19
+ static {
20
+ this.MethodNotFound = -32601;
21
+ }
22
+ static {
23
+ this.InternalError = -32603;
24
+ }
25
+ constructor(_send, _handlers) {
26
+ super();
27
+ this._send = _send;
28
+ this._handlers = _handlers;
29
+ this._nextRequestId = 1;
30
+ this._pendingRequests = ( new Map());
31
+ }
32
+ sendNotification(notification) {
33
+ this._send({
34
+ jsonrpc: "2.0",
35
+ ...notification
36
+ });
37
+ }
38
+ sendRequest(request, token = CancellationToken.None, onCancel) {
39
+ if (this._store.isDisposed) {
40
+ return Promise.reject(( new CancellationError()));
41
+ }
42
+ const id = this._nextRequestId++;
43
+ const promise = ( new DeferredPromise());
44
+ const cts = ( new CancellationTokenSource());
45
+ this._pendingRequests.set(id, {
46
+ promise,
47
+ cts
48
+ });
49
+ const cancelListener = token.onCancellationRequested(() => {
50
+ if (!promise.isSettled) {
51
+ this._pendingRequests.delete(id);
52
+ cts.cancel();
53
+ onCancel?.(id);
54
+ promise.cancel();
55
+ }
56
+ cancelListener.dispose();
57
+ });
58
+ this._send({
59
+ jsonrpc: "2.0",
60
+ id,
61
+ ...request
62
+ });
63
+ return promise.p.finally(() => {
64
+ cancelListener.dispose();
65
+ this._pendingRequests.delete(id);
66
+ cts.dispose(true);
67
+ });
68
+ }
69
+ async handleMessage(message) {
70
+ if (Array.isArray(message)) {
71
+ for (const single of message) {
72
+ await this._handleMessage(single);
73
+ }
74
+ return;
75
+ }
76
+ await this._handleMessage(message);
77
+ }
78
+ cancelPendingRequest(id) {
79
+ const request = this._pendingRequests.get(id);
80
+ if (request) {
81
+ this._pendingRequests.delete(id);
82
+ request.cts.cancel();
83
+ request.promise.cancel();
84
+ request.cts.dispose(true);
85
+ }
86
+ }
87
+ cancelAllRequests() {
88
+ for (const [id, pending] of this._pendingRequests) {
89
+ this._pendingRequests.delete(id);
90
+ pending.cts.cancel();
91
+ pending.promise.cancel();
92
+ pending.cts.dispose(true);
93
+ }
94
+ }
95
+ async _handleMessage(message) {
96
+ if (isJsonRpcResponse(message)) {
97
+ if (hasKey(message, {
98
+ result: true
99
+ })) {
100
+ this._handleResult(message);
101
+ } else {
102
+ this._handleError(message);
103
+ }
104
+ }
105
+ if (isJsonRpcRequest(message)) {
106
+ await this._handleRequest(message);
107
+ }
108
+ if (isJsonRpcNotification(message)) {
109
+ this._handlers.handleNotification?.(message);
110
+ }
111
+ }
112
+ _handleResult(response) {
113
+ const request = this._pendingRequests.get(response.id);
114
+ if (request) {
115
+ this._pendingRequests.delete(response.id);
116
+ request.promise.complete(response.result);
117
+ request.cts.dispose(true);
118
+ }
119
+ }
120
+ _handleError(response) {
121
+ if (response.id === undefined) {
122
+ return;
123
+ }
124
+ const request = this._pendingRequests.get(response.id);
125
+ if (request) {
126
+ this._pendingRequests.delete(response.id);
127
+ request.promise.error(( new JsonRpcError(response.error.code, response.error.message, response.error.data)));
128
+ request.cts.dispose(true);
129
+ }
130
+ }
131
+ async _handleRequest(request) {
132
+ if (!this._handlers.handleRequest) {
133
+ this._send({
134
+ jsonrpc: "2.0",
135
+ id: request.id,
136
+ error: {
137
+ code: JsonRpcProtocol.MethodNotFound,
138
+ message: `Method not found: ${request.method}`
139
+ }
140
+ });
141
+ return;
142
+ }
143
+ const cts = ( new CancellationTokenSource());
144
+ this._register(toDisposable(() => cts.dispose(true)));
145
+ try {
146
+ const resultOrThenable = this._handlers.handleRequest(request, cts.token);
147
+ const result = isThenable(resultOrThenable) ? await resultOrThenable : resultOrThenable;
148
+ this._send({
149
+ jsonrpc: "2.0",
150
+ id: request.id,
151
+ result
152
+ });
153
+ } catch (error) {
154
+ if (error instanceof JsonRpcError) {
155
+ this._send({
156
+ jsonrpc: "2.0",
157
+ id: request.id,
158
+ error: {
159
+ code: error.code,
160
+ message: error.message,
161
+ data: error.data
162
+ }
163
+ });
164
+ } else {
165
+ this._send({
166
+ jsonrpc: "2.0",
167
+ id: request.id,
168
+ error: {
169
+ code: JsonRpcProtocol.InternalError,
170
+ message: error instanceof Error ? error.message : "Internal error"
171
+ }
172
+ });
173
+ }
174
+ } finally {
175
+ cts.dispose(true);
176
+ }
177
+ }
178
+ dispose() {
179
+ this.cancelAllRequests();
180
+ super.dispose();
181
+ }
182
+ static createParseError(message, data) {
183
+ return {
184
+ jsonrpc: "2.0",
185
+ error: {
186
+ code: JsonRpcProtocol.ParseError,
187
+ message,
188
+ data
189
+ }
190
+ };
191
+ }
192
+ }
193
+ function isJsonRpcRequest(message) {
194
+ return "method" in message && "id" in message && (typeof message.id === "string" || typeof message.id === "number");
195
+ }
196
+ function isJsonRpcResponse(message) {
197
+ return hasKey(message, {
198
+ id: true,
199
+ result: true
200
+ }) || hasKey(message, {
201
+ id: true,
202
+ error: true
203
+ });
204
+ }
205
+ function isJsonRpcNotification(message) {
206
+ return hasKey(message, {
207
+ method: true
208
+ }) && !hasKey(message, {
209
+ id: true
210
+ });
211
+ }
212
+ function isThenable(value) {
213
+ return typeof value === "object" && value !== null && "then" in value && typeof value.then === "function";
214
+ }
215
+
216
+ export { JsonRpcError, JsonRpcProtocol, isJsonRpcNotification, isJsonRpcRequest, isJsonRpcResponse };
@@ -27,7 +27,7 @@ let AllowedMcpServersService = class AllowedMcpServersService extends Disposable
27
27
  query: `@id:${mcpAccessConfig}`
28
28
  }).toString());
29
29
  return (new MarkdownString(localize(
30
- 2002,
30
+ 2033,
31
31
  "Model Context Protocol servers are disabled in the Editor. Please check your [settings]({0}).",
32
32
  settingsCommandLink
33
33
  )));
@@ -456,7 +456,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
456
456
  async getReadme(gallery, token) {
457
457
  const readmeUrl = gallery.readmeUrl;
458
458
  if (!readmeUrl) {
459
- return Promise.resolve(( localize(2003, "No README available")));
459
+ return Promise.resolve(( localize(2034, "No README available")));
460
460
  }
461
461
  const uri = ( URI.parse(readmeUrl));
462
462
  if (uri.scheme === Schemas.file) {
@@ -468,7 +468,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
468
468
  }
469
469
  }
470
470
  if (uri.authority !== "raw.githubusercontent.com") {
471
- return ( new MarkdownString(( localize(2004, "You can find information about this server [here]({0})", readmeUrl)))).value;
471
+ return ( new MarkdownString(( localize(2035, "You can find information about this server [here]({0})", readmeUrl)))).value;
472
472
  }
473
473
  const context = await this.requestService.request({
474
474
  type: "GET",
@@ -0,0 +1,39 @@
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 { MCP } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/modelContextProtocol";
4
+ export declare const McpGatewayChannelName = "mcpGateway";
5
+ export declare const McpGatewayToolBrokerChannelName = "mcpGatewayToolBroker";
6
+ export interface IGatewayCallToolResult {
7
+ result: MCP.CallToolResult;
8
+ serverIndex: number;
9
+ }
10
+ export interface IGatewayServerResources {
11
+ serverIndex: number;
12
+ resources: readonly MCP.Resource[];
13
+ }
14
+ export interface IGatewayServerResourceTemplates {
15
+ serverIndex: number;
16
+ resourceTemplates: readonly MCP.ResourceTemplate[];
17
+ }
18
+ export interface IMcpGatewayToolInvoker {
19
+ readonly onDidChangeTools: Event<void>;
20
+ readonly onDidChangeResources: Event<void>;
21
+ listTools(): Promise<readonly MCP.Tool[]>;
22
+ callTool(name: string, args: Record<string, unknown>): Promise<IGatewayCallToolResult>;
23
+ listResources(): Promise<readonly IGatewayServerResources[]>;
24
+ readResource(serverIndex: number, uri: string): Promise<MCP.ReadResourceResult>;
25
+ listResourceTemplates(): Promise<readonly IGatewayServerResourceTemplates[]>;
26
+ }
27
+ /**
28
+ * Result of creating an MCP gateway.
29
+ */
30
+ export interface IMcpGatewayInfo {
31
+ /**
32
+ * The address of the HTTP endpoint for this gateway.
33
+ */
34
+ readonly address: URI;
35
+ /**
36
+ * The unique identifier for this gateway, used for disposal.
37
+ */
38
+ readonly gatewayId: string;
39
+ }
@@ -0,0 +1,6 @@
1
+
2
+
3
+ const McpGatewayChannelName = 'mcpGateway';
4
+ const McpGatewayToolBrokerChannelName = 'mcpGatewayToolBroker';
5
+
6
+ export { McpGatewayChannelName, McpGatewayToolBrokerChannelName };
@@ -6,11 +6,12 @@ import { ConfigurationTarget } from "@codingame/monaco-vscode-api/vscode/vs/plat
6
6
  import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
7
7
  import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
8
8
  import { IInstallableMcpServer } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement";
9
- import { IMcpServerConfiguration, IMcpServerVariable } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpPlatformTypes";
9
+ import { IMcpSandboxConfiguration, IMcpServerConfiguration, IMcpServerVariable } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpPlatformTypes";
10
10
  import { IMcpResourceScannerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpResourceScannerService.service";
11
11
  export interface IScannedMcpServers {
12
12
  servers?: IStringDictionary<Mutable<IMcpServerConfiguration>>;
13
13
  inputs?: IMcpServerVariable[];
14
+ sandbox?: IMcpSandboxConfiguration;
14
15
  }
15
16
  export type McpResourceTarget = ConfigurationTarget.USER | ConfigurationTarget.WORKSPACE | ConfigurationTarget.WORKSPACE_FOLDER;
16
17
  export declare class McpResourceScannerService extends Disposable implements IMcpResourceScannerService {
@@ -42,7 +42,8 @@ let McpResourceScannerService = class McpResourceScannerService extends Disposab
42
42
  }
43
43
  return {
44
44
  servers: existingServers,
45
- inputs: updatedInputs
45
+ inputs: updatedInputs,
46
+ sandbox: scannedMcpServers.sandbox
46
47
  };
47
48
  });
48
49
  }
@@ -147,31 +148,33 @@ let McpResourceScannerService = class McpResourceScannerService extends Disposab
147
148
  }
148
149
  fromUserMcpServers(scannedMcpServers) {
149
150
  const userMcpServers = {
150
- inputs: scannedMcpServers.inputs
151
+ inputs: scannedMcpServers.inputs,
152
+ sandbox: scannedMcpServers.sandbox
151
153
  };
152
154
  const servers = Object.entries(scannedMcpServers.servers ?? {});
153
155
  if (servers.length > 0) {
154
156
  userMcpServers.servers = {};
155
157
  for (const [serverName, server] of servers) {
156
- userMcpServers.servers[serverName] = this.sanitizeServer(server);
158
+ userMcpServers.servers[serverName] = this.sanitizeServer(server, scannedMcpServers.sandbox);
157
159
  }
158
160
  }
159
161
  return userMcpServers;
160
162
  }
161
163
  fromWorkspaceFolderMcpServers(scannedWorkspaceFolderMcpServers) {
162
164
  const scannedMcpServers = {
163
- inputs: scannedWorkspaceFolderMcpServers.inputs
165
+ inputs: scannedWorkspaceFolderMcpServers.inputs,
166
+ sandbox: scannedWorkspaceFolderMcpServers.sandbox
164
167
  };
165
168
  const servers = Object.entries(scannedWorkspaceFolderMcpServers.servers ?? {});
166
169
  if (servers.length > 0) {
167
170
  scannedMcpServers.servers = {};
168
171
  for (const [serverName, config] of servers) {
169
- scannedMcpServers.servers[serverName] = this.sanitizeServer(config);
172
+ scannedMcpServers.servers[serverName] = this.sanitizeServer(config, scannedWorkspaceFolderMcpServers.sandbox);
170
173
  }
171
174
  }
172
175
  return scannedMcpServers;
173
176
  }
174
- sanitizeServer(serverOrConfig) {
177
+ sanitizeServer(serverOrConfig, sandbox) {
175
178
  let server;
176
179
  if (serverOrConfig.config) {
177
180
  const oldScannedMcpServer = serverOrConfig;
@@ -186,6 +189,9 @@ let McpResourceScannerService = class McpResourceScannerService extends Disposab
186
189
  if (server.type === undefined || (server.type !== McpServerType.REMOTE && server.type !== McpServerType.LOCAL)) {
187
190
  server.type = server.command ? McpServerType.LOCAL : McpServerType.REMOTE;
188
191
  }
192
+ if (sandbox && server.type === McpServerType.LOCAL && !server.sandbox && server.sandboxEnabled) {
193
+ server.sandbox = sandbox;
194
+ }
189
195
  return server;
190
196
  }
191
197
  getResourceAccessQueue(file) {
@@ -17,6 +17,7 @@ import { ExtensionMcpDiscovery } from '../common/discovery/extensionMcpDiscovery
17
17
  import { InstalledMcpServersDiscovery } from '../common/discovery/installedMcpServersDiscovery.js';
18
18
  import { mcpDiscoveryRegistry } from '../common/discovery/mcpDiscovery.js';
19
19
  import { RemoteNativeMpcDiscovery } from '../common/discovery/nativeMcpRemoteDiscovery.js';
20
+ import { PluginMcpDiscovery } from '../common/discovery/pluginMcpDiscovery.js';
20
21
  import { CursorWorkspaceMcpDiscoveryAdapter } from '../common/discovery/workspaceMcpDiscoveryAdapter.js';
21
22
  import { McpCommandIds } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpCommandIds';
22
23
  import { mcpServerSchema } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
@@ -25,9 +26,12 @@ import '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpD
25
26
  import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
26
27
  import { McpLanguageModelToolContribution } from '../common/mcpLanguageModelToolContribution.js';
27
28
  import '../common/mcpRegistry.js';
29
+ import '../common/mcpSandboxService.js';
28
30
  import { McpResourceFilesystem } from '../common/mcpResourceFilesystem.js';
29
31
  import '../common/mcpSamplingService.js';
30
32
  import '../common/mcpService.js';
33
+ import './mcpGatewayService.js';
34
+ import { McpGatewayToolBrokerContribution } from './mcpGatewayToolBrokerContribution.js';
31
35
  import { McpAddContextContribution } from './mcpAddContextContribution.js';
32
36
  import { ListMcpServerCommand, McpServerOptionsCommand, McpConfirmationServerOptionsCommand, ResetMcpTrustCommand, ResetMcpCachedTools, AddConfigurationAction, InstallFromManifestAction, RemoveStoredInput, EditStoredInput, StartServer, StopServer, ShowOutput, RestartServer, ShowConfiguration, McpBrowseCommand, OpenUserMcpResourceCommand, OpenRemoteUserMcpResourceCommand, OpenWorkspaceMcpResourceCommand, OpenWorkspaceFolderMcpResourceCommand, ShowInstalledMcpServersCommand, McpBrowseResourcesCommand, McpConfigureSamplingModels, McpStartPromptingServerCommand, McpSkipCurrentAutostartCommand, MCPServerActionRendering } from './mcpCommands.js';
33
37
  import { McpDiscovery } from './mcpDiscovery.js';
@@ -35,8 +39,8 @@ import './mcpElicitationService.js';
35
39
  import { McpLanguageFeatures } from './mcpLanguageFeatures.js';
36
40
  import { McpConfigMigrationContribution } from './mcpMigration.js';
37
41
  import { McpResourceQuickAccess } from './mcpResourceQuickAccess.js';
38
- import { McpServerEditor } from './mcpServerEditor.js';
39
- import { McpServerEditorInput } from './mcpServerEditorInput.js';
42
+ import { McpServerEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/browser/mcpServerEditor';
43
+ import { McpServerEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/browser/mcpServerEditorInput';
40
44
  import { McpServersViewsContribution } from './mcpServersView.js';
41
45
  import { MCPContextsInitialisation } from './mcpWorkbenchService.js';
42
46
 
@@ -44,6 +48,7 @@ mcpDiscoveryRegistry.register(( new SyncDescriptor(RemoteNativeMpcDiscovery)));
44
48
  mcpDiscoveryRegistry.register(( new SyncDescriptor(InstalledMcpServersDiscovery)));
45
49
  mcpDiscoveryRegistry.register(( new SyncDescriptor(ExtensionMcpDiscovery)));
46
50
  mcpDiscoveryRegistry.register(( new SyncDescriptor(CursorWorkspaceMcpDiscoveryAdapter)));
51
+ mcpDiscoveryRegistry.register(( new SyncDescriptor(PluginMcpDiscovery)));
47
52
  registerWorkbenchContribution2("mcpDiscovery", McpDiscovery, WorkbenchPhase.AfterRestored);
48
53
  registerWorkbenchContribution2("mcpContextKeys", McpContextKeysController, WorkbenchPhase.BlockRestore);
49
54
  registerWorkbenchContribution2("mcpLanguageFeatures", McpLanguageFeatures, WorkbenchPhase.Eventually);
@@ -57,6 +62,11 @@ registerWorkbenchContribution2(
57
62
  McpLanguageModelToolContribution,
58
63
  WorkbenchPhase.AfterRestored
59
64
  );
65
+ registerWorkbenchContribution2(
66
+ "mcpGatewayToolBrokerRemote",
67
+ McpGatewayToolBrokerContribution,
68
+ WorkbenchPhase.AfterRestored
69
+ );
60
70
  registerAction2(ListMcpServerCommand);
61
71
  registerAction2(McpServerOptionsCommand);
62
72
  registerAction2(McpConfirmationServerOptionsCommand);
@@ -105,16 +115,16 @@ registerWorkbenchContribution2(
105
115
  const jsonRegistry = ( Registry.as(Extensions.JSONContribution));
106
116
  jsonRegistry.registerSchema(mcpSchemaId, mcpServerSchema);
107
117
  ( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(
108
- EditorPaneDescriptor.create(McpServerEditor, McpServerEditor.ID, ( localize(9213, "MCP Server"))),
118
+ EditorPaneDescriptor.create(McpServerEditor, McpServerEditor.ID, ( localize(9908, "MCP Server"))),
109
119
  [( new SyncDescriptor(McpServerEditorInput))]
110
120
  );
111
121
  ( Registry.as(Extensions$1.Quickaccess)).registerQuickAccessProvider({
112
122
  ctor: McpResourceQuickAccess,
113
123
  prefix: McpResourceQuickAccess.PREFIX,
114
124
  when: ChatContextKeys.enabled,
115
- placeholder: ( localize(9214, "Filter to an MCP resource")),
125
+ placeholder: ( localize(9909, "Filter to an MCP resource")),
116
126
  helpEntries: [{
117
- description: ( localize(9215, "MCP Server Resources")),
127
+ description: ( localize(9910, "MCP Server Resources")),
118
128
  commandId: McpCommandIds.AddConfiguration
119
129
  }]
120
130
  });
@@ -43,7 +43,7 @@ let McpAddContextContribution = class McpAddContextContribution extends Disposab
43
43
  _registerAddContextMenu() {
44
44
  this._addContextMenu.value = this._chatContextPickService.registerChatContextItem({
45
45
  type: "pickerPick",
46
- label: ( localize(9216, "MCP Resources...")),
46
+ label: ( localize(9911, "MCP Resources...")),
47
47
  icon: Codicon.mcp,
48
48
  isEnabled(widget) {
49
49
  return !!widget.attachmentCapabilities.supportsMCPAttachments;
@@ -51,7 +51,7 @@ let McpAddContextContribution = class McpAddContextContribution extends Disposab
51
51
  asPicker: () => {
52
52
  const helper = this._instantiationService.createInstance(McpResourcePickHelper);
53
53
  return {
54
- placeholder: ( localize(9217, "Select MCP Resource...")),
54
+ placeholder: ( localize(9912, "Select MCP Resource...")),
55
55
  picks: (_query, token) => this._getResourcePicks(token, helper),
56
56
  goBack: () => {
57
57
  return helper.navigateBack();