@codingame/monaco-vscode-mcp-service-override 24.2.0 → 25.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/platform/mcp/common/mcpManagementService.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +62 -59
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +30 -30
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +18 -18
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +9 -9
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +32 -32
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +36 -36
- 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 +18 -18
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +8 -8
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
- 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.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +12 -12
- 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/mcpServer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +18 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
|
@@ -36,7 +36,7 @@ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/regist
|
|
|
36
36
|
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
37
37
|
import { DefaultViewsContext, SearchMcpServersContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
38
38
|
import { VIEW_CONTAINER } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/browser/extensions.contribution';
|
|
39
|
-
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
39
|
+
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
40
40
|
import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
|
|
41
41
|
import { defaultButtonStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
42
42
|
import { AbstractExtensionsListView } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/browser/extensionsViews';
|
|
@@ -106,7 +106,7 @@ let McpServersListView = class McpServersListView extends AbstractExtensionsList
|
|
|
106
106
|
return mcpServer?.label ?? '';
|
|
107
107
|
},
|
|
108
108
|
getWidgetAriaLabel() {
|
|
109
|
-
return localize(
|
|
109
|
+
return localize(8966, "MCP Servers");
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
overrideStyles: getLocationBasedViewColors(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles,
|
|
@@ -194,42 +194,42 @@ let McpServersListView = class McpServersListView extends AbstractExtensionsList
|
|
|
194
194
|
const iconElement = append(iconContainer, $('span'));
|
|
195
195
|
iconElement.className = ThemeIcon.asClassName(mcpServerIcon);
|
|
196
196
|
const title = append(welcomeContent, $('.mcp-welcome-title'));
|
|
197
|
-
title.textContent = ( localize(
|
|
198
|
-
const settingsCommandLink = ( createMarkdownCommandLink({ id: 'workbench.action.openSettings', arguments: [`@id:${mcpGalleryServiceEnablementConfig}`], title: mcpGalleryServiceEnablementConfig, tooltip: ( localize(
|
|
197
|
+
title.textContent = ( localize(8967, "MCP Servers"));
|
|
198
|
+
const settingsCommandLink = ( createMarkdownCommandLink({ id: 'workbench.action.openSettings', arguments: [`@id:${mcpGalleryServiceEnablementConfig}`], title: mcpGalleryServiceEnablementConfig, tooltip: ( localize(8968, "Open Settings")) }).toString());
|
|
199
199
|
const description = append(welcomeContent, $('.mcp-welcome-description'));
|
|
200
200
|
const markdownResult = this._register(this.markdownRendererService.render(( new MarkdownString(( localize(
|
|
201
|
-
|
|
201
|
+
8969,
|
|
202
202
|
"Browse and install [Model Context Protocol (MCP) servers](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) directly from VS Code to extend agent mode with extra tools for connecting to databases, invoking APIs and performing specialized tasks."
|
|
203
203
|
)), { isTrusted: { enabledCommands: ['workbench.action.openSettings'] } }))
|
|
204
204
|
.appendMarkdown('\n\n')
|
|
205
205
|
.appendMarkdown(( localize(
|
|
206
|
-
|
|
206
|
+
8970,
|
|
207
207
|
"This feature is currently in preview. You can disable it anytime using the setting {0}.",
|
|
208
208
|
settingsCommandLink
|
|
209
209
|
)))));
|
|
210
210
|
description.appendChild(markdownResult.element);
|
|
211
211
|
const buttonContainer = append(welcomeContent, $('.mcp-welcome-button-container'));
|
|
212
212
|
const button = this._register(( new Button(buttonContainer, {
|
|
213
|
-
title: ( localize(
|
|
213
|
+
title: ( localize(8971, "Enable MCP Servers Marketplace")),
|
|
214
214
|
...defaultButtonStyles
|
|
215
215
|
})));
|
|
216
|
-
button.label = ( localize(
|
|
216
|
+
button.label = ( localize(8971, "Enable MCP Servers Marketplace"));
|
|
217
217
|
this._register(button.onDidClick(async () => {
|
|
218
218
|
const { result } = await this.dialogService.prompt({
|
|
219
219
|
type: 'info',
|
|
220
|
-
message: ( localize(
|
|
220
|
+
message: ( localize(8972, "Enable MCP Servers Marketplace?")),
|
|
221
221
|
custom: {
|
|
222
222
|
markdownDetails: [{
|
|
223
223
|
markdown: ( new MarkdownString(( localize(
|
|
224
|
-
|
|
224
|
+
8970,
|
|
225
225
|
"This feature is currently in preview. You can disable it anytime using the setting {0}.",
|
|
226
226
|
settingsCommandLink
|
|
227
227
|
)), { isTrusted: true }))
|
|
228
228
|
}]
|
|
229
229
|
},
|
|
230
230
|
buttons: [
|
|
231
|
-
{ label: ( localize(
|
|
232
|
-
{ label: ( localize(
|
|
231
|
+
{ label: ( localize(8973, "Enable")), run: () => true },
|
|
232
|
+
{ label: ( localize(8974, "Cancel")), run: () => false }
|
|
233
233
|
]
|
|
234
234
|
});
|
|
235
235
|
if (result) {
|
|
@@ -249,7 +249,7 @@ let McpServersListView = class McpServersListView extends AbstractExtensionsList
|
|
|
249
249
|
}
|
|
250
250
|
else if (count === 0) {
|
|
251
251
|
this.bodyTemplate.messageSeverityIcon.className = '';
|
|
252
|
-
this.bodyTemplate.messageBox.textContent = ( localize(
|
|
252
|
+
this.bodyTemplate.messageBox.textContent = ( localize(8975, "No MCP Servers found."));
|
|
253
253
|
}
|
|
254
254
|
if (this.bodyTemplate.messageBox.textContent) {
|
|
255
255
|
alert(this.bodyTemplate.messageBox.textContent);
|
|
@@ -445,7 +445,7 @@ class McpServersViewsContribution extends Disposable {
|
|
|
445
445
|
( Registry.as(Extensions.ViewsRegistry)).registerViews([
|
|
446
446
|
{
|
|
447
447
|
id: InstalledMcpServersViewId,
|
|
448
|
-
name: ( localize2(
|
|
448
|
+
name: ( localize2(8976, "MCP Servers - Installed")),
|
|
449
449
|
ctorDescriptor: ( new SyncDescriptor(McpServersListView, [{}])),
|
|
450
450
|
when: ( ContextKeyExpr.and(DefaultViewsContext, HasInstalledMcpServersContext, ( ChatContextKeys.Setup.hidden.negate()))),
|
|
451
451
|
weight: 40,
|
|
@@ -454,7 +454,7 @@ class McpServersViewsContribution extends Disposable {
|
|
|
454
454
|
},
|
|
455
455
|
{
|
|
456
456
|
id: 'workbench.views.mcp.default.marketplace',
|
|
457
|
-
name: ( localize2(
|
|
457
|
+
name: ( localize2(8977, "MCP Servers")),
|
|
458
458
|
ctorDescriptor: ( new SyncDescriptor(DefaultBrowseMcpServersView, [{}])),
|
|
459
459
|
when: ( ContextKeyExpr.and(DefaultViewsContext, ( HasInstalledMcpServersContext.toNegated()), ( ChatContextKeys.Setup.hidden.negate()), ( McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available)), ( ContextKeyExpr.or(( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`)), ( ProductQualityContext.notEqualsTo('stable')), ( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`)))))),
|
|
460
460
|
weight: 40,
|
|
@@ -463,13 +463,13 @@ class McpServersViewsContribution extends Disposable {
|
|
|
463
463
|
},
|
|
464
464
|
{
|
|
465
465
|
id: 'workbench.views.mcp.marketplace',
|
|
466
|
-
name: ( localize2(
|
|
466
|
+
name: ( localize2(8977, "MCP Servers")),
|
|
467
467
|
ctorDescriptor: ( new SyncDescriptor(McpServersListView, [{}])),
|
|
468
468
|
when: ( ContextKeyExpr.and(SearchMcpServersContext, ( ChatContextKeys.Setup.hidden.negate()), ( McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available)), ( ContextKeyExpr.or(( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`)), ( ProductQualityContext.notEqualsTo('stable')), ( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`)))))),
|
|
469
469
|
},
|
|
470
470
|
{
|
|
471
471
|
id: 'workbench.views.mcp.default.welcomeView',
|
|
472
|
-
name: ( localize2(
|
|
472
|
+
name: ( localize2(8977, "MCP Servers")),
|
|
473
473
|
ctorDescriptor: ( new SyncDescriptor(DefaultBrowseMcpServersView, [{ showWelcome: true }])),
|
|
474
474
|
when: ( ContextKeyExpr.and(DefaultViewsContext, ( HasInstalledMcpServersContext.toNegated()), ( ChatContextKeys.Setup.hidden.negate()), ( McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available)), ( ( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`)).negate()), ( ProductQualityContext.isEqualTo('stable')), ( ( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`)).negate()))),
|
|
475
475
|
weight: 40,
|
|
@@ -478,7 +478,7 @@ class McpServersViewsContribution extends Disposable {
|
|
|
478
478
|
},
|
|
479
479
|
{
|
|
480
480
|
id: 'workbench.views.mcp.welcomeView',
|
|
481
|
-
name: ( localize2(
|
|
481
|
+
name: ( localize2(8977, "MCP Servers")),
|
|
482
482
|
ctorDescriptor: ( new SyncDescriptor(McpServersListView, [{ showWelcome: true }])),
|
|
483
483
|
when: ( ContextKeyExpr.and(SearchMcpServersContext, ( ChatContextKeys.Setup.hidden.negate()), ( McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available)), ( ( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`)).negate()), ( ProductQualityContext.isEqualTo('stable')), ( ( ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`)).negate()))),
|
|
484
484
|
}
|
|
@@ -366,7 +366,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
366
366
|
const existing = result.get(server.name);
|
|
367
367
|
if (existing) {
|
|
368
368
|
this.logService.warn(( localize(
|
|
369
|
-
|
|
369
|
+
8978,
|
|
370
370
|
"Overwriting mcp server '{0}' from {1} with {2}.",
|
|
371
371
|
server.name,
|
|
372
372
|
server.mcpResource.path,
|
|
@@ -379,7 +379,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
379
379
|
const existing = result.get(server.name);
|
|
380
380
|
if (existing) {
|
|
381
381
|
this.logService.warn(( localize(
|
|
382
|
-
|
|
382
|
+
8978,
|
|
383
383
|
"Overwriting mcp server '{0}' from {1} with {2}.",
|
|
384
384
|
server.name,
|
|
385
385
|
server.mcpResource.path,
|
|
@@ -392,7 +392,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
392
392
|
}
|
|
393
393
|
canInstall(mcpServer) {
|
|
394
394
|
if (!(mcpServer instanceof McpWorkbenchServer)) {
|
|
395
|
-
return ( new MarkdownString()).appendText(( localize(
|
|
395
|
+
return ( new MarkdownString()).appendText(( localize(8979, "The provided object is not an mcp server.")));
|
|
396
396
|
}
|
|
397
397
|
if (mcpServer.gallery) {
|
|
398
398
|
const result = this.mcpManagementService.canInstall(mcpServer.gallery);
|
|
@@ -409,7 +409,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
409
409
|
return result;
|
|
410
410
|
}
|
|
411
411
|
return ( new MarkdownString()).appendText(( localize(
|
|
412
|
-
|
|
412
|
+
8980,
|
|
413
413
|
"Cannot install the '{0}' MCP Server because it is not available in this setup.",
|
|
414
414
|
mcpServer.label
|
|
415
415
|
)));
|
|
@@ -512,7 +512,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
512
512
|
id: USER_CONFIG_ID,
|
|
513
513
|
key: 'userLocalValue',
|
|
514
514
|
target: ConfigurationTarget.USER_LOCAL,
|
|
515
|
-
label: ( localize(
|
|
515
|
+
label: ( localize(8981, 'Global in {0}', this.productService.nameShort)),
|
|
516
516
|
scope: StorageScope.PROFILE,
|
|
517
517
|
order: McpCollectionSortOrder.User,
|
|
518
518
|
uri: mcpResource,
|
|
@@ -671,7 +671,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
671
671
|
message: {
|
|
672
672
|
severity: Severity.Warning,
|
|
673
673
|
text: ( new MarkdownString(( localize(
|
|
674
|
-
|
|
674
|
+
8982,
|
|
675
675
|
"This MCP Server is disabled because MCP servers are configured to be disabled in the Editor. Please check your [settings]({0}).",
|
|
676
676
|
settingsCommandLink
|
|
677
677
|
))))
|
|
@@ -685,7 +685,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
685
685
|
message: {
|
|
686
686
|
severity: Severity.Warning,
|
|
687
687
|
text: ( new MarkdownString(( localize(
|
|
688
|
-
|
|
688
|
+
8983,
|
|
689
689
|
"This MCP Server is disabled because it is configured to be disabled in the Editor. Please check your [settings]({0}).",
|
|
690
690
|
settingsCommandLink
|
|
691
691
|
))))
|
|
@@ -699,7 +699,7 @@ let McpWorkbenchService = class McpWorkbenchService extends Disposable {
|
|
|
699
699
|
message: {
|
|
700
700
|
severity: Severity.Warning,
|
|
701
701
|
text: ( new MarkdownString(( localize(
|
|
702
|
-
|
|
702
|
+
8983,
|
|
703
703
|
"This MCP Server is disabled because it is configured to be disabled in the Editor. Please check your [settings]({0}).",
|
|
704
704
|
settingsCommandLink
|
|
705
705
|
))))
|
|
@@ -135,20 +135,20 @@ let ExtensionMcpDiscovery = ExtensionMcpDiscovery_1 = class ExtensionMcpDiscover
|
|
|
135
135
|
}
|
|
136
136
|
static _validate(user) {
|
|
137
137
|
if (!Array.isArray(user.value)) {
|
|
138
|
-
user.collector.error(( localize(
|
|
138
|
+
user.collector.error(( localize(8984, "Expected an array of MCP collections")));
|
|
139
139
|
return false;
|
|
140
140
|
}
|
|
141
141
|
for (const contribution of user.value) {
|
|
142
142
|
if (typeof contribution.id !== 'string' || isFalsyOrWhitespace(contribution.id)) {
|
|
143
|
-
user.collector.error(( localize(
|
|
143
|
+
user.collector.error(( localize(8985, "Expected 'id' to be a non-empty string.")));
|
|
144
144
|
return false;
|
|
145
145
|
}
|
|
146
146
|
if (typeof contribution.label !== 'string' || isFalsyOrWhitespace(contribution.label)) {
|
|
147
|
-
user.collector.error(( localize(
|
|
147
|
+
user.collector.error(( localize(8986, "Expected 'label' to be a non-empty string.")));
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
150
150
|
if (contribution.when !== undefined && (typeof contribution.when !== 'string' || isFalsyOrWhitespace(contribution.when))) {
|
|
151
|
-
user.collector.error(( localize(
|
|
151
|
+
user.collector.error(( localize(8987, "Expected 'when' to be a non-empty string.")));
|
|
152
152
|
return false;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -83,7 +83,7 @@ let NativeFilesystemMcpDiscovery = class NativeFilesystemMcpDiscovery extends Fi
|
|
|
83
83
|
this.suffix = '';
|
|
84
84
|
if (remoteAuthority) {
|
|
85
85
|
this.suffix = ' ' + ( localize(
|
|
86
|
-
|
|
86
|
+
8988,
|
|
87
87
|
' on {0}',
|
|
88
88
|
labelService.getHostLabel(Schemas.vscodeRemote, remoteAuthority)
|
|
89
89
|
));
|
|
@@ -15,19 +15,19 @@ var McpContextKeys;
|
|
|
15
15
|
McpContextKeys.serverCount = ( new RawContextKey(
|
|
16
16
|
'mcp.serverCount',
|
|
17
17
|
undefined,
|
|
18
|
-
{ type: 'number', description: ( localize(
|
|
18
|
+
{ type: 'number', description: ( localize(9020, "Context key that has the number of registered MCP servers")) }
|
|
19
19
|
));
|
|
20
20
|
McpContextKeys.hasUnknownTools = ( new RawContextKey(
|
|
21
21
|
'mcp.hasUnknownTools',
|
|
22
22
|
undefined,
|
|
23
|
-
{ type: 'boolean', description: ( localize(
|
|
23
|
+
{ type: 'boolean', description: ( localize(9021, "Indicates whether there are MCP servers with unknown tools.")) }
|
|
24
24
|
));
|
|
25
25
|
McpContextKeys.hasServersWithErrors = ( new RawContextKey(
|
|
26
26
|
'mcp.hasServersWithErrors',
|
|
27
27
|
undefined,
|
|
28
|
-
{ type: 'boolean', description: ( localize(
|
|
28
|
+
{ type: 'boolean', description: ( localize(9022, "Indicates whether there are any MCP servers with errors.")) }
|
|
29
29
|
));
|
|
30
|
-
McpContextKeys.toolsCount = ( new RawContextKey('mcp.toolsCount', undefined, { type: 'number', description: ( localize(
|
|
30
|
+
McpContextKeys.toolsCount = ( new RawContextKey('mcp.toolsCount', undefined, { type: 'number', description: ( localize(9023, "Context key that has the number of registered MCP tools")) }));
|
|
31
31
|
})(McpContextKeys || (McpContextKeys = {}));
|
|
32
32
|
let McpContextKeysController = class McpContextKeysController extends Disposable {
|
|
33
33
|
static { this.ID = 'workbench.contrib.mcp.contextKey'; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
2
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
3
3
|
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
4
|
-
import { ILanguageModelToolsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service";
|
|
4
|
+
import { ILanguageModelToolsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service";
|
|
5
5
|
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
6
6
|
import { IMcpService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service";
|
|
7
7
|
export declare class McpLanguageModelToolContribution extends Disposable implements IWorkbenchContribution {
|
|
@@ -15,9 +15,9 @@ import { IImageResizeService } from '@codingame/monaco-vscode-api/vscode/vs/plat
|
|
|
15
15
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
16
16
|
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
17
17
|
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
18
|
-
import { getAttachableImageExtension, ChatResponseResource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel';
|
|
18
|
+
import { getAttachableImageExtension, ChatResponseResource } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel';
|
|
19
19
|
import { LanguageModelPartAudience } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
20
|
-
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service';
|
|
20
|
+
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
|
|
21
21
|
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
22
22
|
import { McpToolResourceLinkMimeType, McpResourceURI } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
23
23
|
import { IMcpService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
@@ -51,7 +51,7 @@ let McpLanguageModelToolContribution = class McpLanguageModelToolContribution ex
|
|
|
51
51
|
const referenceName = server.definition.label.toLowerCase().replace(/\s+/g, '-');
|
|
52
52
|
const toolSet = store.add(this._toolsService.createToolSet(source, server.definition.id, referenceName, {
|
|
53
53
|
icon: Codicon.mcp,
|
|
54
|
-
description: ( localize(
|
|
54
|
+
description: ( localize(9024, "{0}: All Tools", server.definition.label))
|
|
55
55
|
}));
|
|
56
56
|
return { toolSet, source };
|
|
57
57
|
}));
|
|
@@ -144,14 +144,14 @@ let McpToolImplementation = class McpToolImplementation {
|
|
|
144
144
|
const tool = this._tool;
|
|
145
145
|
const server = this._server;
|
|
146
146
|
const mcpToolWarning = ( localize(
|
|
147
|
-
|
|
147
|
+
9025,
|
|
148
148
|
"Note that MCP servers or malicious conversation content may attempt to misuse '{0}' through tools.",
|
|
149
149
|
this._productService.nameShort
|
|
150
150
|
));
|
|
151
151
|
const title = tool.definition.annotations?.title || tool.definition.title || ('`' + tool.definition.name + '`');
|
|
152
152
|
const confirm = {};
|
|
153
153
|
if (!tool.definition.annotations?.readOnlyHint) {
|
|
154
|
-
confirm.title = ( new MarkdownString(( localize(
|
|
154
|
+
confirm.title = ( new MarkdownString(( localize(9026, "Run {0}", title))));
|
|
155
155
|
confirm.message = ( new MarkdownString(tool.definition.description, { supportThemeIcons: true }));
|
|
156
156
|
confirm.disclaimer = mcpToolWarning;
|
|
157
157
|
confirm.allowAutoConfirm = true;
|
|
@@ -161,9 +161,9 @@ let McpToolImplementation = class McpToolImplementation {
|
|
|
161
161
|
}
|
|
162
162
|
return {
|
|
163
163
|
confirmationMessages: confirm,
|
|
164
|
-
invocationMessage: ( new MarkdownString(( localize(
|
|
165
|
-
pastTenseMessage: ( new MarkdownString(( localize(
|
|
166
|
-
originMessage: ( localize(
|
|
164
|
+
invocationMessage: ( new MarkdownString(( localize(9027, "Running {0}", title)))),
|
|
165
|
+
pastTenseMessage: ( new MarkdownString(( localize(9028, "Ran {0} ", title)))),
|
|
166
|
+
originMessage: ( localize(9029, "{0} (MCP Server)", server.definition.label)),
|
|
167
167
|
toolSpecificData: {
|
|
168
168
|
kind: 'input',
|
|
169
169
|
rawInput: context.parameters
|
|
@@ -251,7 +251,7 @@ let McpRegistry = class McpRegistry extends Disposable {
|
|
|
251
251
|
const originURI = r.definition.presentation?.origin?.uri || r.collection.presentation?.origin;
|
|
252
252
|
let labelWithOrigin = originURI ? `[\`${r.definition.label}\`](${originURI})` : '`' + r.definition.label + '`';
|
|
253
253
|
if (r.collection.source instanceof ExtensionIdentifier) {
|
|
254
|
-
labelWithOrigin += ` (${( localize(
|
|
254
|
+
labelWithOrigin += ` (${( localize(9030, 'from {0}', r.collection.source.value))})`;
|
|
255
255
|
}
|
|
256
256
|
return labelWithOrigin;
|
|
257
257
|
}
|
|
@@ -259,12 +259,12 @@ let McpRegistry = class McpRegistry extends Disposable {
|
|
|
259
259
|
const def = definitions[0];
|
|
260
260
|
const originURI = def.definition.presentation?.origin?.uri;
|
|
261
261
|
const { result } = await this._dialogService.prompt({
|
|
262
|
-
message: ( localize(
|
|
262
|
+
message: ( localize(9031, 'Trust and run MCP server {0}?', def.definition.label)),
|
|
263
263
|
custom: {
|
|
264
264
|
icon: Codicon.shield,
|
|
265
265
|
markdownDetails: [{
|
|
266
266
|
markdown: ( new MarkdownString(( localize(
|
|
267
|
-
|
|
267
|
+
9032,
|
|
268
268
|
'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?',
|
|
269
269
|
labelFor(def)
|
|
270
270
|
)))),
|
|
@@ -275,20 +275,20 @@ let McpRegistry = class McpRegistry extends Disposable {
|
|
|
275
275
|
}]
|
|
276
276
|
},
|
|
277
277
|
buttons: [
|
|
278
|
-
{ label: ( localize(
|
|
279
|
-
{ label: ( localize(
|
|
278
|
+
{ label: ( localize(9033, 'Trust')), run: () => true },
|
|
279
|
+
{ label: ( localize(9034, 'Do not trust')), run: () => false }
|
|
280
280
|
],
|
|
281
281
|
});
|
|
282
282
|
return result === undefined ? undefined : (result ? [def.definition.id] : []);
|
|
283
283
|
}
|
|
284
284
|
const list = ( definitions.map(d => `- ${labelFor(d)}`)).join('\n');
|
|
285
285
|
const { result } = await this._dialogService.prompt({
|
|
286
|
-
message: ( localize(
|
|
286
|
+
message: ( localize(9035, 'Trust and run {0} MCP servers?', definitions.length)),
|
|
287
287
|
custom: {
|
|
288
288
|
icon: Codicon.shield,
|
|
289
289
|
markdownDetails: [{
|
|
290
290
|
markdown: ( new MarkdownString(( localize(
|
|
291
|
-
|
|
291
|
+
9036,
|
|
292
292
|
'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?',
|
|
293
293
|
list
|
|
294
294
|
)))),
|
|
@@ -299,9 +299,9 @@ let McpRegistry = class McpRegistry extends Disposable {
|
|
|
299
299
|
}]
|
|
300
300
|
},
|
|
301
301
|
buttons: [
|
|
302
|
-
{ label: ( localize(
|
|
303
|
-
{ label: ( localize(
|
|
304
|
-
{ label: ( localize(
|
|
302
|
+
{ label: ( localize(9033, 'Trust')), run: () => 'all' },
|
|
303
|
+
{ label: ( localize(9037, 'Pick Trusted')), run: () => 'pick' },
|
|
304
|
+
{ label: ( localize(9034, 'Do not trust')), run: () => 'none' },
|
|
305
305
|
],
|
|
306
306
|
});
|
|
307
307
|
if (result === undefined) {
|
|
@@ -440,7 +440,7 @@ let McpRegistry = class McpRegistry extends Disposable {
|
|
|
440
440
|
}
|
|
441
441
|
this._notificationService.notify({
|
|
442
442
|
severity: Severity.Error,
|
|
443
|
-
message: ( localize(
|
|
443
|
+
message: ( localize(9038, 'Error starting {0}: {1}', definition.label, String(e))),
|
|
444
444
|
actions: {
|
|
445
445
|
primary: collection.presentation?.origin && [
|
|
446
446
|
{
|
|
@@ -448,7 +448,7 @@ let McpRegistry = class McpRegistry extends Disposable {
|
|
|
448
448
|
class: undefined,
|
|
449
449
|
enabled: true,
|
|
450
450
|
tooltip: '',
|
|
451
|
-
label: ( localize(
|
|
451
|
+
label: ( localize(9039, 'Open Configuration')),
|
|
452
452
|
run: () => this._editorService.openEditor({
|
|
453
453
|
resource: collection.presentation.origin,
|
|
454
454
|
options: { selection: definition.presentation?.origin?.range }
|
|
@@ -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(9040, '{0} total requests in the last 7 days.', total)));
|
|
45
45
|
parts.push(this._formatRecentRequests(record));
|
|
46
46
|
return parts.join('\n');
|
|
47
47
|
}
|
|
@@ -107,11 +107,11 @@ let McpSamplingService = class McpSamplingService extends Disposable {
|
|
|
107
107
|
const model = await this._getMatchingModelInner(opts.server, opts.isDuringToolCall, opts.params.modelPreferences);
|
|
108
108
|
if (model === ModelMatch.UnsureAllowedDuringChat) {
|
|
109
109
|
const retry = await this._showContextual(opts.isDuringToolCall, ( localize(
|
|
110
|
-
|
|
110
|
+
9041,
|
|
111
111
|
'Allow MCP tools from "{0}" to make LLM requests?',
|
|
112
112
|
opts.server.definition.label
|
|
113
113
|
)), ( localize(
|
|
114
|
-
|
|
114
|
+
9042,
|
|
115
115
|
'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?',
|
|
116
116
|
opts.server.definition.label
|
|
117
117
|
)), this.allowButtons(opts.server, 'allowedDuringChat'));
|
|
@@ -122,11 +122,11 @@ let McpSamplingService = class McpSamplingService extends Disposable {
|
|
|
122
122
|
}
|
|
123
123
|
else if (model === ModelMatch.UnsureAllowedOutsideChat) {
|
|
124
124
|
const retry = await this._showContextual(opts.isDuringToolCall, ( localize(
|
|
125
|
-
|
|
125
|
+
9043,
|
|
126
126
|
'Allow MCP server "{0}" to make LLM requests?',
|
|
127
127
|
opts.server.definition.label
|
|
128
128
|
)), ( localize(
|
|
129
|
-
|
|
129
|
+
9044,
|
|
130
130
|
'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?',
|
|
131
131
|
opts.server.definition.label
|
|
132
132
|
)), this.allowButtons(opts.server, 'allowedOutsideChat'));
|
|
@@ -142,12 +142,12 @@ let McpSamplingService = class McpSamplingService extends Disposable {
|
|
|
142
142
|
const newlyPickedModels = opts.isDuringToolCall
|
|
143
143
|
? await this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server)
|
|
144
144
|
: await this._notify(( localize(
|
|
145
|
-
|
|
145
|
+
9045,
|
|
146
146
|
'MCP server "{0}" triggered a language model request, but it has no allowlisted models.',
|
|
147
147
|
opts.server.definition.label
|
|
148
148
|
)), {
|
|
149
|
-
[( localize(
|
|
150
|
-
[( localize(
|
|
149
|
+
[( localize(9046, 'Configure'))]: () => this._commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, opts.server),
|
|
150
|
+
[( localize(9047, 'Cancel'))]: () => Promise.resolve(undefined),
|
|
151
151
|
});
|
|
152
152
|
if (newlyPickedModels) {
|
|
153
153
|
return this._getMatchingModel(opts);
|
|
@@ -158,19 +158,19 @@ let McpSamplingService = class McpSamplingService extends Disposable {
|
|
|
158
158
|
}
|
|
159
159
|
allowButtons(server, key) {
|
|
160
160
|
return {
|
|
161
|
-
[( localize(
|
|
161
|
+
[( localize(9048, 'Allow in this Session'))]: async () => {
|
|
162
162
|
this._sessionSets[key].set(server.definition.id, true);
|
|
163
163
|
return true;
|
|
164
164
|
},
|
|
165
|
-
[( localize(
|
|
165
|
+
[( localize(9049, 'Always'))]: async () => {
|
|
166
166
|
await this.updateConfig(server, c => c[key] = true);
|
|
167
167
|
return true;
|
|
168
168
|
},
|
|
169
|
-
[( localize(
|
|
169
|
+
[( localize(9050, 'Not Now'))]: async () => {
|
|
170
170
|
this._sessionSets[key].set(server.definition.id, false);
|
|
171
171
|
return false;
|
|
172
172
|
},
|
|
173
|
-
[( localize(
|
|
173
|
+
[( localize(9051, 'Never'))]: async () => {
|
|
174
174
|
await this.updateConfig(server, c => c[key] = false);
|
|
175
175
|
return false;
|
|
176
176
|
},
|
|
@@ -14,7 +14,7 @@ import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs
|
|
|
14
14
|
import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
15
15
|
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
16
16
|
import { IOutputService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output.service";
|
|
17
|
-
import { ToolProgress } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService";
|
|
17
|
+
import { ToolProgress } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService";
|
|
18
18
|
import { StoredMcpIcons } from "./mcpIcons.js";
|
|
19
19
|
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
20
20
|
import { McpServerRequestHandler } from "./mcpServerRequestHandler.js";
|
|
@@ -4,8 +4,10 @@ import { raceCancellationError, Sequencer, AsyncIterableProducer } from '@coding
|
|
|
4
4
|
import { CancellationToken, CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
5
|
import { Iterable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/iterator';
|
|
6
6
|
import { parseTree, findNodeAtOffset, getNodePath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
|
|
7
|
+
import { normalizeDriveLetter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/labels';
|
|
7
8
|
import { Disposable, toDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
9
|
import { LRUCache } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
10
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
9
11
|
import { mapValues } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
10
12
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
11
13
|
import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
@@ -250,10 +252,13 @@ let McpServer = McpServer_1 = class McpServer extends Disposable {
|
|
|
250
252
|
}
|
|
251
253
|
cnx.roots = ( workspaces.read(reader)
|
|
252
254
|
.filter(w => w.uri.authority === (initialCollection.remoteAuthority || ''))
|
|
253
|
-
.map(w =>
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
.map(w => {
|
|
256
|
+
let uri = ( URI.from(uriTransformer?.transformIncoming(w.uri) ?? w.uri));
|
|
257
|
+
if (uri.scheme === Schemas.file) {
|
|
258
|
+
uri = URI.file(normalizeDriveLetter(uri.fsPath, true));
|
|
259
|
+
}
|
|
260
|
+
return { name: w.name, uri: ( uri.toString()) };
|
|
261
|
+
}));
|
|
257
262
|
}));
|
|
258
263
|
this._register(autorun(reader => {
|
|
259
264
|
const cnx = this._connection.read(reader);
|
|
@@ -434,29 +439,29 @@ let McpServer = McpServer_1 = class McpServer extends Disposable {
|
|
|
434
439
|
break;
|
|
435
440
|
}
|
|
436
441
|
const options = [{
|
|
437
|
-
label: ( localize(
|
|
442
|
+
label: ( localize(9052, "Show Output")),
|
|
438
443
|
run: () => this.showOutput(),
|
|
439
444
|
}];
|
|
440
445
|
if (cnx.definition.devMode?.debug?.type === 'debugpy' && debug) {
|
|
441
446
|
this._notificationService.prompt(Severity.Error, ( localize(
|
|
442
|
-
|
|
447
|
+
9053,
|
|
443
448
|
'The command "{0}" was not found. You can specify the path to debugpy in the `dev.debug.debugpyPath` option.',
|
|
444
449
|
cnx.launchDefinition.command,
|
|
445
450
|
cnx.definition.label
|
|
446
451
|
)), [...options, {
|
|
447
|
-
label: ( localize(
|
|
452
|
+
label: ( localize(9054, 'View Docs')),
|
|
448
453
|
run: () => this._openerService.open(( URI.parse('https://aka.ms/vscode-mcp-install/debugpy'))),
|
|
449
454
|
}]);
|
|
450
455
|
return;
|
|
451
456
|
}
|
|
452
457
|
if (docsLink) {
|
|
453
458
|
options.push({
|
|
454
|
-
label: ( localize(
|
|
459
|
+
label: ( localize(9055, 'Install {0}', cnx.launchDefinition.command)),
|
|
455
460
|
run: () => this._openerService.open(( URI.parse(docsLink))),
|
|
456
461
|
});
|
|
457
462
|
}
|
|
458
463
|
this._notificationService.prompt(Severity.Error, ( localize(
|
|
459
|
-
|
|
464
|
+
9056,
|
|
460
465
|
'The command "{0}" needed to run {1} was not found.',
|
|
461
466
|
cnx.launchDefinition.command,
|
|
462
467
|
cnx.definition.label
|
|
@@ -464,7 +469,7 @@ let McpServer = McpServer_1 = class McpServer extends Disposable {
|
|
|
464
469
|
}
|
|
465
470
|
else {
|
|
466
471
|
this._notificationService.warn(( localize(
|
|
467
|
-
|
|
472
|
+
9057,
|
|
468
473
|
'The MCP server {0} could not be started: {1}',
|
|
469
474
|
cnx.definition.label,
|
|
470
475
|
error.message
|
|
@@ -530,7 +535,7 @@ let McpServer = McpServer_1 = class McpServer extends Disposable {
|
|
|
530
535
|
const validated = [];
|
|
531
536
|
for (const [i, result] of validations.entries()) {
|
|
532
537
|
if ('error' in result) {
|
|
533
|
-
error += ( localize(
|
|
538
|
+
error += ( localize(9058, 'Tool `{0}` has invalid JSON parameters:', tools[i].name)) + '\n';
|
|
534
539
|
for (const message of result.error) {
|
|
535
540
|
error += `\t- ${message}\n`;
|
|
536
541
|
}
|
|
@@ -817,7 +822,7 @@ function warnInvalidTools(instaService, serverName, errorText) {
|
|
|
817
822
|
notificationService.notify({
|
|
818
823
|
severity: Severity.Warning,
|
|
819
824
|
message: ( localize(
|
|
820
|
-
|
|
825
|
+
9059,
|
|
821
826
|
'MCP server `{0}` has tools with invalid parameters which will be omitted.',
|
|
822
827
|
serverName
|
|
823
828
|
)),
|
|
@@ -827,7 +832,7 @@ function warnInvalidTools(instaService, serverName, errorText) {
|
|
|
827
832
|
enabled: true,
|
|
828
833
|
id: 'mcpBadSchema.show',
|
|
829
834
|
tooltip: '',
|
|
830
|
-
label: ( localize(
|
|
835
|
+
label: ( localize(9060, 'Show')),
|
|
831
836
|
run: () => {
|
|
832
837
|
editorService.openEditor({
|
|
833
838
|
resource: undefined,
|
|
@@ -36,7 +36,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
|
|
|
36
36
|
}
|
|
37
37
|
this._launch.value = undefined;
|
|
38
38
|
this._state.set({ state: McpConnectionState.Kind.Starting }, undefined);
|
|
39
|
-
this._logger.info(( localize(
|
|
39
|
+
this._logger.info(( localize(9061, 'Starting server {0}', this.definition.label)));
|
|
40
40
|
try {
|
|
41
41
|
const launch = this._delegate.start(this._collection, this.definition, this.launchDefinition, { errorOnUserInteraction: this._errorOnUserInteraction });
|
|
42
42
|
this._launch.value = this.adoptLaunch(launch, methods);
|
|
@@ -63,7 +63,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
|
|
|
63
63
|
store.add(autorun(reader => {
|
|
64
64
|
const state = launch.state.read(reader);
|
|
65
65
|
this._state.set(state, undefined);
|
|
66
|
-
this._logger.info(( localize(
|
|
66
|
+
this._logger.info(( localize(9062, 'Connection state: {0}', (McpConnectionState.toString(state)))));
|
|
67
67
|
if (state.state === McpConnectionState.Kind.Running && !didStart) {
|
|
68
68
|
didStart = true;
|
|
69
69
|
McpServerRequestHandler.create(this._instantiationService, {
|
|
@@ -98,7 +98,7 @@ let McpServerConnection = class McpServerConnection extends Disposable {
|
|
|
98
98
|
return { dispose: () => store.dispose(), object: launch };
|
|
99
99
|
}
|
|
100
100
|
async stop() {
|
|
101
|
-
this._logger.info(( localize(
|
|
101
|
+
this._logger.info(( localize(9063, 'Stopping server {0}', this.definition.label)));
|
|
102
102
|
this._launch.value?.object.stop();
|
|
103
103
|
await this._waitForState(McpConnectionState.Kind.Stopped, McpConnectionState.Kind.Error);
|
|
104
104
|
}
|