@codingame/monaco-vscode-mcp-service-override 36.2.7 → 37.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/base/common/jsonRpcProtocol.d.ts +2 -2
- package/vscode/src/vs/platform/mcp/common/allowedMcpServers.d.ts +52 -0
- package/vscode/src/vs/platform/mcp/common/allowedMcpServers.js +180 -0
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.d.ts +4 -0
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +68 -12
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.d.ts +5 -1
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +200 -92
- package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +3 -2
- package/vscode/src/vs/platform/mcp/common/nativeMcpDiscoveryHelper.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +357 -121
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +25 -25
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +409 -145
- 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 +18 -18
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +279 -72
- package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServersView.css +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +6 -5
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +9 -16
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +7 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts +14 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +32 -9
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceDotMcpDiscovery.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceDotMcpDiscovery.js +20 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +9 -5
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpEditorAffordanceState.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpEditorAffordanceState.js +36 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +51 -19
- 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.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +42 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +6 -3
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
|
@@ -23,17 +23,27 @@ import { localize2, localize } from '@codingame/monaco-vscode-api/vscode/vs/nls'
|
|
|
23
23
|
import { IActionViewItemService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/actionViewItemService.service';
|
|
24
24
|
import { MenuEntryActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
25
25
|
import { Action2, MenuId, MenuItemAction, MenuRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
26
|
+
import { getCustomizationScopeEnablement } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/customizationEnablement';
|
|
27
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-root/state';
|
|
28
|
+
import { McpServerStatus, CustomizationEnablementKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-session/state';
|
|
29
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-chat/state';
|
|
30
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-terminal/state';
|
|
31
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-changeset/state';
|
|
32
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-resource-watch/state';
|
|
33
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-automation/state';
|
|
34
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-automation-run/state';
|
|
26
35
|
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
27
36
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
28
37
|
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
29
38
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
30
39
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
40
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
31
41
|
import { mcpAutoStartConfig, McpAutoStartValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement';
|
|
42
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
32
43
|
import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
33
44
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
34
45
|
import { ISecretStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service';
|
|
35
46
|
import { defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
36
|
-
import { spinningLoading } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/iconRegistry';
|
|
37
47
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
38
48
|
import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/actions/workspaceCommands';
|
|
39
49
|
import { ResourceContextKey, ActiveEditorContext, RemoteNameContext, WorkspaceFolderCountContext, WorkbenchStateContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
@@ -41,20 +51,14 @@ import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
41
51
|
import { IAuthenticationQueryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authenticationQuery.service';
|
|
42
52
|
import { WORKSPACE_STANDALONE_CONFIGURATIONS, MCP_CONFIGURATION_KEY } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configuration/common/configuration';
|
|
43
53
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
44
|
-
import { IOutputService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output.service';
|
|
45
54
|
import { IRemoteUserDataProfilesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.service';
|
|
46
55
|
import { IUserDataProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
47
56
|
import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
48
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-root/state';
|
|
49
|
-
import { McpServerStatus } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-session/state';
|
|
50
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-chat/state';
|
|
51
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-terminal/state';
|
|
52
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-changeset/state';
|
|
53
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-resource-watch/state';
|
|
54
|
-
import { CHAT_CONFIG_MENU_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
55
|
-
import { ChatViewId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
56
57
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
57
58
|
import { IAgentHostCustomizationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.service';
|
|
59
|
+
import { setAgentHostPluginEnablement } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentPluginActions';
|
|
60
|
+
import { IAICustomizationWorkspaceService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/aiCustomizationWorkspaceService.service';
|
|
61
|
+
import { IAgentPluginService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService.service';
|
|
58
62
|
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
|
|
59
63
|
import { ChatModeKind, ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
60
64
|
import { isContributionDisabled, ContributionEnablementState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/enablement';
|
|
@@ -87,7 +91,7 @@ class ListMcpServerCommand extends Action2 {
|
|
|
87
91
|
constructor() {
|
|
88
92
|
super({
|
|
89
93
|
id: McpCommandIds.ListServer,
|
|
90
|
-
title: ( localize2(
|
|
94
|
+
title: ( localize2(13511, "List Servers")),
|
|
91
95
|
icon: Codicon.server,
|
|
92
96
|
category,
|
|
93
97
|
f1: true,
|
|
@@ -106,7 +110,9 @@ class ListMcpServerCommand extends Action2 {
|
|
|
106
110
|
agentHostCustomizations: accessor.get(IAgentHostCustomizationService),
|
|
107
111
|
mcpService: accessor.get(IMcpService),
|
|
108
112
|
commandService: accessor.get(ICommandService),
|
|
109
|
-
quickInput: accessor.get(IQuickInputService)
|
|
113
|
+
quickInput: accessor.get(IQuickInputService),
|
|
114
|
+
notificationService: accessor.get(INotificationService),
|
|
115
|
+
logService: accessor.get(ILogService)
|
|
110
116
|
};
|
|
111
117
|
return this._runWithMode(services, undefined);
|
|
112
118
|
}
|
|
@@ -138,7 +144,7 @@ class ListMcpServerCommand extends Action2 {
|
|
|
138
144
|
const pick = quickInput.createQuickPick({
|
|
139
145
|
useSeparators: true
|
|
140
146
|
});
|
|
141
|
-
pick.placeholder = ( localize(
|
|
147
|
+
pick.placeholder = ( localize(13512, "Select an MCP Server"));
|
|
142
148
|
mcpService.activateCollections();
|
|
143
149
|
store.add(pick);
|
|
144
150
|
store.add(autorun(reader => {
|
|
@@ -147,10 +153,11 @@ class ListMcpServerCommand extends Action2 {
|
|
|
147
153
|
s => s.collection.id
|
|
148
154
|
);
|
|
149
155
|
const firstRun = pick.items.length === 0;
|
|
156
|
+
const previousActiveId = pick.activeItems[0]?.id;
|
|
150
157
|
pick.items = [{
|
|
151
158
|
id: "$add",
|
|
152
|
-
label: ( localize(
|
|
153
|
-
description: ( localize(
|
|
159
|
+
label: ( localize(13513, "Add Server")),
|
|
160
|
+
description: ( localize(13514, "Add a new server configuration")),
|
|
154
161
|
alwaysShow: true,
|
|
155
162
|
iconClass: ThemeIcon.asClassName(Codicon.add)
|
|
156
163
|
}, ...( Object.values(servers)).filter(s => s.length).flatMap(servers => [{
|
|
@@ -162,9 +169,16 @@ class ListMcpServerCommand extends Action2 {
|
|
|
162
169
|
return {
|
|
163
170
|
id: server.definition.id,
|
|
164
171
|
label: server.definition.label,
|
|
165
|
-
description: disabled ? ( localize(
|
|
172
|
+
description: disabled ? ( localize(13515, "Disabled")) : ( McpConnectionState.toString(server.connectionState.read(reader)))
|
|
166
173
|
};
|
|
167
174
|
}))])];
|
|
175
|
+
if (previousActiveId) {
|
|
176
|
+
const previousItem = pick.items.find(item => !("type" in item) && item.id === previousActiveId);
|
|
177
|
+
if (previousItem) {
|
|
178
|
+
pick.activeItems = [previousItem];
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
168
182
|
if (firstRun && pick.items.length > 3) {
|
|
169
183
|
pick.activeItems = pick.items.slice(2, 3);
|
|
170
184
|
}
|
|
@@ -197,34 +211,56 @@ class ListMcpServerCommand extends Action2 {
|
|
|
197
211
|
const pick = quickInput.createQuickPick({
|
|
198
212
|
useSeparators: true
|
|
199
213
|
});
|
|
200
|
-
pick.placeholder = ( localize(
|
|
214
|
+
pick.placeholder = ( localize(13516, "Select an MCP Server for this session"));
|
|
201
215
|
store.add(pick);
|
|
202
216
|
const refresh = () => {
|
|
203
217
|
const firstRun = pick.items.length === 0;
|
|
218
|
+
const previousActiveId = pick.activeItems[0]?.id;
|
|
204
219
|
const servers = agentHostCustomizations.getMcpServers(agentHostSession);
|
|
205
220
|
pick.items = [...(servers.length === 0 ? [{
|
|
206
221
|
id: "$empty",
|
|
207
|
-
label: ( localize(
|
|
208
|
-
description: ( localize(
|
|
222
|
+
label: ( localize(13517, "No MCP servers")),
|
|
223
|
+
description: ( localize(13518, "This session does not expose any MCP servers")),
|
|
209
224
|
alwaysShow: true
|
|
210
225
|
}] : ( servers.map(server => ({
|
|
211
226
|
id: server.id,
|
|
227
|
+
server,
|
|
212
228
|
label: server.name,
|
|
213
|
-
description: server.enabled ? mcpServerStatusToLabel(server.status) : ( localize(
|
|
229
|
+
description: server.enabled ? mcpServerStatusToLabel(server.status) : ( localize(13515, "Disabled")),
|
|
230
|
+
buttons: getAgentHostMcpServerButtons(server)
|
|
214
231
|
})))), {
|
|
215
232
|
type: "separator"
|
|
216
233
|
}, {
|
|
217
234
|
id: BACK_ID,
|
|
218
|
-
label: ( localize(
|
|
235
|
+
label: ( localize(13519, "Show locally configured servers...")),
|
|
219
236
|
iconClass: ThemeIcon.asClassName(Codicon.arrowLeft),
|
|
220
237
|
alwaysShow: true
|
|
221
238
|
}];
|
|
239
|
+
if (previousActiveId) {
|
|
240
|
+
const previousItem = pick.items.find(item => !("type" in item) && item.id === previousActiveId);
|
|
241
|
+
if (previousItem) {
|
|
242
|
+
pick.activeItems = [previousItem];
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
222
246
|
if (firstRun && servers.length > 0) {
|
|
223
247
|
pick.activeItems = [pick.items[0]];
|
|
224
248
|
}
|
|
225
249
|
};
|
|
226
250
|
refresh();
|
|
227
251
|
store.add(agentHostCustomizations.onDidChangeCustomizations(() => refresh()));
|
|
252
|
+
store.add(pick.onDidTriggerItemButton(async event => {
|
|
253
|
+
if (!isAgentHostMcpServerButton(event.button) || !event.item.server) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
pick.busy = true;
|
|
257
|
+
try {
|
|
258
|
+
await runAgentHostMcpServerLifecycleAction(event.item.server, event.button.action, services);
|
|
259
|
+
refresh();
|
|
260
|
+
} finally {
|
|
261
|
+
pick.busy = false;
|
|
262
|
+
}
|
|
263
|
+
}));
|
|
228
264
|
const picked = await ( new Promise(resolve => {
|
|
229
265
|
store.add(pick.onDidAccept(() => {
|
|
230
266
|
resolve(pick.activeItems[0]);
|
|
@@ -245,27 +281,141 @@ class ListMcpServerCommand extends Action2 {
|
|
|
245
281
|
return undefined;
|
|
246
282
|
}
|
|
247
283
|
}
|
|
284
|
+
function isAgentHostMcpServerButton(button) {
|
|
285
|
+
return "action" in button && (button.action === "start" || button.action === "stop");
|
|
286
|
+
}
|
|
287
|
+
const startAgentHostMcpServerButton = {
|
|
288
|
+
iconClass: ThemeIcon.asClassName(Codicon.play),
|
|
289
|
+
tooltip: ( localize(13520, "Start Server")),
|
|
290
|
+
action: "start"
|
|
291
|
+
};
|
|
292
|
+
const stopAgentHostMcpServerButton = {
|
|
293
|
+
iconClass: ThemeIcon.asClassName(Codicon.debugStop),
|
|
294
|
+
tooltip: ( localize(13521, "Stop Server")),
|
|
295
|
+
action: "stop"
|
|
296
|
+
};
|
|
297
|
+
function getAgentHostMcpServerButtons(server) {
|
|
298
|
+
if (canStartAgentHostMcpServer(server)) {
|
|
299
|
+
return [startAgentHostMcpServerButton];
|
|
300
|
+
}
|
|
301
|
+
if (canStopAgentHostMcpServer(server)) {
|
|
302
|
+
return [stopAgentHostMcpServerButton];
|
|
303
|
+
}
|
|
304
|
+
return [];
|
|
305
|
+
}
|
|
306
|
+
function canStartAgentHostMcpServer(server) {
|
|
307
|
+
return server.enabled && (server.status === McpServerStatus.Stopped || server.status === McpServerStatus.Error);
|
|
308
|
+
}
|
|
309
|
+
function canStopAgentHostMcpServer(server) {
|
|
310
|
+
return server.enabled && (server.status === McpServerStatus.Starting || server.status === McpServerStatus.Ready || server.status === McpServerStatus.AuthRequired);
|
|
311
|
+
}
|
|
312
|
+
async function runAgentHostMcpServerLifecycleAction(server, action, services) {
|
|
313
|
+
try {
|
|
314
|
+
if (action === "start" && canStartAgentHostMcpServer(server)) {
|
|
315
|
+
await server.start();
|
|
316
|
+
} else if (action === "stop" && canStopAgentHostMcpServer(server)) {
|
|
317
|
+
await server.stop();
|
|
318
|
+
}
|
|
319
|
+
} catch (error) {
|
|
320
|
+
services.logService.error(`Failed to ${action} MCP server '${server.name}'`, error);
|
|
321
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
322
|
+
services.notificationService.error(action === "start" ? ( localize(13522, "Failed to start MCP server '{0}': {1}", server.name, message)) : ( localize(13523, "Failed to stop MCP server '{0}': {1}", server.name, message)));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
248
325
|
function mcpServerStatusToLabel(status) {
|
|
249
326
|
switch (status) {
|
|
250
327
|
case McpServerStatus.Starting:
|
|
251
|
-
return localize(
|
|
328
|
+
return localize(13524, "Starting");
|
|
252
329
|
case McpServerStatus.Ready:
|
|
253
|
-
return localize(
|
|
330
|
+
return localize(13525, "Running");
|
|
254
331
|
case McpServerStatus.AuthRequired:
|
|
255
|
-
return localize(
|
|
332
|
+
return localize(13526, "Authentication required");
|
|
256
333
|
case McpServerStatus.Error:
|
|
257
|
-
return localize(
|
|
334
|
+
return localize(13527, "Error");
|
|
258
335
|
case McpServerStatus.Stopped:
|
|
259
|
-
return localize(
|
|
336
|
+
return localize(13528, "Stopped");
|
|
260
337
|
default:
|
|
261
338
|
return "";
|
|
262
339
|
}
|
|
263
340
|
}
|
|
341
|
+
function getAgentHostMcpServerEnablementItems(server, hasWorkspace, scopes = ["global", "workspace", "session"]) {
|
|
342
|
+
const enablement = getCustomizationScopeEnablement(server);
|
|
343
|
+
const items = [];
|
|
344
|
+
if (scopes.includes("global")) {
|
|
345
|
+
items.push({
|
|
346
|
+
label: enablement.global ? ( localize(13529, "Disable")) : ( localize(13530, "Enable")),
|
|
347
|
+
action: enablement.global ? "disableProfile" : "enableProfile"
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
if (scopes.includes("workspace") && hasWorkspace) {
|
|
351
|
+
items.push({
|
|
352
|
+
label: enablement.workspace ? ( localize(13531, "Disable (Workspace)")) : ( localize(13532, "Enable (Workspace)")),
|
|
353
|
+
action: enablement.workspace ? "disableWorkspace" : "enableWorkspace"
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
if (scopes.includes("session")) {
|
|
357
|
+
items.push({
|
|
358
|
+
label: enablement.session ? ( localize(13533, "Disable (Session)")) : ( localize(13534, "Enable (Session)")),
|
|
359
|
+
action: enablement.session ? "disableSession" : "enableSession"
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return items;
|
|
363
|
+
}
|
|
364
|
+
function getLocalMcpServerEnablementItems(disabled, isEmptyWorkbench, includeWorkspace = true) {
|
|
365
|
+
const items = [];
|
|
366
|
+
if (disabled) {
|
|
367
|
+
items.push({
|
|
368
|
+
label: ( localize(13530, "Enable")),
|
|
369
|
+
action: "enableProfile"
|
|
370
|
+
});
|
|
371
|
+
if (includeWorkspace && !isEmptyWorkbench) {
|
|
372
|
+
items.push({
|
|
373
|
+
label: ( localize(13532, "Enable (Workspace)")),
|
|
374
|
+
action: "enableWorkspace"
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
items.push({
|
|
379
|
+
label: ( localize(13529, "Disable")),
|
|
380
|
+
action: "disableProfile"
|
|
381
|
+
});
|
|
382
|
+
if (includeWorkspace && !isEmptyWorkbench) {
|
|
383
|
+
items.push({
|
|
384
|
+
label: ( localize(13531, "Disable (Workspace)")),
|
|
385
|
+
action: "disableWorkspace"
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return items;
|
|
390
|
+
}
|
|
391
|
+
function enablementStateForAction(action) {
|
|
392
|
+
switch (action) {
|
|
393
|
+
case "enableProfile":
|
|
394
|
+
return ContributionEnablementState.EnabledProfile;
|
|
395
|
+
case "disableProfile":
|
|
396
|
+
return ContributionEnablementState.DisabledProfile;
|
|
397
|
+
case "enableWorkspace":
|
|
398
|
+
return ContributionEnablementState.EnabledWorkspace;
|
|
399
|
+
case "disableWorkspace":
|
|
400
|
+
return ContributionEnablementState.DisabledWorkspace;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function findLocalMcpServer(mcpService, server) {
|
|
404
|
+
const servers = mcpService.servers.get();
|
|
405
|
+
const separator = server.id.indexOf("/");
|
|
406
|
+
const rawId = separator >= 0 ? server.id.slice(separator + 1) : server.id;
|
|
407
|
+
const idMatches = servers.filter(candidate => candidate.definition.id === rawId);
|
|
408
|
+
if (idMatches.length === 1) {
|
|
409
|
+
return idMatches[0];
|
|
410
|
+
}
|
|
411
|
+
const nameMatches = servers.filter(candidate => candidate.definition.label === server.name);
|
|
412
|
+
return nameMatches.length === 1 ? nameMatches[0] : undefined;
|
|
413
|
+
}
|
|
264
414
|
class McpAgentHostServerOptionsCommand extends Action2 {
|
|
265
415
|
constructor() {
|
|
266
416
|
super({
|
|
267
417
|
id: McpCommandIds.AgentHostServerOptions,
|
|
268
|
-
title: ( localize2(
|
|
418
|
+
title: ( localize2(13535, "Agent Host Server Options")),
|
|
269
419
|
category,
|
|
270
420
|
f1: false
|
|
271
421
|
});
|
|
@@ -273,33 +423,69 @@ class McpAgentHostServerOptionsCommand extends Action2 {
|
|
|
273
423
|
async run(accessor, agentHostSession, customizationId) {
|
|
274
424
|
const agentHostCustomizations = accessor.get(IAgentHostCustomizationService);
|
|
275
425
|
const quickInputService = accessor.get(IQuickInputService);
|
|
276
|
-
const
|
|
426
|
+
const notificationService = accessor.get(INotificationService);
|
|
427
|
+
const logService = accessor.get(ILogService);
|
|
428
|
+
const aiCustomizationWorkspaceService = accessor.get(IAICustomizationWorkspaceService);
|
|
429
|
+
const agentPluginService = accessor.get(IAgentPluginService);
|
|
430
|
+
const mcpService = accessor.get(IMcpService);
|
|
277
431
|
const server = agentHostCustomizations.getMcpServers(agentHostSession).find(s => s.id === customizationId);
|
|
278
432
|
if (!server) {
|
|
279
433
|
return;
|
|
280
434
|
}
|
|
281
|
-
const logOutputChannelId = server.logOutputChannelId;
|
|
282
435
|
const items = [{
|
|
283
436
|
type: "separator",
|
|
284
|
-
label: ( localize(
|
|
285
|
-
}, {
|
|
286
|
-
label: server.enabled ? ( localize(11780, "Disable Server")) : ( localize(11781, "Enable Server")),
|
|
287
|
-
description: server.enabled ? mcpServerStatusToLabel(server.status) : ( localize(11768, "Disabled")),
|
|
288
|
-
action: "toggle"
|
|
437
|
+
label: ( localize(13536, "Status"))
|
|
289
438
|
}];
|
|
290
|
-
if (server
|
|
439
|
+
if (canStartAgentHostMcpServer(server)) {
|
|
291
440
|
items.push({
|
|
292
|
-
label: ( localize(
|
|
293
|
-
description: server.
|
|
294
|
-
action: "
|
|
441
|
+
label: ( localize(13520, "Start Server")),
|
|
442
|
+
description: mcpServerStatusToLabel(server.status),
|
|
443
|
+
action: "start"
|
|
295
444
|
});
|
|
445
|
+
} else if (canStopAgentHostMcpServer(server)) {
|
|
446
|
+
items.push({
|
|
447
|
+
label: ( localize(13521, "Stop Server")),
|
|
448
|
+
description: mcpServerStatusToLabel(server.status),
|
|
449
|
+
action: "stop"
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
const pluginDisabled = server.disabledReason?.source === "plugin";
|
|
453
|
+
const localServer = findLocalMcpServer(mcpService, server);
|
|
454
|
+
const durableProfileDisabled = localServer !== undefined && !mcpService.enablementModel.readProfileEnabled(localServer.definition.id);
|
|
455
|
+
const isEmptyWorkbench = aiCustomizationWorkspaceService.getActiveProjectRoot() === undefined;
|
|
456
|
+
items.push({
|
|
457
|
+
type: "separator",
|
|
458
|
+
label: ( localize(13537, "Enablement"))
|
|
459
|
+
});
|
|
460
|
+
if (pluginDisabled) {
|
|
461
|
+
items.push({
|
|
462
|
+
label: ( localize(13538, "Enable Plugin")),
|
|
463
|
+
action: "enablePlugin"
|
|
464
|
+
});
|
|
465
|
+
} else {
|
|
466
|
+
items.push(...(localServer ? [
|
|
467
|
+
...getLocalMcpServerEnablementItems(durableProfileDisabled, isEmptyWorkbench, false),
|
|
468
|
+
...getAgentHostMcpServerEnablementItems(
|
|
469
|
+
server,
|
|
470
|
+
agentHostCustomizations.getWorkingDirectories(agentHostSession).length > 0,
|
|
471
|
+
["workspace", "session"]
|
|
472
|
+
)
|
|
473
|
+
] : getAgentHostMcpServerEnablementItems(
|
|
474
|
+
server,
|
|
475
|
+
agentHostCustomizations.getWorkingDirectories(agentHostSession).length > 0
|
|
476
|
+
)));
|
|
296
477
|
}
|
|
297
|
-
if (
|
|
478
|
+
if (server.enabled && server.state.kind === McpServerStatus.AuthRequired) {
|
|
298
479
|
items.push({
|
|
299
|
-
label: ( localize(
|
|
300
|
-
|
|
480
|
+
label: ( localize(13539, "Authenticate")),
|
|
481
|
+
description: server.state.resource.resource,
|
|
482
|
+
action: "authenticate"
|
|
301
483
|
});
|
|
302
484
|
}
|
|
485
|
+
items.push({
|
|
486
|
+
label: ( localize(13540, "Show Output")),
|
|
487
|
+
action: "showOutput"
|
|
488
|
+
});
|
|
303
489
|
const picked = await quickInputService.pick(items, {
|
|
304
490
|
placeHolder: server.name
|
|
305
491
|
});
|
|
@@ -309,25 +495,52 @@ class McpAgentHostServerOptionsCommand extends Action2 {
|
|
|
309
495
|
return;
|
|
310
496
|
}
|
|
311
497
|
if (picked.action === "showOutput") {
|
|
312
|
-
|
|
313
|
-
await outputService.showChannel(logOutputChannelId);
|
|
314
|
-
}
|
|
498
|
+
agentHostCustomizations.showMcpServerLog(agentHostSession, server.id);
|
|
315
499
|
return;
|
|
316
500
|
}
|
|
317
501
|
if (picked.action === "authenticate") {
|
|
318
502
|
await agentHostCustomizations.authenticateMcpServer(agentHostSession, server.id);
|
|
319
503
|
return;
|
|
320
504
|
}
|
|
321
|
-
if (picked.action === "
|
|
322
|
-
|
|
505
|
+
if (picked.action === "start" || picked.action === "stop") {
|
|
506
|
+
await runAgentHostMcpServerLifecycleAction(server, picked.action, {
|
|
507
|
+
notificationService,
|
|
508
|
+
logService
|
|
509
|
+
});
|
|
510
|
+
return;
|
|
323
511
|
}
|
|
512
|
+
if (picked.action === "enablePlugin") {
|
|
513
|
+
const reason = server.disabledReason;
|
|
514
|
+
if (reason?.source === "plugin") {
|
|
515
|
+
const decision = reason.plugin.enablement?.[0];
|
|
516
|
+
if (decision) {
|
|
517
|
+
setAgentHostPluginEnablement(
|
|
518
|
+
agentHostCustomizations,
|
|
519
|
+
agentPluginService,
|
|
520
|
+
agentHostSession,
|
|
521
|
+
reason.plugin,
|
|
522
|
+
decision.kind,
|
|
523
|
+
true
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (localServer && (picked.action === "enableProfile" || picked.action === "disableProfile")) {
|
|
530
|
+
const state = enablementStateForAction(picked.action);
|
|
531
|
+
mcpService.enablementModel.setEnabled(localServer.definition.id, state);
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const scope = picked.action === "enableProfile" || picked.action === "disableProfile" ? CustomizationEnablementKind.Global : picked.action === "enableWorkspace" || picked.action === "disableWorkspace" ? CustomizationEnablementKind.Workspace : CustomizationEnablementKind.Session;
|
|
535
|
+
const enabled = picked.action === "enableProfile" || picked.action === "enableWorkspace" || picked.action === "enableSession";
|
|
536
|
+
agentHostCustomizations.setCustomizationEnablement(agentHostSession, server.id, server.enablement, scope, enabled);
|
|
324
537
|
}
|
|
325
538
|
}
|
|
326
539
|
class McpConfirmationServerOptionsCommand extends Action2 {
|
|
327
540
|
constructor() {
|
|
328
541
|
super({
|
|
329
542
|
id: McpCommandIds.ServerOptionsInConfirmation,
|
|
330
|
-
title: ( localize2(
|
|
543
|
+
title: ( localize2(13541, "Server Options")),
|
|
331
544
|
category,
|
|
332
545
|
icon: Codicon.settingsGear,
|
|
333
546
|
f1: false,
|
|
@@ -358,7 +571,7 @@ class McpServerOptionsCommand extends Action2 {
|
|
|
358
571
|
constructor() {
|
|
359
572
|
super({
|
|
360
573
|
id: McpCommandIds.ServerOptions,
|
|
361
|
-
title: ( localize2(
|
|
574
|
+
title: ( localize2(13541, "Server Options")),
|
|
362
575
|
category,
|
|
363
576
|
f1: false
|
|
364
577
|
});
|
|
@@ -383,25 +596,25 @@ class McpServerOptionsCommand extends Action2 {
|
|
|
383
596
|
const disabled = isContributionDisabled(server.enablement.get());
|
|
384
597
|
items.push({
|
|
385
598
|
type: "separator",
|
|
386
|
-
label: ( localize(
|
|
599
|
+
label: ( localize(13536, "Status"))
|
|
387
600
|
});
|
|
388
601
|
if (disabled) {
|
|
389
602
|
items.push({
|
|
390
|
-
label: ( localize(
|
|
603
|
+
label: ( localize(13542, "Enable Server (Workspace)")),
|
|
391
604
|
action: "enable"
|
|
392
605
|
});
|
|
393
606
|
} else if (McpConnectionState.canBeStarted(serverState.state)) {
|
|
394
607
|
items.push({
|
|
395
|
-
label: ( localize(
|
|
608
|
+
label: ( localize(13520, "Start Server")),
|
|
396
609
|
action: "start"
|
|
397
610
|
});
|
|
398
611
|
} else {
|
|
399
612
|
items.push({
|
|
400
|
-
label: ( localize(
|
|
613
|
+
label: ( localize(13521, "Stop Server")),
|
|
401
614
|
action: "stop"
|
|
402
615
|
});
|
|
403
616
|
items.push({
|
|
404
|
-
label: ( localize(
|
|
617
|
+
label: ( localize(13543, "Restart Server")),
|
|
405
618
|
action: "restart"
|
|
406
619
|
});
|
|
407
620
|
}
|
|
@@ -409,26 +622,26 @@ class McpServerOptionsCommand extends Action2 {
|
|
|
409
622
|
const configTarget = serverDefinition?.presentation?.origin || collection?.presentation?.origin;
|
|
410
623
|
if (configTarget) {
|
|
411
624
|
items.push({
|
|
412
|
-
label: ( localize(
|
|
625
|
+
label: ( localize(13544, "Show Configuration")),
|
|
413
626
|
action: "config"
|
|
414
627
|
});
|
|
415
628
|
}
|
|
416
629
|
items.push({
|
|
417
|
-
label: ( localize(
|
|
630
|
+
label: ( localize(13540, "Show Output")),
|
|
418
631
|
action: "showOutput"
|
|
419
632
|
});
|
|
420
633
|
items.push({
|
|
421
634
|
type: "separator",
|
|
422
|
-
label: ( localize(
|
|
635
|
+
label: ( localize(13545, "Sampling"))
|
|
423
636
|
}, {
|
|
424
|
-
label: ( localize(
|
|
425
|
-
description: ( localize(
|
|
637
|
+
label: ( localize(13546, "Configure Model Access")),
|
|
638
|
+
description: ( localize(13547, "Set the models the server can use via MCP sampling")),
|
|
426
639
|
action: "configSampling"
|
|
427
640
|
});
|
|
428
641
|
if (samplingService.hasLogs(server)) {
|
|
429
642
|
items.push({
|
|
430
|
-
label: ( localize(
|
|
431
|
-
description: ( localize(
|
|
643
|
+
label: ( localize(13548, "Show Sampling Requests")),
|
|
644
|
+
description: ( localize(13549, "Show the sampling requests for this server")),
|
|
432
645
|
action: "samplingLog"
|
|
433
646
|
});
|
|
434
647
|
}
|
|
@@ -436,15 +649,15 @@ class McpServerOptionsCommand extends Action2 {
|
|
|
436
649
|
if (capabilities === undefined || (capabilities & McpCapability.Resources)) {
|
|
437
650
|
items.push({
|
|
438
651
|
type: "separator",
|
|
439
|
-
label: ( localize(
|
|
652
|
+
label: ( localize(13550, "Resources"))
|
|
440
653
|
});
|
|
441
654
|
items.push({
|
|
442
|
-
label: ( localize(
|
|
655
|
+
label: ( localize(13551, "Browse Resources")),
|
|
443
656
|
action: "resources"
|
|
444
657
|
});
|
|
445
658
|
}
|
|
446
659
|
const pick = await quickInputService.pick(items, {
|
|
447
|
-
placeHolder: ( localize(
|
|
660
|
+
placeHolder: ( localize(13552, "Select action for '{0}'", server.definition.label))
|
|
448
661
|
});
|
|
449
662
|
if (!pick) {
|
|
450
663
|
return;
|
|
@@ -495,7 +708,7 @@ class McpServerOptionsCommand extends Action2 {
|
|
|
495
708
|
editorService.openEditor({
|
|
496
709
|
resource: undefined,
|
|
497
710
|
contents: samplingService.getLogText(server),
|
|
498
|
-
label: ( localize(
|
|
711
|
+
label: ( localize(13553, "MCP Sampling: {0}", server.definition.label))
|
|
499
712
|
});
|
|
500
713
|
break;
|
|
501
714
|
default:
|
|
@@ -512,14 +725,14 @@ class McpServerOptionsCommand extends Action2 {
|
|
|
512
725
|
if (accountQuery.entities().getEntityCount().total > 1) {
|
|
513
726
|
result.push({
|
|
514
727
|
action: "disconnect",
|
|
515
|
-
label: ( localize(
|
|
728
|
+
label: ( localize(13554, "Disconnect Account")),
|
|
516
729
|
description: `(${accountName})`,
|
|
517
730
|
accountQuery
|
|
518
731
|
});
|
|
519
732
|
} else {
|
|
520
733
|
result.push({
|
|
521
734
|
action: "signout",
|
|
522
|
-
label: ( localize(
|
|
735
|
+
label: ( localize(13555, "Sign Out")),
|
|
523
736
|
description: `(${accountName})`,
|
|
524
737
|
accountQuery
|
|
525
738
|
});
|
|
@@ -635,15 +848,21 @@ let MCPServerActionRendering = class MCPServerActionRendering extends Disposable
|
|
|
635
848
|
stateIndicator.className = "chat-mcp-state-indicator";
|
|
636
849
|
if (state === DisplayedState.NewTools) {
|
|
637
850
|
stateIndicator.style.display = "block";
|
|
638
|
-
stateIndicator.classList.add(
|
|
851
|
+
stateIndicator.classList.add(
|
|
852
|
+
"chat-mcp-state-new",
|
|
853
|
+
...ThemeIcon.asClassNameArray(Codicon.refreshCompact)
|
|
854
|
+
);
|
|
639
855
|
} else if (state === DisplayedState.Error) {
|
|
640
856
|
stateIndicator.style.display = "block";
|
|
641
|
-
stateIndicator.classList.add(
|
|
857
|
+
stateIndicator.classList.add(
|
|
858
|
+
"chat-mcp-state-error",
|
|
859
|
+
...ThemeIcon.asClassNameArray(Codicon.warningCompact)
|
|
860
|
+
);
|
|
642
861
|
} else if (state === DisplayedState.Refreshing) {
|
|
643
862
|
stateIndicator.style.display = "block";
|
|
644
863
|
stateIndicator.classList.add(
|
|
645
864
|
"chat-mcp-state-refreshing",
|
|
646
|
-
...ThemeIcon.asClassNameArray(
|
|
865
|
+
...ThemeIcon.asClassNameArray(ThemeIcon.modify(Codicon.loadingCompact, "spin"))
|
|
647
866
|
);
|
|
648
867
|
} else {
|
|
649
868
|
stateIndicator.style.display = "none";
|
|
@@ -688,24 +907,24 @@ let MCPServerActionRendering = class MCPServerActionRendering extends Disposable
|
|
|
688
907
|
text: s.definition.label,
|
|
689
908
|
id: McpCommandIds.ServerOptions,
|
|
690
909
|
arguments: [s.definition.id],
|
|
691
|
-
tooltip: ( localize(
|
|
910
|
+
tooltip: ( localize(13556, "Show server options for {0}", s.definition.label))
|
|
692
911
|
});
|
|
693
912
|
const single = servers.length === 1;
|
|
694
913
|
const names = ( ( servers.map(s => isServer(s) ? link(s) : "`" + s.label + "`")).map(l => single ? l : `- ${l}`)).join("\n");
|
|
695
914
|
let markdown;
|
|
696
915
|
if (state === DisplayedState.NewTools) {
|
|
697
916
|
markdown = ( new MarkdownString(single ? ( localize(
|
|
698
|
-
|
|
917
|
+
13557,
|
|
699
918
|
"MCP server {0} has been updated and may have new tools available.",
|
|
700
919
|
names
|
|
701
920
|
)) : ( localize(
|
|
702
|
-
|
|
921
|
+
13558,
|
|
703
922
|
"MCP servers have been updated and may have new tools available:\n\n{0}",
|
|
704
923
|
names
|
|
705
924
|
))));
|
|
706
925
|
} else if (state === DisplayedState.Error) {
|
|
707
|
-
markdown = ( new MarkdownString(single ? ( localize(
|
|
708
|
-
|
|
926
|
+
markdown = ( new MarkdownString(single ? ( localize(13559, "MCP server {0} was unable to start successfully.", names)) : ( localize(
|
|
927
|
+
13560,
|
|
709
928
|
"Multiple MCP servers were unable to start successfully:\n\n{0}",
|
|
710
929
|
names
|
|
711
930
|
))));
|
|
@@ -732,7 +951,7 @@ let MCPServerActionRendering = class MCPServerActionRendering extends Disposable
|
|
|
732
951
|
const divider = $("hr.mcp-hover-divider");
|
|
733
952
|
container.appendChild(divider);
|
|
734
953
|
const checkboxContainer = $("div.mcp-hover-setting");
|
|
735
|
-
const settingLabelStr = ( localize(
|
|
954
|
+
const settingLabelStr = ( localize(13561, "Automatically start MCP servers when sending a chat message"));
|
|
736
955
|
const checkbox = store.add(( new Checkbox(settingLabelStr, config.get() !== McpAutoStartValue.Never, {
|
|
737
956
|
...defaultCheckboxStyles
|
|
738
957
|
})));
|
|
@@ -760,11 +979,11 @@ let MCPServerActionRendering = class MCPServerActionRendering extends Disposable
|
|
|
760
979
|
} = displayedStateCurrent.get()
|
|
761
980
|
) {
|
|
762
981
|
if (state === DisplayedState.NewTools) {
|
|
763
|
-
return localize(
|
|
982
|
+
return localize(13562, "New tools available ({0})", servers.length || 1);
|
|
764
983
|
} else if (state === DisplayedState.Error) {
|
|
765
|
-
return localize(
|
|
984
|
+
return localize(13563, "Error loading {0} tool(s)", servers.length || 1);
|
|
766
985
|
} else if (state === DisplayedState.Refreshing) {
|
|
767
|
-
return localize(
|
|
986
|
+
return localize(13564, "Discovering tools...");
|
|
768
987
|
} else {
|
|
769
988
|
return null;
|
|
770
989
|
}
|
|
@@ -782,7 +1001,7 @@ class ResetMcpTrustCommand extends Action2 {
|
|
|
782
1001
|
constructor() {
|
|
783
1002
|
super({
|
|
784
1003
|
id: McpCommandIds.ResetTrust,
|
|
785
|
-
title: ( localize2(
|
|
1004
|
+
title: ( localize2(13565, "Reset Trust")),
|
|
786
1005
|
category,
|
|
787
1006
|
f1: true,
|
|
788
1007
|
precondition: ( ContextKeyExpr.and(McpContextKeys.toolsCount.greater(0), ( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate())))
|
|
@@ -797,7 +1016,7 @@ class ResetMcpCachedTools extends Action2 {
|
|
|
797
1016
|
constructor() {
|
|
798
1017
|
super({
|
|
799
1018
|
id: McpCommandIds.ResetCachedTools,
|
|
800
|
-
title: ( localize2(
|
|
1019
|
+
title: ( localize2(13566, "Reset Cached Tools")),
|
|
801
1020
|
category,
|
|
802
1021
|
f1: true,
|
|
803
1022
|
precondition: ( ContextKeyExpr.and(McpContextKeys.toolsCount.greater(0), ( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate())))
|
|
@@ -812,9 +1031,9 @@ class AddConfigurationAction extends Action2 {
|
|
|
812
1031
|
constructor() {
|
|
813
1032
|
super({
|
|
814
1033
|
id: McpCommandIds.AddConfiguration,
|
|
815
|
-
title: ( localize2(
|
|
1034
|
+
title: ( localize2(13567, "Add Server...")),
|
|
816
1035
|
metadata: {
|
|
817
|
-
description: ( localize2(
|
|
1036
|
+
description: ( localize2(13568, "Installs a new Model Context protocol to the mcp.json settings"))
|
|
818
1037
|
},
|
|
819
1038
|
category,
|
|
820
1039
|
f1: true,
|
|
@@ -836,9 +1055,9 @@ class InstallFromManifestAction extends Action2 {
|
|
|
836
1055
|
constructor() {
|
|
837
1056
|
super({
|
|
838
1057
|
id: McpCommandIds.InstallFromManifest,
|
|
839
|
-
title: ( localize2(
|
|
1058
|
+
title: ( localize2(13569, "Install Server from Manifest...")),
|
|
840
1059
|
metadata: {
|
|
841
|
-
description: ( localize2(
|
|
1060
|
+
description: ( localize2(13570, "Install an MCP server from a JSON manifest file"))
|
|
842
1061
|
},
|
|
843
1062
|
category,
|
|
844
1063
|
f1: true,
|
|
@@ -854,7 +1073,7 @@ class RemoveStoredInput extends Action2 {
|
|
|
854
1073
|
constructor() {
|
|
855
1074
|
super({
|
|
856
1075
|
id: McpCommandIds.RemoveStoredInput,
|
|
857
|
-
title: ( localize2(
|
|
1076
|
+
title: ( localize2(13566, "Reset Cached Tools")),
|
|
858
1077
|
category,
|
|
859
1078
|
f1: false
|
|
860
1079
|
});
|
|
@@ -867,7 +1086,7 @@ class EditStoredInput extends Action2 {
|
|
|
867
1086
|
constructor() {
|
|
868
1087
|
super({
|
|
869
1088
|
id: McpCommandIds.EditStoredInput,
|
|
870
|
-
title: ( localize2(
|
|
1089
|
+
title: ( localize2(13571, "Edit Stored Input")),
|
|
871
1090
|
category,
|
|
872
1091
|
f1: false
|
|
873
1092
|
});
|
|
@@ -881,7 +1100,7 @@ class SetOAuthClientSecret extends Action2 {
|
|
|
881
1100
|
constructor() {
|
|
882
1101
|
super({
|
|
883
1102
|
id: McpCommandIds.SetOAuthClientSecret,
|
|
884
|
-
title: ( localize2(
|
|
1103
|
+
title: ( localize2(13572, "Set OAuth Client Secret")),
|
|
885
1104
|
category,
|
|
886
1105
|
f1: false
|
|
887
1106
|
});
|
|
@@ -893,21 +1112,21 @@ class SetOAuthClientSecret extends Action2 {
|
|
|
893
1112
|
const existing = await secretStorageService.get(key);
|
|
894
1113
|
const deleteButton = {
|
|
895
1114
|
iconClass: ThemeIcon.asClassName(Codicon.trash),
|
|
896
|
-
tooltip: ( localize(
|
|
1115
|
+
tooltip: ( localize(13573, "Delete stored client secret"))
|
|
897
1116
|
};
|
|
898
1117
|
const revealButton = {
|
|
899
1118
|
iconClass: ThemeIcon.asClassName(Codicon.eye),
|
|
900
|
-
tooltip: ( localize(
|
|
1119
|
+
tooltip: ( localize(13574, "Show client secret"))
|
|
901
1120
|
};
|
|
902
1121
|
const hideButton = {
|
|
903
1122
|
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
904
|
-
tooltip: ( localize(
|
|
1123
|
+
tooltip: ( localize(13575, "Hide client secret"))
|
|
905
1124
|
};
|
|
906
1125
|
const result = await ( new Promise(resolve => {
|
|
907
1126
|
const input = quickInputService.createInputBox();
|
|
908
|
-
input.title = existing ? ( localize(
|
|
909
|
-
input.prompt = ( localize(
|
|
910
|
-
input.placeholder = existing ? ( localize(
|
|
1127
|
+
input.title = existing ? ( localize(13576, "Replace Client Secret for {0}", serverName)) : ( localize(13577, "Set Client Secret for {0}", serverName));
|
|
1128
|
+
input.prompt = ( localize(13578, "Enter the client secret for OAuth client '{0}'.", clientId));
|
|
1129
|
+
input.placeholder = existing ? ( localize(13579, "Enter a new client secret to replace the stored value")) : ( localize(13580, "Enter client secret"));
|
|
911
1130
|
input.password = true;
|
|
912
1131
|
input.ignoreFocusOut = true;
|
|
913
1132
|
if (existing) {
|
|
@@ -967,7 +1186,7 @@ class ShowConfiguration extends Action2 {
|
|
|
967
1186
|
constructor() {
|
|
968
1187
|
super({
|
|
969
1188
|
id: McpCommandIds.ShowConfiguration,
|
|
970
|
-
title: ( localize2(
|
|
1189
|
+
title: ( localize2(13581, "Show Configuration")),
|
|
971
1190
|
category,
|
|
972
1191
|
f1: false
|
|
973
1192
|
});
|
|
@@ -997,7 +1216,7 @@ class ShowOutput extends Action2 {
|
|
|
997
1216
|
constructor() {
|
|
998
1217
|
super({
|
|
999
1218
|
id: McpCommandIds.ShowOutput,
|
|
1000
|
-
title: ( localize2(
|
|
1219
|
+
title: ( localize2(13582, "Show Output")),
|
|
1001
1220
|
category,
|
|
1002
1221
|
f1: false
|
|
1003
1222
|
});
|
|
@@ -1006,16 +1225,34 @@ class ShowOutput extends Action2 {
|
|
|
1006
1225
|
accessor.get(IMcpService).servers.get().find(s => s.definition.id === serverId)?.showOutput();
|
|
1007
1226
|
}
|
|
1008
1227
|
}
|
|
1228
|
+
function isAgentHostMcpServerCommandArg(arg) {
|
|
1229
|
+
return typeof arg !== "string" && URI.isUri(arg.agentHostSession) && typeof arg.serverId === "string";
|
|
1230
|
+
}
|
|
1231
|
+
function getAgentHostMcpServer(accessor, arg) {
|
|
1232
|
+
return accessor.get(IAgentHostCustomizationService).getMcpServers(arg.agentHostSession).find(server => server.id === arg.serverId);
|
|
1233
|
+
}
|
|
1009
1234
|
class RestartServer extends Action2 {
|
|
1010
1235
|
constructor() {
|
|
1011
1236
|
super({
|
|
1012
1237
|
id: McpCommandIds.RestartServer,
|
|
1013
|
-
title: ( localize2(
|
|
1238
|
+
title: ( localize2(13583, "Restart Server")),
|
|
1014
1239
|
category,
|
|
1015
1240
|
f1: false
|
|
1016
1241
|
});
|
|
1017
1242
|
}
|
|
1018
1243
|
async run(accessor, serverId, opts) {
|
|
1244
|
+
if (isAgentHostMcpServerCommandArg(serverId)) {
|
|
1245
|
+
const server = getAgentHostMcpServer(accessor, serverId);
|
|
1246
|
+
accessor.get(ILogService).warn(
|
|
1247
|
+
`Restarting MCP server '${server?.name ?? serverId.serverId}' is not supported for agent-host servers`
|
|
1248
|
+
);
|
|
1249
|
+
accessor.get(INotificationService).warn(( localize(
|
|
1250
|
+
13584,
|
|
1251
|
+
"Restarting MCP server '{0}' is not supported for agent-host servers. Stop and start the server instead.",
|
|
1252
|
+
server?.name ?? serverId.serverId
|
|
1253
|
+
)));
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1019
1256
|
const s = accessor.get(IMcpService).servers.get().find(s => s.definition.id === serverId);
|
|
1020
1257
|
s?.showOutput();
|
|
1021
1258
|
await s?.stop();
|
|
@@ -1029,12 +1266,16 @@ class StartServer extends Action2 {
|
|
|
1029
1266
|
constructor() {
|
|
1030
1267
|
super({
|
|
1031
1268
|
id: McpCommandIds.StartServer,
|
|
1032
|
-
title: ( localize2(
|
|
1269
|
+
title: ( localize2(13585, "Start Server")),
|
|
1033
1270
|
category,
|
|
1034
1271
|
f1: false
|
|
1035
1272
|
});
|
|
1036
1273
|
}
|
|
1037
1274
|
async run(accessor, serverId, opts) {
|
|
1275
|
+
if (isAgentHostMcpServerCommandArg(serverId)) {
|
|
1276
|
+
await getAgentHostMcpServer(accessor, serverId)?.start();
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1038
1279
|
let servers = accessor.get(IMcpService).servers.get();
|
|
1039
1280
|
if (serverId !== "*") {
|
|
1040
1281
|
servers = servers.filter(s => s.definition.id === serverId);
|
|
@@ -1054,12 +1295,16 @@ class StopServer extends Action2 {
|
|
|
1054
1295
|
constructor() {
|
|
1055
1296
|
super({
|
|
1056
1297
|
id: McpCommandIds.StopServer,
|
|
1057
|
-
title: ( localize2(
|
|
1298
|
+
title: ( localize2(13586, "Stop Server")),
|
|
1058
1299
|
category,
|
|
1059
1300
|
f1: false
|
|
1060
1301
|
});
|
|
1061
1302
|
}
|
|
1062
1303
|
async run(accessor, serverId) {
|
|
1304
|
+
if (isAgentHostMcpServerCommandArg(serverId)) {
|
|
1305
|
+
await getAgentHostMcpServer(accessor, serverId)?.stop();
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1063
1308
|
const s = accessor.get(IMcpService).servers.get().find(s => s.definition.id === serverId);
|
|
1064
1309
|
await s?.stop();
|
|
1065
1310
|
}
|
|
@@ -1068,8 +1313,8 @@ class McpBrowseCommand extends Action2 {
|
|
|
1068
1313
|
constructor() {
|
|
1069
1314
|
super({
|
|
1070
1315
|
id: McpCommandIds.Browse,
|
|
1071
|
-
title: ( localize2(
|
|
1072
|
-
tooltip: ( localize2(
|
|
1316
|
+
title: ( localize2(13587, "MCP Servers")),
|
|
1317
|
+
tooltip: ( localize2(13588, "Browse MCP Servers")),
|
|
1073
1318
|
category,
|
|
1074
1319
|
icon: Codicon.search,
|
|
1075
1320
|
precondition: ( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate()))),
|
|
@@ -1092,7 +1337,7 @@ class McpBrowseCommand extends Action2 {
|
|
|
1092
1337
|
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
|
1093
1338
|
command: {
|
|
1094
1339
|
id: McpCommandIds.Browse,
|
|
1095
|
-
title: ( localize2(
|
|
1340
|
+
title: ( localize2(13589, "Browse MCP Servers")),
|
|
1096
1341
|
category,
|
|
1097
1342
|
precondition: ( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate())))
|
|
1098
1343
|
}
|
|
@@ -1101,7 +1346,7 @@ class ShowInstalledMcpServersCommand extends Action2 {
|
|
|
1101
1346
|
constructor() {
|
|
1102
1347
|
super({
|
|
1103
1348
|
id: McpCommandIds.ShowInstalled,
|
|
1104
|
-
title: ( localize2(
|
|
1349
|
+
title: ( localize2(13590, "Show Installed Servers")),
|
|
1105
1350
|
category,
|
|
1106
1351
|
precondition: ( ContextKeyExpr.and(HasInstalledMcpServersContext, ( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate()))),
|
|
1107
1352
|
f1: true
|
|
@@ -1116,15 +1361,6 @@ class ShowInstalledMcpServersCommand extends Action2 {
|
|
|
1116
1361
|
}
|
|
1117
1362
|
}
|
|
1118
1363
|
}
|
|
1119
|
-
MenuRegistry.appendMenuItem(CHAT_CONFIG_MENU_ID, {
|
|
1120
|
-
command: {
|
|
1121
|
-
id: McpCommandIds.ShowInstalled,
|
|
1122
|
-
title: ( localize2(11835, "MCP Servers"))
|
|
1123
|
-
},
|
|
1124
|
-
when: ( ContextKeyExpr.and(ChatContextKeys.enabled, ( ContextKeyExpr.equals("view", ChatViewId)))),
|
|
1125
|
-
order: 10,
|
|
1126
|
-
group: "2_level"
|
|
1127
|
-
});
|
|
1128
1364
|
class OpenMcpResourceCommand extends Action2 {
|
|
1129
1365
|
async run(accessor) {
|
|
1130
1366
|
const fileService = accessor.get(IFileService);
|
|
@@ -1144,7 +1380,7 @@ class OpenUserMcpResourceCommand extends OpenMcpResourceCommand {
|
|
|
1144
1380
|
constructor() {
|
|
1145
1381
|
super({
|
|
1146
1382
|
id: McpCommandIds.OpenUserMcp,
|
|
1147
|
-
title: ( localize2(
|
|
1383
|
+
title: ( localize2(13591, "Open User Configuration")),
|
|
1148
1384
|
category,
|
|
1149
1385
|
f1: true,
|
|
1150
1386
|
precondition: ( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate())))
|
|
@@ -1159,7 +1395,7 @@ class OpenRemoteUserMcpResourceCommand extends OpenMcpResourceCommand {
|
|
|
1159
1395
|
constructor() {
|
|
1160
1396
|
super({
|
|
1161
1397
|
id: McpCommandIds.OpenRemoteUserMcp,
|
|
1162
|
-
title: ( localize2(
|
|
1398
|
+
title: ( localize2(13592, "Open Remote User Configuration")),
|
|
1163
1399
|
category,
|
|
1164
1400
|
f1: true,
|
|
1165
1401
|
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate()))), ( RemoteNameContext.notEqualsTo(""))))
|
|
@@ -1176,7 +1412,7 @@ class OpenWorkspaceFolderMcpResourceCommand extends Action2 {
|
|
|
1176
1412
|
constructor() {
|
|
1177
1413
|
super({
|
|
1178
1414
|
id: McpCommandIds.OpenWorkspaceFolderMcp,
|
|
1179
|
-
title: ( localize2(
|
|
1415
|
+
title: ( localize2(13593, "Open Workspace Folder MCP Configuration")),
|
|
1180
1416
|
category,
|
|
1181
1417
|
f1: true,
|
|
1182
1418
|
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate()))), ( WorkspaceFolderCountContext.notEqualsTo(0))))
|
|
@@ -1199,7 +1435,7 @@ class OpenWorkspaceMcpResourceCommand extends Action2 {
|
|
|
1199
1435
|
constructor() {
|
|
1200
1436
|
super({
|
|
1201
1437
|
id: McpCommandIds.OpenWorkspaceMcp,
|
|
1202
|
-
title: ( localize2(
|
|
1438
|
+
title: ( localize2(13594, "Open Workspace MCP Configuration")),
|
|
1203
1439
|
category,
|
|
1204
1440
|
f1: true,
|
|
1205
1441
|
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate()))), ( WorkbenchStateContext.isEqualTo("workspace"))))
|
|
@@ -1220,7 +1456,7 @@ class McpBrowseResourcesCommand extends Action2 {
|
|
|
1220
1456
|
constructor() {
|
|
1221
1457
|
super({
|
|
1222
1458
|
id: McpCommandIds.BrowseResources,
|
|
1223
|
-
title: ( localize2(
|
|
1459
|
+
title: ( localize2(13595, "Browse Resources...")),
|
|
1224
1460
|
category,
|
|
1225
1461
|
precondition: ( ContextKeyExpr.and(McpContextKeys.serverCount.greater(0), ( ChatContextKeys.Setup.hidden.negate()), ( ChatContextKeys.Setup.disabledInWorkspace.negate()))),
|
|
1226
1462
|
f1: true
|
|
@@ -1238,7 +1474,7 @@ class McpConfigureSamplingModels extends Action2 {
|
|
|
1238
1474
|
constructor() {
|
|
1239
1475
|
super({
|
|
1240
1476
|
id: McpCommandIds.ConfigureSamplingModels,
|
|
1241
|
-
title: ( localize2(
|
|
1477
|
+
title: ( localize2(13596, "Configure SamplingModel")),
|
|
1242
1478
|
category
|
|
1243
1479
|
});
|
|
1244
1480
|
}
|
|
@@ -1264,7 +1500,7 @@ class McpConfigureSamplingModels extends Action2 {
|
|
|
1264
1500
|
);
|
|
1265
1501
|
const picked = await quickInputService.pick(allItems, {
|
|
1266
1502
|
placeHolder: ( localize(
|
|
1267
|
-
|
|
1503
|
+
13597,
|
|
1268
1504
|
"Pick the models {0} can access via MCP sampling",
|
|
1269
1505
|
server.definition.label
|
|
1270
1506
|
)),
|
|
@@ -1280,7 +1516,7 @@ class McpStartPromptingServerCommand extends Action2 {
|
|
|
1280
1516
|
constructor() {
|
|
1281
1517
|
super({
|
|
1282
1518
|
id: McpCommandIds.StartPromptForServer,
|
|
1283
|
-
title: ( localize2(
|
|
1519
|
+
title: ( localize2(13598, "Start Prompting Server")),
|
|
1284
1520
|
category,
|
|
1285
1521
|
f1: false
|
|
1286
1522
|
});
|
|
@@ -1310,7 +1546,7 @@ class McpSkipCurrentAutostartCommand extends Action2 {
|
|
|
1310
1546
|
constructor() {
|
|
1311
1547
|
super({
|
|
1312
1548
|
id: McpCommandIds.SkipCurrentAutostart,
|
|
1313
|
-
title: ( localize2(
|
|
1549
|
+
title: ( localize2(13599, "Skip Current Autostart")),
|
|
1314
1550
|
category,
|
|
1315
1551
|
f1: false
|
|
1316
1552
|
});
|
|
@@ -1320,4 +1556,4 @@ class McpSkipCurrentAutostartCommand extends Action2 {
|
|
|
1320
1556
|
}
|
|
1321
1557
|
}
|
|
1322
1558
|
|
|
1323
|
-
export { AddConfigurationAction, EditStoredInput, InstallFromManifestAction, ListMcpServerCommand, MCPServerActionRendering, McpAgentHostServerOptionsCommand, McpBrowseCommand, McpBrowseResourcesCommand, McpConfigureSamplingModels, McpConfirmationServerOptionsCommand, McpServerOptionsCommand, McpSkipCurrentAutostartCommand, McpStartPromptingServerCommand, OpenRemoteUserMcpResourceCommand, OpenUserMcpResourceCommand, OpenWorkspaceFolderMcpResourceCommand, OpenWorkspaceMcpResourceCommand, RemoveStoredInput, ResetMcpCachedTools, ResetMcpTrustCommand, RestartServer, SetOAuthClientSecret, ShowConfiguration, ShowInstalledMcpServersCommand, ShowOutput, StartServer, StopServer };
|
|
1559
|
+
export { AddConfigurationAction, EditStoredInput, InstallFromManifestAction, ListMcpServerCommand, MCPServerActionRendering, McpAgentHostServerOptionsCommand, McpBrowseCommand, McpBrowseResourcesCommand, McpConfigureSamplingModels, McpConfirmationServerOptionsCommand, McpServerOptionsCommand, McpSkipCurrentAutostartCommand, McpStartPromptingServerCommand, OpenRemoteUserMcpResourceCommand, OpenUserMcpResourceCommand, OpenWorkspaceFolderMcpResourceCommand, OpenWorkspaceMcpResourceCommand, RemoveStoredInput, ResetMcpCachedTools, ResetMcpTrustCommand, RestartServer, SetOAuthClientSecret, ShowConfiguration, ShowInstalledMcpServersCommand, ShowOutput, StartServer, StopServer, findLocalMcpServer };
|