@codingame/monaco-vscode-mcp-service-override 34.1.3 → 35.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.
- package/package.json +2 -2
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +1 -1
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +6 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +247 -73
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +25 -25
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +23 -23
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +8 -8
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +37 -37
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +17 -17
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +10 -10
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +8 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +13 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +11 -11
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +4 -9
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +5 -48
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts +12 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js +3 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.js +0 -118
|
@@ -86,7 +86,7 @@ let NativeFilesystemMcpDiscovery = class NativeFilesystemMcpDiscovery extends Fi
|
|
|
86
86
|
this.suffix = "";
|
|
87
87
|
if (remoteAuthority) {
|
|
88
88
|
this.suffix = " " + ( localize(
|
|
89
|
-
|
|
89
|
+
12088,
|
|
90
90
|
" on {0}",
|
|
91
91
|
labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority)
|
|
92
92
|
));
|
|
@@ -14,19 +14,19 @@ var McpContextKeys;
|
|
|
14
14
|
(function(McpContextKeys) {
|
|
15
15
|
McpContextKeys.serverCount = ( new RawContextKey("mcp.serverCount", undefined, {
|
|
16
16
|
type: "number",
|
|
17
|
-
description: ( localize(
|
|
17
|
+
description: ( localize(12132, "Context key that has the number of registered MCP servers"))
|
|
18
18
|
}));
|
|
19
19
|
McpContextKeys.hasUnknownTools = ( new RawContextKey("mcp.hasUnknownTools", undefined, {
|
|
20
20
|
type: "boolean",
|
|
21
|
-
description: ( localize(
|
|
21
|
+
description: ( localize(12133, "Indicates whether there are MCP servers with unknown tools."))
|
|
22
22
|
}));
|
|
23
23
|
McpContextKeys.hasServersWithErrors = ( new RawContextKey("mcp.hasServersWithErrors", undefined, {
|
|
24
24
|
type: "boolean",
|
|
25
|
-
description: ( localize(
|
|
25
|
+
description: ( localize(12134, "Indicates whether there are any MCP servers with errors."))
|
|
26
26
|
}));
|
|
27
27
|
McpContextKeys.toolsCount = ( new RawContextKey("mcp.toolsCount", undefined, {
|
|
28
28
|
type: "number",
|
|
29
|
-
description: ( localize(
|
|
29
|
+
description: ( localize(12135, "Context key that has the number of registered MCP tools"))
|
|
30
30
|
}));
|
|
31
31
|
})(McpContextKeys || (McpContextKeys = {}));
|
|
32
32
|
let McpContextKeysController = class McpContextKeysController extends Disposable {
|
|
@@ -71,7 +71,8 @@ let McpLanguageModelToolContribution = class McpLanguageModelToolContribution ex
|
|
|
71
71
|
const toolSet = store.add(
|
|
72
72
|
this._toolsService.createToolSet(source, server.definition.id, referenceName, {
|
|
73
73
|
icon: Codicon.mcp,
|
|
74
|
-
description: ( localize(
|
|
74
|
+
description: ( localize(12136, "{0}: All Tools", server.definition.label)),
|
|
75
|
+
deprecated: true
|
|
75
76
|
})
|
|
76
77
|
);
|
|
77
78
|
return {
|
|
@@ -191,7 +192,7 @@ let McpToolImplementation = class McpToolImplementation {
|
|
|
191
192
|
});
|
|
192
193
|
const isSandboxedServer = sandboxEnabled === true;
|
|
193
194
|
const mcpToolWarning = ( localize(
|
|
194
|
-
|
|
195
|
+
12137,
|
|
195
196
|
"Note that MCP servers or malicious conversation content may attempt to misuse '{0}' through tools.",
|
|
196
197
|
this._productService.nameShort
|
|
197
198
|
));
|
|
@@ -200,7 +201,7 @@ let McpToolImplementation = class McpToolImplementation {
|
|
|
200
201
|
if (!isSandboxedServer) {
|
|
201
202
|
confirm = {};
|
|
202
203
|
if (!tool.definition.annotations?.readOnlyHint) {
|
|
203
|
-
confirm.title = ( new MarkdownString(( localize(
|
|
204
|
+
confirm.title = ( new MarkdownString(( localize(12138, "Run {0}", title))));
|
|
204
205
|
confirm.message = ( new MarkdownString(tool.definition.description, {
|
|
205
206
|
supportThemeIcons: true
|
|
206
207
|
}));
|
|
@@ -214,13 +215,14 @@ let McpToolImplementation = class McpToolImplementation {
|
|
|
214
215
|
const mcpUiEnabled = this._configurationService.getValue(mcpAppsEnabledConfig);
|
|
215
216
|
return {
|
|
216
217
|
confirmationMessages: confirm,
|
|
217
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
218
|
-
pastTenseMessage: ( new MarkdownString(( localize(
|
|
219
|
-
originMessage: ( localize(
|
|
218
|
+
invocationMessage: ( new MarkdownString(( localize(12139, "Running {0}", title)))),
|
|
219
|
+
pastTenseMessage: ( new MarkdownString(( localize(12140, "Ran {0} ", title)))),
|
|
220
|
+
originMessage: ( localize(12141, "{0} (MCP Server)", server.definition.label)),
|
|
220
221
|
toolSpecificData: {
|
|
221
222
|
kind: "input",
|
|
222
223
|
rawInput: context.parameters,
|
|
223
224
|
mcpAppData: mcpUiEnabled && tool.uiResourceUri ? {
|
|
225
|
+
kind: "local",
|
|
224
226
|
resourceUri: tool.uiResourceUri,
|
|
225
227
|
serverDefinitionId: server.definition.id,
|
|
226
228
|
collectionId: server.collection.id
|
|
@@ -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(
|
|
230
|
+
message: ( localize(12142, "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(
|
|
308
|
+
labelWithOrigin += ` (${( localize(12143, "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(
|
|
318
|
+
message: ( localize(12144, "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
|
-
|
|
323
|
+
12145,
|
|
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(
|
|
336
|
+
label: ( localize(12146, "Trust")),
|
|
337
337
|
run: () => true
|
|
338
338
|
}, {
|
|
339
|
-
label: ( localize(
|
|
339
|
+
label: ( localize(12147, "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(
|
|
349
|
+
message: ( localize(12148, "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
|
-
|
|
354
|
+
12149,
|
|
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(
|
|
367
|
+
label: ( localize(12146, "Trust")),
|
|
368
368
|
run: () => "all"
|
|
369
369
|
}, {
|
|
370
|
-
label: ( localize(
|
|
370
|
+
label: ( localize(12150, "Pick Trusted")),
|
|
371
371
|
run: () => "pick"
|
|
372
372
|
}, {
|
|
373
|
-
label: ( localize(
|
|
373
|
+
label: ( localize(12147, "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(
|
|
536
|
+
message: ( localize(12151, "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(
|
|
543
|
+
label: ( localize(12152, "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(
|
|
44
|
+
parts.push(( localize(12153, "{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
|
-
|
|
134
|
+
12154,
|
|
135
135
|
"Allow MCP tools from \"{0}\" to make LLM requests?",
|
|
136
136
|
opts.server.definition.label
|
|
137
137
|
)), ( localize(
|
|
138
|
-
|
|
138
|
+
12155,
|
|
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
|
-
|
|
152
|
+
12156,
|
|
153
153
|
"Allow MCP server \"{0}\" to make LLM requests?",
|
|
154
154
|
opts.server.definition.label
|
|
155
155
|
)), ( localize(
|
|
156
|
-
|
|
156
|
+
12157,
|
|
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
|
-
|
|
168
|
+
12158,
|
|
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(
|
|
173
|
-
[( localize(
|
|
172
|
+
[( localize(12159, "Configure"))]: () => this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server),
|
|
173
|
+
[( localize(12160, "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(
|
|
184
|
+
[( localize(12161, "Allow in this Session"))]: async () => {
|
|
185
185
|
this._sessionSets[key].set(server.definition.id, true);
|
|
186
186
|
return true;
|
|
187
187
|
},
|
|
188
|
-
[( localize(
|
|
188
|
+
[( localize(12162, "Always"))]: async () => {
|
|
189
189
|
await this.updateConfig(server, c => c[key] = true);
|
|
190
190
|
return true;
|
|
191
191
|
},
|
|
192
|
-
[( localize(
|
|
192
|
+
[( localize(12163, "Not Now"))]: async () => {
|
|
193
193
|
this._sessionSets[key].set(server.definition.id, false);
|
|
194
194
|
return false;
|
|
195
195
|
},
|
|
196
|
-
[( localize(
|
|
196
|
+
[( localize(12164, "Never"))]: async () => {
|
|
197
197
|
await this.updateConfig(server, c => c[key] = false);
|
|
198
198
|
return false;
|
|
199
199
|
}
|
|
@@ -103,11 +103,11 @@ let McpSandboxService = class McpSandboxService extends Disposable {
|
|
|
103
103
|
const suggestionLines = [];
|
|
104
104
|
if (allowedDomainsList.length) {
|
|
105
105
|
const shown = ( allowedDomainsList.map(domain => `"${domain}"`)).join(", ");
|
|
106
|
-
suggestionLines.push(( localize(
|
|
106
|
+
suggestionLines.push(( localize(12165, "Add to `sandbox.network.allowedDomains`: {0}", shown)));
|
|
107
107
|
}
|
|
108
108
|
if (allowWriteList.length) {
|
|
109
109
|
const shown = ( allowWriteList.map(path => `"${path}"`)).join(", ");
|
|
110
|
-
suggestionLines.push(( localize(
|
|
110
|
+
suggestionLines.push(( localize(12166, "Add to `sandbox.filesystem.allowWrite`: {0}", shown)));
|
|
111
111
|
}
|
|
112
112
|
const sandboxConfig = {};
|
|
113
113
|
if (allowedDomainsList.length) {
|
|
@@ -122,7 +122,7 @@ let McpSandboxService = class McpSandboxService extends Disposable {
|
|
|
122
122
|
}
|
|
123
123
|
return {
|
|
124
124
|
message: ( localize(
|
|
125
|
-
|
|
125
|
+
12167,
|
|
126
126
|
"The MCP server {0} reported potential sandbox blocks. VS Code found possible sandbox configuration updates:\n{1}",
|
|
127
127
|
serverLabel,
|
|
128
128
|
suggestionLines.join("\n")
|
|
@@ -52,7 +52,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
|
|
|
52
52
|
this._state.set({
|
|
53
53
|
state: McpConnectionState.Kind.Starting
|
|
54
54
|
}, undefined);
|
|
55
|
-
this._logger.info(( localize(
|
|
55
|
+
this._logger.info(( localize(12183, "Starting server {0}", this.definition.label)));
|
|
56
56
|
try {
|
|
57
57
|
const launch = this._delegate.start(this._collection, this.definition, this.launchDefinition, {
|
|
58
58
|
errorOnUserInteraction: this._errorOnUserInteraction
|
|
@@ -89,7 +89,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
|
|
|
89
89
|
store.add(autorun(reader => {
|
|
90
90
|
const state = launch.state.read(reader);
|
|
91
91
|
this._state.set(state, undefined);
|
|
92
|
-
this._logger.info(( localize(
|
|
92
|
+
this._logger.info(( localize(12184, "Connection state: {0}", (McpConnectionState.toString(state)))));
|
|
93
93
|
if (state.state === McpConnectionState.Kind.Running && !didStart) {
|
|
94
94
|
didStart = true;
|
|
95
95
|
McpServerRequestHandler.create(this._instantiationService, {
|
|
@@ -128,7 +128,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
async stop() {
|
|
131
|
-
this._logger.info(( localize(
|
|
131
|
+
this._logger.info(( localize(12185, "Stopping server {0}", this.definition.label)));
|
|
132
132
|
this._launch.value?.object.stop();
|
|
133
133
|
await this._waitForState(McpConnectionState.Kind.Stopped, McpConnectionState.Kind.Error);
|
|
134
134
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
-
import { IObservable
|
|
3
|
+
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
|
|
4
4
|
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
5
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
6
6
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
7
7
|
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
8
|
-
import {
|
|
8
|
+
import { CollisionEnablementModel, EnablementModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement";
|
|
9
9
|
import { McpCollisionBehavior } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration";
|
|
10
10
|
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
11
11
|
import { McpServerMetadataCache } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpServer";
|
|
@@ -50,16 +50,11 @@ export declare class McpService extends Disposable implements IMcpService {
|
|
|
50
50
|
*
|
|
51
51
|
* When collision behavior is `suffix`, delegates everything unchanged.
|
|
52
52
|
*/
|
|
53
|
-
export declare class McpCollisionEnablementModel
|
|
54
|
-
private readonly _base;
|
|
53
|
+
export declare class McpCollisionEnablementModel extends CollisionEnablementModel {
|
|
55
54
|
/**
|
|
56
55
|
* For each server definition ID, the list of all definition IDs that share
|
|
57
56
|
* the same (case-insensitive) label, in priority order (lowest collection
|
|
58
57
|
* order first). Empty when collision behavior is `suffix`.
|
|
59
58
|
*/
|
|
60
|
-
|
|
61
|
-
constructor(_base: EnablementModel, registry: IMcpRegistry, collisionBehavior: IObservable<McpCollisionBehavior>);
|
|
62
|
-
readEnabled(key: string, reader?: IReader): ContributionEnablementState;
|
|
63
|
-
setEnabled(key: string, state: ContributionEnablementState, tx?: ITransaction): void;
|
|
64
|
-
remove(key: string): void;
|
|
59
|
+
constructor(base: EnablementModel, registry: IMcpRegistry, collisionBehavior: IObservable<McpCollisionBehavior>);
|
|
65
60
|
}
|
|
@@ -11,7 +11,7 @@ import { mcpAutoStartConfig, McpAutoStartValue } from '@codingame/monaco-vscode-
|
|
|
11
11
|
import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
12
12
|
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
13
13
|
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
14
|
-
import { EnablementModel, isContributionEnabled,
|
|
14
|
+
import { EnablementModel, isContributionEnabled, CollisionEnablementModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
|
|
15
15
|
import { mcpServerCollisionBehaviorSection, McpCollisionBehavior } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
16
16
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
17
17
|
import { McpPrefixGenerator, McpServerMetadataCache, McpServer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpServer';
|
|
@@ -216,10 +216,9 @@ McpService = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IM
|
|
|
216
216
|
function defsEqual(server, def) {
|
|
217
217
|
return server.collection.id === def.collectionDefinition.id && server.definition.id === def.serverDefinition.id;
|
|
218
218
|
}
|
|
219
|
-
class McpCollisionEnablementModel {
|
|
220
|
-
constructor(
|
|
221
|
-
|
|
222
|
-
this._collisionGroups = derived(reader => {
|
|
219
|
+
class McpCollisionEnablementModel extends CollisionEnablementModel {
|
|
220
|
+
constructor(base, registry, collisionBehavior) {
|
|
221
|
+
const collisionGroups = derived(reader => {
|
|
223
222
|
if (collisionBehavior.read(reader) !== McpCollisionBehavior.Disable) {
|
|
224
223
|
return ( new Map());
|
|
225
224
|
}
|
|
@@ -247,49 +246,7 @@ class McpCollisionEnablementModel {
|
|
|
247
246
|
}
|
|
248
247
|
return groups;
|
|
249
248
|
});
|
|
250
|
-
|
|
251
|
-
readEnabled(key, reader) {
|
|
252
|
-
const baseState = this._base.readEnabled(key, reader);
|
|
253
|
-
if (!isContributionEnabled(baseState)) {
|
|
254
|
-
return baseState;
|
|
255
|
-
}
|
|
256
|
-
const group = this._collisionGroups.read(reader).get(key);
|
|
257
|
-
if (!group) {
|
|
258
|
-
return baseState;
|
|
259
|
-
}
|
|
260
|
-
for (const otherId of group) {
|
|
261
|
-
if (otherId === key) {
|
|
262
|
-
return baseState;
|
|
263
|
-
}
|
|
264
|
-
if (isContributionEnabled(this._base.readEnabled(otherId, reader))) {
|
|
265
|
-
return ContributionEnablementState.DisabledProfile;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
return baseState;
|
|
269
|
-
}
|
|
270
|
-
setEnabled(key, state, tx) {
|
|
271
|
-
const isEnabling = state === ContributionEnablementState.EnabledProfile || state === ContributionEnablementState.EnabledWorkspace;
|
|
272
|
-
const group = isEnabling ? this._collisionGroups.get().get(key) : undefined;
|
|
273
|
-
if (!group) {
|
|
274
|
-
this._base.setEnabled(key, state, tx);
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
const updateGroup = innerTx => {
|
|
278
|
-
this._base.setEnabled(key, state, innerTx);
|
|
279
|
-
for (const otherId of group) {
|
|
280
|
-
if (otherId !== key) {
|
|
281
|
-
this._base.setEnabled(otherId, ContributionEnablementState.DisabledWorkspace, innerTx);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
if (tx) {
|
|
286
|
-
updateGroup(tx);
|
|
287
|
-
} else {
|
|
288
|
-
transaction(innerTx => updateGroup(innerTx));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
remove(key) {
|
|
292
|
-
this._base.remove(key);
|
|
249
|
+
super(base, collisionGroups);
|
|
293
250
|
}
|
|
294
251
|
}
|
|
295
252
|
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts
CHANGED
|
@@ -27,6 +27,18 @@ export interface AllowedMcpServer {
|
|
|
27
27
|
* Undefined for stdio servers, which have no URL.
|
|
28
28
|
*/
|
|
29
29
|
url?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Set when the grant is for an MCP server hosted by an agent host (which runs the server in the
|
|
32
|
+
* CLI/agent-host process rather than registering it with the workbench `IMcpService`). Carries the
|
|
33
|
+
* host `authority` and its display `label` so management surfaces can present agent-host servers in
|
|
34
|
+
* their own section instead of filtering them out as "unknown". Agent hosts
|
|
35
|
+
* may be ephemeral and not always connected, but we still want to be able to
|
|
36
|
+
* display grants we know about and will respect.
|
|
37
|
+
*/
|
|
38
|
+
agentHost?: {
|
|
39
|
+
authority: string;
|
|
40
|
+
label: string;
|
|
41
|
+
};
|
|
30
42
|
}
|
|
31
43
|
export declare class AuthenticationMcpAccessService extends Disposable implements IAuthenticationMcpAccessService {
|
|
32
44
|
private readonly _storageService;
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js
CHANGED
|
@@ -96,6 +96,9 @@ let AuthenticationMcpAccessService = class AuthenticationMcpAccessService extend
|
|
|
96
96
|
if (mcpServer.url !== undefined) {
|
|
97
97
|
allowList[index].url = mcpServer.url;
|
|
98
98
|
}
|
|
99
|
+
if (mcpServer.agentHost !== undefined) {
|
|
100
|
+
allowList[index].agentHost = mcpServer.agentHost;
|
|
101
|
+
}
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
const userManagedServers = allowList.filter(server => !server.trusted);
|
|
@@ -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(
|
|
123
|
+
const badge = ( new NumberBadge(numberOfRequests, () => ( localize(17361, "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
|
-
|
|
197
|
+
17362,
|
|
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(
|
|
204
|
+
label: ( localize(17363, "&&Allow")),
|
|
205
205
|
run: () => SessionPromptChoice.Allow
|
|
206
206
|
}, {
|
|
207
|
-
label: ( localize(
|
|
207
|
+
label: ( localize(17364, "&&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(
|
|
249
|
+
label: ( localize(17365, "Sign in to another account"))
|
|
250
250
|
});
|
|
251
251
|
quickPick.items = items;
|
|
252
252
|
quickPick.title = ( localize(
|
|
253
|
-
|
|
253
|
+
17366,
|
|
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
|
-
|
|
259
|
+
17367,
|
|
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(
|
|
339
|
+
title: ( localize(17368, "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(
|
|
383
|
+
title: ( localize(17369, "Sign in with {0} to use {1} (1)", provider.label, mcpServerName))
|
|
384
384
|
}
|
|
385
385
|
}));
|
|
386
386
|
const signInCommand = CommandsRegistry.registerCommand({
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { IAgentPluginService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService.service";
|
|
3
|
-
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
4
|
-
import { IMcpDiscovery } from "./mcpDiscovery.js";
|
|
5
|
-
export declare class PluginMcpDiscovery extends Disposable implements IMcpDiscovery {
|
|
6
|
-
private readonly _agentPluginService;
|
|
7
|
-
private readonly _mcpRegistry;
|
|
8
|
-
readonly fromGallery = false;
|
|
9
|
-
private readonly _collections;
|
|
10
|
-
constructor(_agentPluginService: IAgentPluginService, _mcpRegistry: IMcpRegistry);
|
|
11
|
-
start(): void;
|
|
12
|
-
private createCollectionState;
|
|
13
|
-
private _toServerDefinition;
|
|
14
|
-
private _toLaunch;
|
|
15
|
-
}
|