@codingame/monaco-vscode-mcp-service-override 26.2.2 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -2
- package/package.json +2 -2
- package/vscode/src/vs/base/common/jsonRpcProtocol.d.ts +66 -0
- package/vscode/src/vs/base/common/jsonRpcProtocol.js +216 -0
- 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/mcpGateway.d.ts +39 -0
- package/vscode/src/vs/platform/mcp/common/mcpGateway.js +6 -0
- package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.d.ts +2 -1
- package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +12 -6
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +15 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +58 -58
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +27 -28
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayService.js +34 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayToolBrokerContribution.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpGatewayToolBrokerContribution.js +15 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +18 -18
- 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/mcpServersView.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +42 -24
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +13 -12
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +2 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.js +106 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpGatewayToolBrokerChannel.js +202 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +25 -17
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +3 -5
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +27 -32
- 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 +34 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSandboxService.js +233 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +3 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +1 -18
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +88 -142
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +9 -9
- package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.d.ts +1 -1
- package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js +2 -2
- package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.d.ts +0 -42
- package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.js +0 -105
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +0 -130
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +0 -665
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.d.ts +0 -259
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +0 -1225
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +0 -72
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +0 -996
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +0 -49
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +0 -12
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +0 -88
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +0 -464
- package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServerEditor.css +0 -94
- package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.d.ts +0 -87
- package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.js +0 -702
|
@@ -1,1225 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { getDomNodePagePosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
-
import { ActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
5
|
-
import { alert } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
|
|
6
|
-
import { Action, Separator } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
7
|
-
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
8
|
-
import { disposeIfDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
|
-
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
10
|
-
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
11
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
12
|
-
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
13
|
-
import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
|
|
14
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
|
-
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
16
|
-
import { IAuthenticationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
17
|
-
import { IAuthenticationQueryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/authentication/common/authenticationQuery.service';
|
|
18
|
-
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
19
|
-
import { manageExtensionIcon, warningIcon, errorIcon, infoIcon, trustIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/browser/extensionsIcons';
|
|
20
|
-
import { McpCommandIds } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpCommandIds';
|
|
21
|
-
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
22
|
-
import { McpServerInstallState, McpConnectionState, McpServerEditorTab, McpCapability } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
23
|
-
import { IMcpWorkbenchService, IMcpService, IMcpSamplingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
24
|
-
import { startServerByFilter } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypesUtils';
|
|
25
|
-
import { ConfigurationTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
26
|
-
import { WorkbenchState } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
|
|
27
|
-
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
28
|
-
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
29
|
-
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
30
|
-
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
31
|
-
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
32
|
-
import { LocalMcpServerScope } from '../../../services/mcp/common/mcpWorkbenchManagementService.js';
|
|
33
|
-
import { ActionWithDropdownActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/dropdown/dropdownActionViewItem';
|
|
34
|
-
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
35
|
-
|
|
36
|
-
var InstallAction_1, InstallInWorkspaceAction_1, InstallInRemoteAction_1, UninstallAction_1, ManageMcpServerAction_1, StartServerAction_1, StopServerAction_1, RestartServerAction_1, AuthServerAction_1, ShowServerOutputAction_1, ShowServerConfigurationAction_1, ShowServerJsonConfigurationAction_1, ConfigureModelAccessAction_1, ShowSamplingRequestsAction_1, BrowseResourcesAction_1, McpServerStatusAction_1;
|
|
37
|
-
class McpServerAction extends Action {
|
|
38
|
-
constructor() {
|
|
39
|
-
super(...arguments);
|
|
40
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
41
|
-
this._hidden = false;
|
|
42
|
-
this.hideOnDisabled = true;
|
|
43
|
-
this._mcpServer = null;
|
|
44
|
-
}
|
|
45
|
-
get onDidChange() {
|
|
46
|
-
return this._onDidChange.event;
|
|
47
|
-
}
|
|
48
|
-
static {
|
|
49
|
-
this.EXTENSION_ACTION_CLASS = "extension-action";
|
|
50
|
-
}
|
|
51
|
-
static {
|
|
52
|
-
this.TEXT_ACTION_CLASS = `${McpServerAction.EXTENSION_ACTION_CLASS} text`;
|
|
53
|
-
}
|
|
54
|
-
static {
|
|
55
|
-
this.LABEL_ACTION_CLASS = `${McpServerAction.EXTENSION_ACTION_CLASS} label`;
|
|
56
|
-
}
|
|
57
|
-
static {
|
|
58
|
-
this.PROMINENT_LABEL_ACTION_CLASS = `${McpServerAction.LABEL_ACTION_CLASS} prominent`;
|
|
59
|
-
}
|
|
60
|
-
static {
|
|
61
|
-
this.ICON_ACTION_CLASS = `${McpServerAction.EXTENSION_ACTION_CLASS} icon`;
|
|
62
|
-
}
|
|
63
|
-
get hidden() {
|
|
64
|
-
return this._hidden;
|
|
65
|
-
}
|
|
66
|
-
set hidden(hidden) {
|
|
67
|
-
if (this._hidden !== hidden) {
|
|
68
|
-
this._hidden = hidden;
|
|
69
|
-
this._onDidChange.fire({
|
|
70
|
-
hidden
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
_setEnabled(value) {
|
|
75
|
-
super._setEnabled(value);
|
|
76
|
-
if (this.hideOnDisabled) {
|
|
77
|
-
this.hidden = !value;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
get mcpServer() {
|
|
81
|
-
return this._mcpServer;
|
|
82
|
-
}
|
|
83
|
-
set mcpServer(mcpServer) {
|
|
84
|
-
this._mcpServer = mcpServer;
|
|
85
|
-
this.update();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
class ButtonWithDropDownExtensionAction extends McpServerAction {
|
|
89
|
-
get menuActions() {
|
|
90
|
-
return [...this._menuActions];
|
|
91
|
-
}
|
|
92
|
-
get mcpServer() {
|
|
93
|
-
return super.mcpServer;
|
|
94
|
-
}
|
|
95
|
-
set mcpServer(mcpServer) {
|
|
96
|
-
this.actions.forEach(a => a.mcpServer = mcpServer);
|
|
97
|
-
super.mcpServer = mcpServer;
|
|
98
|
-
}
|
|
99
|
-
constructor(id, clazz, actionsGroups) {
|
|
100
|
-
clazz = `${clazz} action-dropdown`;
|
|
101
|
-
super(id, undefined, clazz);
|
|
102
|
-
this.actionsGroups = actionsGroups;
|
|
103
|
-
this.menuActionClassNames = [];
|
|
104
|
-
this._menuActions = [];
|
|
105
|
-
this.menuActionClassNames = clazz.split(" ");
|
|
106
|
-
this.hideOnDisabled = false;
|
|
107
|
-
this.actions = actionsGroups.flat();
|
|
108
|
-
this.update();
|
|
109
|
-
this._register(Event.any(...( this.actions.map(a => a.onDidChange)))(() => this.update(true)));
|
|
110
|
-
this.actions.forEach(a => this._register(a));
|
|
111
|
-
}
|
|
112
|
-
update(donotUpdateActions) {
|
|
113
|
-
if (!donotUpdateActions) {
|
|
114
|
-
this.actions.forEach(a => a.update());
|
|
115
|
-
}
|
|
116
|
-
const actionsGroups = ( this.actionsGroups.map(actionsGroup => actionsGroup.filter(a => !a.hidden)));
|
|
117
|
-
let actions = [];
|
|
118
|
-
for (const visibleActions of actionsGroups) {
|
|
119
|
-
if (visibleActions.length) {
|
|
120
|
-
actions = [...actions, ...visibleActions, ( new Separator())];
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
actions = actions.length ? actions.slice(0, actions.length - 1) : actions;
|
|
124
|
-
this.primaryAction = actions[0];
|
|
125
|
-
this._menuActions = actions.length > 1 ? actions : [];
|
|
126
|
-
this._onDidChange.fire({
|
|
127
|
-
menuActions: this._menuActions
|
|
128
|
-
});
|
|
129
|
-
if (this.primaryAction) {
|
|
130
|
-
this.enabled = this.primaryAction.enabled;
|
|
131
|
-
this.label = this.getLabel(this.primaryAction);
|
|
132
|
-
this.tooltip = this.primaryAction.tooltip;
|
|
133
|
-
} else {
|
|
134
|
-
this.enabled = false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
async run() {
|
|
138
|
-
if (this.enabled) {
|
|
139
|
-
await this.primaryAction?.run();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
getLabel(action) {
|
|
143
|
-
return action.label;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
class ButtonWithDropdownExtensionActionViewItem extends ActionWithDropdownActionViewItem {
|
|
147
|
-
constructor(action, options, contextMenuProvider) {
|
|
148
|
-
super(null, action, options, contextMenuProvider);
|
|
149
|
-
this._register(action.onDidChange(e => {
|
|
150
|
-
if (e.hidden !== undefined || e.menuActions !== undefined) {
|
|
151
|
-
this.updateClass();
|
|
152
|
-
}
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
render(container) {
|
|
156
|
-
super.render(container);
|
|
157
|
-
this.updateClass();
|
|
158
|
-
}
|
|
159
|
-
updateClass() {
|
|
160
|
-
super.updateClass();
|
|
161
|
-
if (this.element && this.dropdownMenuActionViewItem?.element) {
|
|
162
|
-
this.element.classList.toggle("hide", this._action.hidden);
|
|
163
|
-
const isMenuEmpty = this._action.menuActions.length === 0;
|
|
164
|
-
this.element.classList.toggle("empty", isMenuEmpty);
|
|
165
|
-
this.dropdownMenuActionViewItem.element.classList.toggle("hide", isMenuEmpty);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
let DropDownAction = class DropDownAction extends McpServerAction {
|
|
170
|
-
constructor(id, label, cssClass, enabled, instantiationService) {
|
|
171
|
-
super(id, label, cssClass, enabled);
|
|
172
|
-
this.instantiationService = instantiationService;
|
|
173
|
-
this._actionViewItem = null;
|
|
174
|
-
}
|
|
175
|
-
createActionViewItem(options) {
|
|
176
|
-
this._actionViewItem = this.instantiationService.createInstance(DropDownExtensionActionViewItem, this, options);
|
|
177
|
-
return this._actionViewItem;
|
|
178
|
-
}
|
|
179
|
-
run(actionGroups) {
|
|
180
|
-
this._actionViewItem?.showMenu(actionGroups);
|
|
181
|
-
return Promise.resolve();
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
DropDownAction = ( __decorate([( __param(4, IInstantiationService))], DropDownAction));
|
|
185
|
-
let DropDownExtensionActionViewItem = class DropDownExtensionActionViewItem extends ActionViewItem {
|
|
186
|
-
constructor(action, options, contextMenuService) {
|
|
187
|
-
super(null, action, {
|
|
188
|
-
...options,
|
|
189
|
-
icon: true,
|
|
190
|
-
label: true
|
|
191
|
-
});
|
|
192
|
-
this.contextMenuService = contextMenuService;
|
|
193
|
-
}
|
|
194
|
-
showMenu(menuActionGroups) {
|
|
195
|
-
if (this.element) {
|
|
196
|
-
const actions = this.getActions(menuActionGroups);
|
|
197
|
-
const elementPosition = getDomNodePagePosition(this.element);
|
|
198
|
-
const anchor = {
|
|
199
|
-
x: elementPosition.left,
|
|
200
|
-
y: elementPosition.top + elementPosition.height + 10
|
|
201
|
-
};
|
|
202
|
-
this.contextMenuService.showContextMenu({
|
|
203
|
-
getAnchor: () => anchor,
|
|
204
|
-
getActions: () => actions,
|
|
205
|
-
actionRunner: this.actionRunner,
|
|
206
|
-
onHide: () => disposeIfDisposable(actions)
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
getActions(menuActionGroups) {
|
|
211
|
-
let actions = [];
|
|
212
|
-
for (const menuActions of menuActionGroups) {
|
|
213
|
-
actions = [...actions, ...menuActions, ( new Separator())];
|
|
214
|
-
}
|
|
215
|
-
return actions.length ? actions.slice(0, actions.length - 1) : actions;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
DropDownExtensionActionViewItem = ( __decorate([( __param(2, IContextMenuService))], DropDownExtensionActionViewItem));
|
|
219
|
-
let InstallAction = class InstallAction extends McpServerAction {
|
|
220
|
-
static {
|
|
221
|
-
InstallAction_1 = this;
|
|
222
|
-
}
|
|
223
|
-
static {
|
|
224
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent install`;
|
|
225
|
-
}
|
|
226
|
-
static {
|
|
227
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
228
|
-
}
|
|
229
|
-
constructor(open, mcpWorkbenchService, telemetryService, mcpService) {
|
|
230
|
-
super("extensions.install", ( localize(9406, "Install")), InstallAction_1.CLASS, false);
|
|
231
|
-
this.open = open;
|
|
232
|
-
this.mcpWorkbenchService = mcpWorkbenchService;
|
|
233
|
-
this.telemetryService = telemetryService;
|
|
234
|
-
this.mcpService = mcpService;
|
|
235
|
-
this.update();
|
|
236
|
-
}
|
|
237
|
-
update() {
|
|
238
|
-
this.enabled = false;
|
|
239
|
-
this.class = InstallAction_1.HIDE;
|
|
240
|
-
if (!this.mcpServer?.gallery && !this.mcpServer?.installable) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
if (this.mcpServer.installState !== McpServerInstallState.Uninstalled) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
this.class = InstallAction_1.CLASS;
|
|
247
|
-
this.enabled = this.mcpWorkbenchService.canInstall(this.mcpServer) === true;
|
|
248
|
-
}
|
|
249
|
-
async run() {
|
|
250
|
-
if (!this.mcpServer) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
if (this.open) {
|
|
254
|
-
this.mcpWorkbenchService.open(this.mcpServer);
|
|
255
|
-
alert(( localize(
|
|
256
|
-
9407,
|
|
257
|
-
"Installing MCP Server {0} started. An editor is now open with more details on this MCP Server",
|
|
258
|
-
this.mcpServer.label
|
|
259
|
-
)));
|
|
260
|
-
}
|
|
261
|
-
this.telemetryService.publicLog2("mcp:action:install", {
|
|
262
|
-
name: this.mcpServer.gallery?.name
|
|
263
|
-
});
|
|
264
|
-
const installed = await this.mcpWorkbenchService.install(this.mcpServer);
|
|
265
|
-
await startServerByFilter(this.mcpService, s => {
|
|
266
|
-
return s.definition.label === installed.name;
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
InstallAction = InstallAction_1 = ( __decorate([( __param(1, IMcpWorkbenchService)), ( __param(2, ITelemetryService)), ( __param(3, IMcpService))], InstallAction));
|
|
271
|
-
let InstallInWorkspaceAction = class InstallInWorkspaceAction extends McpServerAction {
|
|
272
|
-
static {
|
|
273
|
-
InstallInWorkspaceAction_1 = this;
|
|
274
|
-
}
|
|
275
|
-
static {
|
|
276
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent install`;
|
|
277
|
-
}
|
|
278
|
-
static {
|
|
279
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
280
|
-
}
|
|
281
|
-
constructor(
|
|
282
|
-
open,
|
|
283
|
-
mcpWorkbenchService,
|
|
284
|
-
workspaceService,
|
|
285
|
-
quickInputService,
|
|
286
|
-
telemetryService,
|
|
287
|
-
mcpService
|
|
288
|
-
) {
|
|
289
|
-
super("extensions.installWorkspace", ( localize(9408, "Install in Workspace")), InstallAction.CLASS, false);
|
|
290
|
-
this.open = open;
|
|
291
|
-
this.mcpWorkbenchService = mcpWorkbenchService;
|
|
292
|
-
this.workspaceService = workspaceService;
|
|
293
|
-
this.quickInputService = quickInputService;
|
|
294
|
-
this.telemetryService = telemetryService;
|
|
295
|
-
this.mcpService = mcpService;
|
|
296
|
-
this.update();
|
|
297
|
-
}
|
|
298
|
-
update() {
|
|
299
|
-
this.enabled = false;
|
|
300
|
-
this.class = InstallInWorkspaceAction_1.HIDE;
|
|
301
|
-
if (this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
if (!this.mcpServer?.gallery && !this.mcpServer?.installable) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
if (this.mcpServer.installState !== McpServerInstallState.Uninstalled && this.mcpServer.local?.scope === LocalMcpServerScope.Workspace) {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
this.class = InstallAction.CLASS;
|
|
311
|
-
this.enabled = this.mcpWorkbenchService.canInstall(this.mcpServer) === true;
|
|
312
|
-
}
|
|
313
|
-
async run() {
|
|
314
|
-
if (!this.mcpServer) {
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
if (this.open) {
|
|
318
|
-
this.mcpWorkbenchService.open(this.mcpServer, {
|
|
319
|
-
preserveFocus: true
|
|
320
|
-
});
|
|
321
|
-
alert(( localize(
|
|
322
|
-
9407,
|
|
323
|
-
"Installing MCP Server {0} started. An editor is now open with more details on this MCP Server",
|
|
324
|
-
this.mcpServer.label
|
|
325
|
-
)));
|
|
326
|
-
}
|
|
327
|
-
const target = await this.getConfigurationTarget();
|
|
328
|
-
if (!target) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
this.telemetryService.publicLog2("mcp:action:install:workspace", {
|
|
332
|
-
name: this.mcpServer.gallery?.name
|
|
333
|
-
});
|
|
334
|
-
const installed = await this.mcpWorkbenchService.install(this.mcpServer, {
|
|
335
|
-
target
|
|
336
|
-
});
|
|
337
|
-
await startServerByFilter(this.mcpService, s => {
|
|
338
|
-
return s.definition.label === installed.name;
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
async getConfigurationTarget() {
|
|
342
|
-
const options = [];
|
|
343
|
-
for (const folder of this.workspaceService.getWorkspace().folders) {
|
|
344
|
-
options.push({
|
|
345
|
-
target: folder,
|
|
346
|
-
label: folder.name,
|
|
347
|
-
description: ( localize(9409, "Workspace Folder"))
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
if (this.workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
|
|
351
|
-
if (options.length > 0) {
|
|
352
|
-
options.push({
|
|
353
|
-
type: "separator"
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
options.push({
|
|
357
|
-
target: ConfigurationTarget.WORKSPACE,
|
|
358
|
-
label: ( localize(9410, "Workspace"))
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
if (options.length === 1) {
|
|
362
|
-
return options[0].target;
|
|
363
|
-
}
|
|
364
|
-
const targetPick = await this.quickInputService.pick(options, {
|
|
365
|
-
title: ( localize(9411, "Choose where to install the MCP server"))
|
|
366
|
-
});
|
|
367
|
-
return targetPick?.target;
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
InstallInWorkspaceAction = InstallInWorkspaceAction_1 = ( __decorate([( __param(1, IMcpWorkbenchService)), ( __param(2, IWorkspaceContextService)), ( __param(3, IQuickInputService)), ( __param(4, ITelemetryService)), ( __param(5, IMcpService))], InstallInWorkspaceAction));
|
|
371
|
-
let InstallInRemoteAction = class InstallInRemoteAction extends McpServerAction {
|
|
372
|
-
static {
|
|
373
|
-
InstallInRemoteAction_1 = this;
|
|
374
|
-
}
|
|
375
|
-
static {
|
|
376
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent install`;
|
|
377
|
-
}
|
|
378
|
-
static {
|
|
379
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
380
|
-
}
|
|
381
|
-
constructor(
|
|
382
|
-
open,
|
|
383
|
-
mcpWorkbenchService,
|
|
384
|
-
environmentService,
|
|
385
|
-
telemetryService,
|
|
386
|
-
labelService,
|
|
387
|
-
mcpService
|
|
388
|
-
) {
|
|
389
|
-
super("extensions.installRemote", ( localize(9412, "Install (Remote)")), InstallAction.CLASS, false);
|
|
390
|
-
this.open = open;
|
|
391
|
-
this.mcpWorkbenchService = mcpWorkbenchService;
|
|
392
|
-
this.environmentService = environmentService;
|
|
393
|
-
this.telemetryService = telemetryService;
|
|
394
|
-
this.labelService = labelService;
|
|
395
|
-
this.mcpService = mcpService;
|
|
396
|
-
const remoteLabel = this.labelService.getHostLabel(Schemas.vscodeRemote, this.environmentService.remoteAuthority);
|
|
397
|
-
this.label = ( localize(9413, "Install in {0}", remoteLabel));
|
|
398
|
-
this.update();
|
|
399
|
-
}
|
|
400
|
-
update() {
|
|
401
|
-
this.enabled = false;
|
|
402
|
-
this.class = InstallInRemoteAction_1.HIDE;
|
|
403
|
-
if (!this.environmentService.remoteAuthority) {
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
if (!this.mcpServer?.gallery && !this.mcpServer?.installable) {
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
if (this.mcpServer.installState !== McpServerInstallState.Uninstalled) {
|
|
410
|
-
if (this.mcpServer.local?.scope === LocalMcpServerScope.RemoteUser) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
if (this.mcpWorkbenchService.local.find(
|
|
414
|
-
mcpServer => mcpServer.name === this.mcpServer?.name && mcpServer.local?.scope === LocalMcpServerScope.RemoteUser
|
|
415
|
-
)) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
this.class = InstallAction.CLASS;
|
|
420
|
-
this.enabled = this.mcpWorkbenchService.canInstall(this.mcpServer) === true;
|
|
421
|
-
}
|
|
422
|
-
async run() {
|
|
423
|
-
if (!this.mcpServer) {
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
if (this.open) {
|
|
427
|
-
this.mcpWorkbenchService.open(this.mcpServer);
|
|
428
|
-
alert(( localize(
|
|
429
|
-
9407,
|
|
430
|
-
"Installing MCP Server {0} started. An editor is now open with more details on this MCP Server",
|
|
431
|
-
this.mcpServer.label
|
|
432
|
-
)));
|
|
433
|
-
}
|
|
434
|
-
this.telemetryService.publicLog2("mcp:action:install:remote", {
|
|
435
|
-
name: this.mcpServer.gallery?.name
|
|
436
|
-
});
|
|
437
|
-
const installed = await this.mcpWorkbenchService.install(this.mcpServer, {
|
|
438
|
-
target: ConfigurationTarget.USER_REMOTE
|
|
439
|
-
});
|
|
440
|
-
await startServerByFilter(this.mcpService, s => {
|
|
441
|
-
return s.definition.label === installed.name;
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
InstallInRemoteAction = InstallInRemoteAction_1 = ( __decorate([( __param(1, IMcpWorkbenchService)), ( __param(2, IWorkbenchEnvironmentService)), ( __param(3, ITelemetryService)), ( __param(4, ILabelService)), ( __param(5, IMcpService))], InstallInRemoteAction));
|
|
446
|
-
class InstallingLabelAction extends McpServerAction {
|
|
447
|
-
static {
|
|
448
|
-
this.LABEL = ( localize(9414, "Installing"));
|
|
449
|
-
}
|
|
450
|
-
static {
|
|
451
|
-
this.CLASS = `${McpServerAction.LABEL_ACTION_CLASS} install installing`;
|
|
452
|
-
}
|
|
453
|
-
constructor() {
|
|
454
|
-
super(
|
|
455
|
-
"extension.installing",
|
|
456
|
-
InstallingLabelAction.LABEL,
|
|
457
|
-
InstallingLabelAction.CLASS,
|
|
458
|
-
false
|
|
459
|
-
);
|
|
460
|
-
}
|
|
461
|
-
update() {
|
|
462
|
-
this.class = `${InstallingLabelAction.CLASS}${this.mcpServer && this.mcpServer.installState === McpServerInstallState.Installing ? "" : " hide"}`;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
let UninstallAction = class UninstallAction extends McpServerAction {
|
|
466
|
-
static {
|
|
467
|
-
UninstallAction_1 = this;
|
|
468
|
-
}
|
|
469
|
-
static {
|
|
470
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent uninstall`;
|
|
471
|
-
}
|
|
472
|
-
static {
|
|
473
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
474
|
-
}
|
|
475
|
-
constructor(mcpWorkbenchService) {
|
|
476
|
-
super("extensions.uninstall", ( localize(9415, "Uninstall")), UninstallAction_1.CLASS, false);
|
|
477
|
-
this.mcpWorkbenchService = mcpWorkbenchService;
|
|
478
|
-
this.update();
|
|
479
|
-
}
|
|
480
|
-
update() {
|
|
481
|
-
this.enabled = false;
|
|
482
|
-
this.class = UninstallAction_1.HIDE;
|
|
483
|
-
if (!this.mcpServer) {
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
if (!this.mcpServer.local) {
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
if (this.mcpServer.installState !== McpServerInstallState.Installed) {
|
|
490
|
-
this.enabled = false;
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
this.class = UninstallAction_1.CLASS;
|
|
494
|
-
this.enabled = true;
|
|
495
|
-
this.label = ( localize(9415, "Uninstall"));
|
|
496
|
-
}
|
|
497
|
-
async run() {
|
|
498
|
-
if (!this.mcpServer) {
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
await this.mcpWorkbenchService.uninstall(this.mcpServer);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
UninstallAction = UninstallAction_1 = ( __decorate([( __param(0, IMcpWorkbenchService))], UninstallAction));
|
|
505
|
-
function getContextMenuActions(mcpServer, isEditorAction, instantiationService) {
|
|
506
|
-
return instantiationService.invokeFunction(accessor => {
|
|
507
|
-
const workspaceService = accessor.get(IWorkspaceContextService);
|
|
508
|
-
const environmentService = accessor.get(IWorkbenchEnvironmentService);
|
|
509
|
-
const groups = [];
|
|
510
|
-
const isInstalled = mcpServer.installState === McpServerInstallState.Installed;
|
|
511
|
-
if (isInstalled) {
|
|
512
|
-
groups.push([instantiationService.createInstance(StartServerAction)]);
|
|
513
|
-
groups.push([
|
|
514
|
-
instantiationService.createInstance(StopServerAction),
|
|
515
|
-
instantiationService.createInstance(RestartServerAction)
|
|
516
|
-
]);
|
|
517
|
-
groups.push([instantiationService.createInstance(AuthServerAction)]);
|
|
518
|
-
groups.push([
|
|
519
|
-
instantiationService.createInstance(ShowServerOutputAction),
|
|
520
|
-
instantiationService.createInstance(ShowServerConfigurationAction),
|
|
521
|
-
instantiationService.createInstance(ShowServerJsonConfigurationAction)
|
|
522
|
-
]);
|
|
523
|
-
groups.push([
|
|
524
|
-
instantiationService.createInstance(ConfigureModelAccessAction),
|
|
525
|
-
instantiationService.createInstance(ShowSamplingRequestsAction)
|
|
526
|
-
]);
|
|
527
|
-
groups.push([instantiationService.createInstance(BrowseResourcesAction)]);
|
|
528
|
-
if (!isEditorAction) {
|
|
529
|
-
const installGroup = [instantiationService.createInstance(UninstallAction)];
|
|
530
|
-
if (workspaceService.getWorkbenchState() !== WorkbenchState.EMPTY) {
|
|
531
|
-
installGroup.push(instantiationService.createInstance(InstallInWorkspaceAction, false));
|
|
532
|
-
}
|
|
533
|
-
if (environmentService.remoteAuthority && mcpServer.local?.scope !== LocalMcpServerScope.RemoteUser) {
|
|
534
|
-
installGroup.push(instantiationService.createInstance(InstallInRemoteAction, false));
|
|
535
|
-
}
|
|
536
|
-
groups.push(installGroup);
|
|
537
|
-
}
|
|
538
|
-
} else {
|
|
539
|
-
const installGroup = [];
|
|
540
|
-
if (workspaceService.getWorkbenchState() !== WorkbenchState.EMPTY) {
|
|
541
|
-
installGroup.push(
|
|
542
|
-
instantiationService.createInstance(InstallInWorkspaceAction, !isEditorAction)
|
|
543
|
-
);
|
|
544
|
-
}
|
|
545
|
-
if (environmentService.remoteAuthority) {
|
|
546
|
-
installGroup.push(
|
|
547
|
-
instantiationService.createInstance(InstallInRemoteAction, !isEditorAction)
|
|
548
|
-
);
|
|
549
|
-
}
|
|
550
|
-
groups.push(installGroup);
|
|
551
|
-
}
|
|
552
|
-
groups.forEach(
|
|
553
|
-
group => group.forEach(extensionAction => extensionAction.mcpServer = mcpServer)
|
|
554
|
-
);
|
|
555
|
-
return groups;
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
let ManageMcpServerAction = class ManageMcpServerAction extends DropDownAction {
|
|
559
|
-
static {
|
|
560
|
-
ManageMcpServerAction_1 = this;
|
|
561
|
-
}
|
|
562
|
-
static {
|
|
563
|
-
this.ID = "mcpServer.manage";
|
|
564
|
-
}
|
|
565
|
-
static {
|
|
566
|
-
this.Class = `${McpServerAction.ICON_ACTION_CLASS} manage ` + ThemeIcon.asClassName(manageExtensionIcon);
|
|
567
|
-
}
|
|
568
|
-
static {
|
|
569
|
-
this.HideManageExtensionClass = `${this.Class} hide`;
|
|
570
|
-
}
|
|
571
|
-
constructor(isEditorAction, instantiationService) {
|
|
572
|
-
super(ManageMcpServerAction_1.ID, "", "", true, instantiationService);
|
|
573
|
-
this.isEditorAction = isEditorAction;
|
|
574
|
-
this.tooltip = ( localize(9416, "Manage"));
|
|
575
|
-
this.update();
|
|
576
|
-
}
|
|
577
|
-
async run() {
|
|
578
|
-
return super.run(
|
|
579
|
-
this.mcpServer ? getContextMenuActions(this.mcpServer, this.isEditorAction, this.instantiationService) : []
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
update() {
|
|
583
|
-
this.class = ManageMcpServerAction_1.HideManageExtensionClass;
|
|
584
|
-
this.enabled = false;
|
|
585
|
-
if (!this.mcpServer) {
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
if (this.isEditorAction) {
|
|
589
|
-
this.enabled = true;
|
|
590
|
-
this.class = ManageMcpServerAction_1.Class;
|
|
591
|
-
} else {
|
|
592
|
-
this.enabled = !!this.mcpServer.local;
|
|
593
|
-
this.class = this.enabled ? ManageMcpServerAction_1.Class : ManageMcpServerAction_1.HideManageExtensionClass;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
ManageMcpServerAction = ManageMcpServerAction_1 = ( __decorate([( __param(1, IInstantiationService))], ManageMcpServerAction));
|
|
598
|
-
let StartServerAction = class StartServerAction extends McpServerAction {
|
|
599
|
-
static {
|
|
600
|
-
StartServerAction_1 = this;
|
|
601
|
-
}
|
|
602
|
-
static {
|
|
603
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent start`;
|
|
604
|
-
}
|
|
605
|
-
static {
|
|
606
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
607
|
-
}
|
|
608
|
-
constructor(mcpService) {
|
|
609
|
-
super("extensions.start", ( localize(9417, "Start Server")), StartServerAction_1.CLASS, false);
|
|
610
|
-
this.mcpService = mcpService;
|
|
611
|
-
this.update();
|
|
612
|
-
}
|
|
613
|
-
update() {
|
|
614
|
-
this.enabled = false;
|
|
615
|
-
this.class = StartServerAction_1.HIDE;
|
|
616
|
-
const server = this.getServer();
|
|
617
|
-
if (!server) {
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
const serverState = server.connectionState.get();
|
|
621
|
-
if (!McpConnectionState.canBeStarted(serverState.state)) {
|
|
622
|
-
return;
|
|
623
|
-
}
|
|
624
|
-
this.class = StartServerAction_1.CLASS;
|
|
625
|
-
this.enabled = true;
|
|
626
|
-
this.label = ( localize(9417, "Start Server"));
|
|
627
|
-
}
|
|
628
|
-
async run() {
|
|
629
|
-
const server = this.getServer();
|
|
630
|
-
if (!server) {
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
await server.start({
|
|
634
|
-
promptType: "all-untrusted"
|
|
635
|
-
});
|
|
636
|
-
server.showOutput();
|
|
637
|
-
}
|
|
638
|
-
getServer() {
|
|
639
|
-
if (!this.mcpServer) {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
if (!this.mcpServer.local) {
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
StartServerAction = StartServerAction_1 = ( __decorate([( __param(0, IMcpService))], StartServerAction));
|
|
649
|
-
let StopServerAction = class StopServerAction extends McpServerAction {
|
|
650
|
-
static {
|
|
651
|
-
StopServerAction_1 = this;
|
|
652
|
-
}
|
|
653
|
-
static {
|
|
654
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent stop`;
|
|
655
|
-
}
|
|
656
|
-
static {
|
|
657
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
658
|
-
}
|
|
659
|
-
constructor(mcpService) {
|
|
660
|
-
super("extensions.stop", ( localize(9418, "Stop Server")), StopServerAction_1.CLASS, false);
|
|
661
|
-
this.mcpService = mcpService;
|
|
662
|
-
this.update();
|
|
663
|
-
}
|
|
664
|
-
update() {
|
|
665
|
-
this.enabled = false;
|
|
666
|
-
this.class = StopServerAction_1.HIDE;
|
|
667
|
-
const server = this.getServer();
|
|
668
|
-
if (!server) {
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
const serverState = server.connectionState.get();
|
|
672
|
-
if (McpConnectionState.canBeStarted(serverState.state)) {
|
|
673
|
-
return;
|
|
674
|
-
}
|
|
675
|
-
this.class = StopServerAction_1.CLASS;
|
|
676
|
-
this.enabled = true;
|
|
677
|
-
this.label = ( localize(9418, "Stop Server"));
|
|
678
|
-
}
|
|
679
|
-
async run() {
|
|
680
|
-
const server = this.getServer();
|
|
681
|
-
if (!server) {
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
await server.stop();
|
|
685
|
-
}
|
|
686
|
-
getServer() {
|
|
687
|
-
if (!this.mcpServer) {
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
if (!this.mcpServer.local) {
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
StopServerAction = StopServerAction_1 = ( __decorate([( __param(0, IMcpService))], StopServerAction));
|
|
697
|
-
let RestartServerAction = class RestartServerAction extends McpServerAction {
|
|
698
|
-
static {
|
|
699
|
-
RestartServerAction_1 = this;
|
|
700
|
-
}
|
|
701
|
-
static {
|
|
702
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent restart`;
|
|
703
|
-
}
|
|
704
|
-
static {
|
|
705
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
706
|
-
}
|
|
707
|
-
constructor(mcpService) {
|
|
708
|
-
super("extensions.restart", ( localize(9419, "Restart Server")), RestartServerAction_1.CLASS, false);
|
|
709
|
-
this.mcpService = mcpService;
|
|
710
|
-
this.update();
|
|
711
|
-
}
|
|
712
|
-
update() {
|
|
713
|
-
this.enabled = false;
|
|
714
|
-
this.class = RestartServerAction_1.HIDE;
|
|
715
|
-
const server = this.getServer();
|
|
716
|
-
if (!server) {
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
const serverState = server.connectionState.get();
|
|
720
|
-
if (McpConnectionState.canBeStarted(serverState.state)) {
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
this.class = RestartServerAction_1.CLASS;
|
|
724
|
-
this.enabled = true;
|
|
725
|
-
this.label = ( localize(9419, "Restart Server"));
|
|
726
|
-
}
|
|
727
|
-
async run() {
|
|
728
|
-
const server = this.getServer();
|
|
729
|
-
if (!server) {
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
await server.stop();
|
|
733
|
-
await server.start({
|
|
734
|
-
promptType: "all-untrusted"
|
|
735
|
-
});
|
|
736
|
-
server.showOutput();
|
|
737
|
-
}
|
|
738
|
-
getServer() {
|
|
739
|
-
if (!this.mcpServer) {
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
if (!this.mcpServer.local) {
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
RestartServerAction = RestartServerAction_1 = ( __decorate([( __param(0, IMcpService))], RestartServerAction));
|
|
749
|
-
let AuthServerAction = class AuthServerAction extends McpServerAction {
|
|
750
|
-
static {
|
|
751
|
-
AuthServerAction_1 = this;
|
|
752
|
-
}
|
|
753
|
-
static {
|
|
754
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent account`;
|
|
755
|
-
}
|
|
756
|
-
static {
|
|
757
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
758
|
-
}
|
|
759
|
-
static {
|
|
760
|
-
this.SIGN_OUT = ( localize(9420, "Sign Out"));
|
|
761
|
-
}
|
|
762
|
-
static {
|
|
763
|
-
this.DISCONNECT = ( localize(9421, "Disconnect Account"));
|
|
764
|
-
}
|
|
765
|
-
constructor(mcpService, _authenticationQueryService, _authenticationService) {
|
|
766
|
-
super("extensions.restart", ( localize(9419, "Restart Server")), RestartServerAction.CLASS, false);
|
|
767
|
-
this.mcpService = mcpService;
|
|
768
|
-
this._authenticationQueryService = _authenticationQueryService;
|
|
769
|
-
this._authenticationService = _authenticationService;
|
|
770
|
-
this.update();
|
|
771
|
-
}
|
|
772
|
-
update() {
|
|
773
|
-
this.enabled = false;
|
|
774
|
-
this.class = AuthServerAction_1.HIDE;
|
|
775
|
-
const server = this.getServer();
|
|
776
|
-
if (!server) {
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
779
|
-
const accountQuery = this.getAccountQuery();
|
|
780
|
-
if (!accountQuery) {
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
this._accountQuery = accountQuery;
|
|
784
|
-
this.class = AuthServerAction_1.CLASS;
|
|
785
|
-
this.enabled = true;
|
|
786
|
-
let label = accountQuery.entities().getEntityCount().total > 1 ? AuthServerAction_1.DISCONNECT : AuthServerAction_1.SIGN_OUT;
|
|
787
|
-
label += ` (${accountQuery.accountName})`;
|
|
788
|
-
this.label = label;
|
|
789
|
-
}
|
|
790
|
-
async run() {
|
|
791
|
-
const server = this.getServer();
|
|
792
|
-
if (!server) {
|
|
793
|
-
return;
|
|
794
|
-
}
|
|
795
|
-
const accountQuery = this.getAccountQuery();
|
|
796
|
-
if (!accountQuery) {
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
await server.stop();
|
|
800
|
-
const {
|
|
801
|
-
providerId,
|
|
802
|
-
accountName
|
|
803
|
-
} = accountQuery;
|
|
804
|
-
accountQuery.mcpServer(server.definition.id).setAccessAllowed(false, server.definition.label);
|
|
805
|
-
if (this.label === AuthServerAction_1.SIGN_OUT) {
|
|
806
|
-
const accounts = await this._authenticationService.getAccounts(providerId);
|
|
807
|
-
const account = accounts.find(a => a.label === accountName);
|
|
808
|
-
if (account) {
|
|
809
|
-
const sessions = await this._authenticationService.getSessions(providerId, undefined, {
|
|
810
|
-
account
|
|
811
|
-
});
|
|
812
|
-
for (const session of sessions) {
|
|
813
|
-
await this._authenticationService.removeSession(providerId, session.id);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
getServer() {
|
|
819
|
-
if (!this.mcpServer) {
|
|
820
|
-
return;
|
|
821
|
-
}
|
|
822
|
-
if (!this.mcpServer.local) {
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
826
|
-
}
|
|
827
|
-
getAccountQuery() {
|
|
828
|
-
const server = this.getServer();
|
|
829
|
-
if (!server) {
|
|
830
|
-
return undefined;
|
|
831
|
-
}
|
|
832
|
-
if (this._accountQuery) {
|
|
833
|
-
return this._accountQuery;
|
|
834
|
-
}
|
|
835
|
-
const serverId = server.definition.id;
|
|
836
|
-
const preferences = this._authenticationQueryService.mcpServer(serverId).getAllAccountPreferences();
|
|
837
|
-
if (!preferences.size) {
|
|
838
|
-
return undefined;
|
|
839
|
-
}
|
|
840
|
-
for (const [providerId, accountName] of preferences) {
|
|
841
|
-
const accountQuery = this._authenticationQueryService.provider(providerId).account(accountName);
|
|
842
|
-
if (!accountQuery.mcpServer(serverId).isAccessAllowed()) {
|
|
843
|
-
continue;
|
|
844
|
-
}
|
|
845
|
-
return accountQuery;
|
|
846
|
-
}
|
|
847
|
-
return undefined;
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
AuthServerAction = AuthServerAction_1 = ( __decorate([( __param(0, IMcpService)), ( __param(1, IAuthenticationQueryService)), ( __param(2, IAuthenticationService))], AuthServerAction));
|
|
851
|
-
let ShowServerOutputAction = class ShowServerOutputAction extends McpServerAction {
|
|
852
|
-
static {
|
|
853
|
-
ShowServerOutputAction_1 = this;
|
|
854
|
-
}
|
|
855
|
-
static {
|
|
856
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent output`;
|
|
857
|
-
}
|
|
858
|
-
static {
|
|
859
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
860
|
-
}
|
|
861
|
-
constructor(mcpService) {
|
|
862
|
-
super("extensions.output", ( localize(9422, "Show Output")), ShowServerOutputAction_1.CLASS, false);
|
|
863
|
-
this.mcpService = mcpService;
|
|
864
|
-
this.update();
|
|
865
|
-
}
|
|
866
|
-
update() {
|
|
867
|
-
this.enabled = false;
|
|
868
|
-
this.class = ShowServerOutputAction_1.HIDE;
|
|
869
|
-
const server = this.getServer();
|
|
870
|
-
if (!server) {
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
this.class = ShowServerOutputAction_1.CLASS;
|
|
874
|
-
this.enabled = true;
|
|
875
|
-
this.label = ( localize(9422, "Show Output"));
|
|
876
|
-
}
|
|
877
|
-
async run() {
|
|
878
|
-
const server = this.getServer();
|
|
879
|
-
if (!server) {
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
server.showOutput();
|
|
883
|
-
}
|
|
884
|
-
getServer() {
|
|
885
|
-
if (!this.mcpServer) {
|
|
886
|
-
return;
|
|
887
|
-
}
|
|
888
|
-
if (!this.mcpServer.local) {
|
|
889
|
-
return;
|
|
890
|
-
}
|
|
891
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
892
|
-
}
|
|
893
|
-
};
|
|
894
|
-
ShowServerOutputAction = ShowServerOutputAction_1 = ( __decorate([( __param(0, IMcpService))], ShowServerOutputAction));
|
|
895
|
-
let ShowServerConfigurationAction = class ShowServerConfigurationAction extends McpServerAction {
|
|
896
|
-
static {
|
|
897
|
-
ShowServerConfigurationAction_1 = this;
|
|
898
|
-
}
|
|
899
|
-
static {
|
|
900
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent config`;
|
|
901
|
-
}
|
|
902
|
-
static {
|
|
903
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
904
|
-
}
|
|
905
|
-
constructor(mcpWorkbenchService) {
|
|
906
|
-
super("extensions.config", ( localize(9423, "Show Configuration")), ShowServerConfigurationAction_1.CLASS, false);
|
|
907
|
-
this.mcpWorkbenchService = mcpWorkbenchService;
|
|
908
|
-
this.update();
|
|
909
|
-
}
|
|
910
|
-
update() {
|
|
911
|
-
this.enabled = false;
|
|
912
|
-
this.class = ShowServerConfigurationAction_1.HIDE;
|
|
913
|
-
if (!this.mcpServer?.local) {
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
this.class = ShowServerConfigurationAction_1.CLASS;
|
|
917
|
-
this.enabled = true;
|
|
918
|
-
}
|
|
919
|
-
async run() {
|
|
920
|
-
if (!this.mcpServer?.local) {
|
|
921
|
-
return;
|
|
922
|
-
}
|
|
923
|
-
this.mcpWorkbenchService.open(this.mcpServer, {
|
|
924
|
-
tab: McpServerEditorTab.Configuration
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
ShowServerConfigurationAction = ShowServerConfigurationAction_1 = ( __decorate([( __param(0, IMcpWorkbenchService))], ShowServerConfigurationAction));
|
|
929
|
-
let ShowServerJsonConfigurationAction = class ShowServerJsonConfigurationAction extends McpServerAction {
|
|
930
|
-
static {
|
|
931
|
-
ShowServerJsonConfigurationAction_1 = this;
|
|
932
|
-
}
|
|
933
|
-
static {
|
|
934
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent config`;
|
|
935
|
-
}
|
|
936
|
-
static {
|
|
937
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
938
|
-
}
|
|
939
|
-
constructor(mcpService, mcpRegistry, editorService) {
|
|
940
|
-
super("extensions.jsonConfig", ( localize(9424, "Show Configuration (JSON)")), ShowServerJsonConfigurationAction_1.CLASS, false);
|
|
941
|
-
this.mcpService = mcpService;
|
|
942
|
-
this.mcpRegistry = mcpRegistry;
|
|
943
|
-
this.editorService = editorService;
|
|
944
|
-
this.update();
|
|
945
|
-
}
|
|
946
|
-
update() {
|
|
947
|
-
this.enabled = false;
|
|
948
|
-
this.class = ShowServerJsonConfigurationAction_1.HIDE;
|
|
949
|
-
const configurationTarget = this.getConfigurationTarget();
|
|
950
|
-
if (!configurationTarget) {
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
this.class = ShowServerConfigurationAction.CLASS;
|
|
954
|
-
this.enabled = true;
|
|
955
|
-
}
|
|
956
|
-
async run() {
|
|
957
|
-
const configurationTarget = this.getConfigurationTarget();
|
|
958
|
-
if (!configurationTarget) {
|
|
959
|
-
return;
|
|
960
|
-
}
|
|
961
|
-
this.editorService.openEditor({
|
|
962
|
-
resource: URI.isUri(configurationTarget) ? configurationTarget : configurationTarget.uri,
|
|
963
|
-
options: {
|
|
964
|
-
selection: URI.isUri(configurationTarget) ? undefined : configurationTarget.range
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
getConfigurationTarget() {
|
|
969
|
-
if (!this.mcpServer) {
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
if (!this.mcpServer.local) {
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
const server = this.mcpService.servers.get().find(s => s.definition.label === this.mcpServer?.name);
|
|
976
|
-
if (!server) {
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
const collection = this.mcpRegistry.collections.get().find(c => c.id === server.collection.id);
|
|
980
|
-
const serverDefinition = collection?.serverDefinitions.get().find(s => s.id === server.definition.id);
|
|
981
|
-
return serverDefinition?.presentation?.origin || collection?.presentation?.origin;
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
ShowServerJsonConfigurationAction = ShowServerJsonConfigurationAction_1 = ( __decorate([( __param(0, IMcpService)), ( __param(1, IMcpRegistry)), ( __param(2, IEditorService))], ShowServerJsonConfigurationAction));
|
|
985
|
-
let ConfigureModelAccessAction = class ConfigureModelAccessAction extends McpServerAction {
|
|
986
|
-
static {
|
|
987
|
-
ConfigureModelAccessAction_1 = this;
|
|
988
|
-
}
|
|
989
|
-
static {
|
|
990
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent config`;
|
|
991
|
-
}
|
|
992
|
-
static {
|
|
993
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
994
|
-
}
|
|
995
|
-
constructor(mcpService, commandService) {
|
|
996
|
-
super("extensions.config", ( localize(9425, "Configure Model Access")), ConfigureModelAccessAction_1.CLASS, false);
|
|
997
|
-
this.mcpService = mcpService;
|
|
998
|
-
this.commandService = commandService;
|
|
999
|
-
this.update();
|
|
1000
|
-
}
|
|
1001
|
-
update() {
|
|
1002
|
-
this.enabled = false;
|
|
1003
|
-
this.class = ConfigureModelAccessAction_1.HIDE;
|
|
1004
|
-
const server = this.getServer();
|
|
1005
|
-
if (!server) {
|
|
1006
|
-
return;
|
|
1007
|
-
}
|
|
1008
|
-
this.class = ConfigureModelAccessAction_1.CLASS;
|
|
1009
|
-
this.enabled = true;
|
|
1010
|
-
this.label = ( localize(9425, "Configure Model Access"));
|
|
1011
|
-
}
|
|
1012
|
-
async run() {
|
|
1013
|
-
const server = this.getServer();
|
|
1014
|
-
if (!server) {
|
|
1015
|
-
return;
|
|
1016
|
-
}
|
|
1017
|
-
this.commandService.executeCommand(McpCommandIds.ConfigureSamplingModels, server);
|
|
1018
|
-
}
|
|
1019
|
-
getServer() {
|
|
1020
|
-
if (!this.mcpServer) {
|
|
1021
|
-
return;
|
|
1022
|
-
}
|
|
1023
|
-
if (!this.mcpServer.local) {
|
|
1024
|
-
return;
|
|
1025
|
-
}
|
|
1026
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
ConfigureModelAccessAction = ConfigureModelAccessAction_1 = ( __decorate([( __param(0, IMcpService)), ( __param(1, ICommandService))], ConfigureModelAccessAction));
|
|
1030
|
-
let ShowSamplingRequestsAction = class ShowSamplingRequestsAction extends McpServerAction {
|
|
1031
|
-
static {
|
|
1032
|
-
ShowSamplingRequestsAction_1 = this;
|
|
1033
|
-
}
|
|
1034
|
-
static {
|
|
1035
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent config`;
|
|
1036
|
-
}
|
|
1037
|
-
static {
|
|
1038
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
1039
|
-
}
|
|
1040
|
-
constructor(mcpService, samplingService, editorService) {
|
|
1041
|
-
super("extensions.config", ( localize(9426, "Show Sampling Requests")), ShowSamplingRequestsAction_1.CLASS, false);
|
|
1042
|
-
this.mcpService = mcpService;
|
|
1043
|
-
this.samplingService = samplingService;
|
|
1044
|
-
this.editorService = editorService;
|
|
1045
|
-
this.update();
|
|
1046
|
-
}
|
|
1047
|
-
update() {
|
|
1048
|
-
this.enabled = false;
|
|
1049
|
-
this.class = ShowSamplingRequestsAction_1.HIDE;
|
|
1050
|
-
const server = this.getServer();
|
|
1051
|
-
if (!server) {
|
|
1052
|
-
return;
|
|
1053
|
-
}
|
|
1054
|
-
if (!this.samplingService.hasLogs(server)) {
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
this.class = ShowSamplingRequestsAction_1.CLASS;
|
|
1058
|
-
this.enabled = true;
|
|
1059
|
-
}
|
|
1060
|
-
async run() {
|
|
1061
|
-
const server = this.getServer();
|
|
1062
|
-
if (!server) {
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
if (!this.samplingService.hasLogs(server)) {
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
this.editorService.openEditor({
|
|
1069
|
-
resource: undefined,
|
|
1070
|
-
contents: this.samplingService.getLogText(server),
|
|
1071
|
-
label: ( localize(9427, "MCP Sampling: {0}", server.definition.label))
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
getServer() {
|
|
1075
|
-
if (!this.mcpServer) {
|
|
1076
|
-
return;
|
|
1077
|
-
}
|
|
1078
|
-
if (!this.mcpServer.local) {
|
|
1079
|
-
return;
|
|
1080
|
-
}
|
|
1081
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
1082
|
-
}
|
|
1083
|
-
};
|
|
1084
|
-
ShowSamplingRequestsAction = ShowSamplingRequestsAction_1 = ( __decorate([( __param(0, IMcpService)), ( __param(1, IMcpSamplingService)), ( __param(2, IEditorService))], ShowSamplingRequestsAction));
|
|
1085
|
-
let BrowseResourcesAction = class BrowseResourcesAction extends McpServerAction {
|
|
1086
|
-
static {
|
|
1087
|
-
BrowseResourcesAction_1 = this;
|
|
1088
|
-
}
|
|
1089
|
-
static {
|
|
1090
|
-
this.CLASS = `${this.LABEL_ACTION_CLASS} prominent config`;
|
|
1091
|
-
}
|
|
1092
|
-
static {
|
|
1093
|
-
this.HIDE = `${this.CLASS} hide`;
|
|
1094
|
-
}
|
|
1095
|
-
constructor(mcpService, commandService) {
|
|
1096
|
-
super("extensions.config", ( localize(9428, "Browse Resources")), BrowseResourcesAction_1.CLASS, false);
|
|
1097
|
-
this.mcpService = mcpService;
|
|
1098
|
-
this.commandService = commandService;
|
|
1099
|
-
this.update();
|
|
1100
|
-
}
|
|
1101
|
-
update() {
|
|
1102
|
-
this.enabled = false;
|
|
1103
|
-
this.class = BrowseResourcesAction_1.HIDE;
|
|
1104
|
-
const server = this.getServer();
|
|
1105
|
-
if (!server) {
|
|
1106
|
-
return;
|
|
1107
|
-
}
|
|
1108
|
-
const capabilities = server.capabilities.get();
|
|
1109
|
-
if (capabilities !== undefined && !(capabilities & McpCapability.Resources)) {
|
|
1110
|
-
return;
|
|
1111
|
-
}
|
|
1112
|
-
this.class = BrowseResourcesAction_1.CLASS;
|
|
1113
|
-
this.enabled = true;
|
|
1114
|
-
}
|
|
1115
|
-
async run() {
|
|
1116
|
-
const server = this.getServer();
|
|
1117
|
-
if (!server) {
|
|
1118
|
-
return;
|
|
1119
|
-
}
|
|
1120
|
-
const capabilities = server.capabilities.get();
|
|
1121
|
-
if (capabilities !== undefined && !(capabilities & McpCapability.Resources)) {
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
return this.commandService.executeCommand(McpCommandIds.BrowseResources, server);
|
|
1125
|
-
}
|
|
1126
|
-
getServer() {
|
|
1127
|
-
if (!this.mcpServer) {
|
|
1128
|
-
return;
|
|
1129
|
-
}
|
|
1130
|
-
if (!this.mcpServer.local) {
|
|
1131
|
-
return;
|
|
1132
|
-
}
|
|
1133
|
-
return this.mcpService.servers.get().find(s => s.definition.id === this.mcpServer?.id);
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
BrowseResourcesAction = BrowseResourcesAction_1 = ( __decorate([( __param(0, IMcpService)), ( __param(1, ICommandService))], BrowseResourcesAction));
|
|
1137
|
-
let McpServerStatusAction = class McpServerStatusAction extends McpServerAction {
|
|
1138
|
-
static {
|
|
1139
|
-
McpServerStatusAction_1 = this;
|
|
1140
|
-
}
|
|
1141
|
-
static {
|
|
1142
|
-
this.CLASS = `${McpServerAction.ICON_ACTION_CLASS} extension-status`;
|
|
1143
|
-
}
|
|
1144
|
-
get status() {
|
|
1145
|
-
return this._status;
|
|
1146
|
-
}
|
|
1147
|
-
constructor(mcpWorkbenchService, commandService) {
|
|
1148
|
-
super("extensions.status", "", `${McpServerStatusAction_1.CLASS} hide`, false);
|
|
1149
|
-
this.mcpWorkbenchService = mcpWorkbenchService;
|
|
1150
|
-
this.commandService = commandService;
|
|
1151
|
-
this._status = [];
|
|
1152
|
-
this._onDidChangeStatus = this._register(( new Emitter()));
|
|
1153
|
-
this.onDidChangeStatus = this._onDidChangeStatus.event;
|
|
1154
|
-
this.update();
|
|
1155
|
-
}
|
|
1156
|
-
update() {
|
|
1157
|
-
this.computeAndUpdateStatus();
|
|
1158
|
-
}
|
|
1159
|
-
computeAndUpdateStatus() {
|
|
1160
|
-
this.updateStatus(undefined, true);
|
|
1161
|
-
this.enabled = false;
|
|
1162
|
-
if (!this.mcpServer) {
|
|
1163
|
-
return;
|
|
1164
|
-
}
|
|
1165
|
-
if ((this.mcpServer.gallery || this.mcpServer.installable) && this.mcpServer.installState === McpServerInstallState.Uninstalled) {
|
|
1166
|
-
const result = this.mcpWorkbenchService.canInstall(this.mcpServer);
|
|
1167
|
-
if (result !== true) {
|
|
1168
|
-
this.updateStatus({
|
|
1169
|
-
icon: warningIcon,
|
|
1170
|
-
message: result
|
|
1171
|
-
}, true);
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
const runtimeState = this.mcpServer.runtimeStatus;
|
|
1176
|
-
if (runtimeState?.message) {
|
|
1177
|
-
this.updateStatus({
|
|
1178
|
-
icon: runtimeState.message.severity === Severity.Warning ? warningIcon : runtimeState.message.severity === Severity.Error ? errorIcon : infoIcon,
|
|
1179
|
-
message: runtimeState.message.text
|
|
1180
|
-
}, true);
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
updateStatus(status, updateClass) {
|
|
1184
|
-
if (status) {
|
|
1185
|
-
if (( this._status.some(
|
|
1186
|
-
s => s.message.value === status.message.value && s.icon?.id === status.icon?.id
|
|
1187
|
-
))) {
|
|
1188
|
-
return;
|
|
1189
|
-
}
|
|
1190
|
-
} else {
|
|
1191
|
-
if (this._status.length === 0) {
|
|
1192
|
-
return;
|
|
1193
|
-
}
|
|
1194
|
-
this._status = [];
|
|
1195
|
-
}
|
|
1196
|
-
if (status) {
|
|
1197
|
-
this._status.push(status);
|
|
1198
|
-
this._status.sort(
|
|
1199
|
-
(a, b) => b.icon === trustIcon ? -1 : a.icon === trustIcon ? 1 : b.icon === errorIcon ? -1 : a.icon === errorIcon ? 1 : b.icon === warningIcon ? -1 : a.icon === warningIcon ? 1 : b.icon === infoIcon ? -1 : a.icon === infoIcon ? 1 : 0
|
|
1200
|
-
);
|
|
1201
|
-
}
|
|
1202
|
-
if (updateClass) {
|
|
1203
|
-
if (status?.icon === errorIcon) {
|
|
1204
|
-
this.class = `${McpServerStatusAction_1.CLASS} extension-status-error ${ThemeIcon.asClassName(errorIcon)}`;
|
|
1205
|
-
} else if (status?.icon === warningIcon) {
|
|
1206
|
-
this.class = `${McpServerStatusAction_1.CLASS} extension-status-warning ${ThemeIcon.asClassName(warningIcon)}`;
|
|
1207
|
-
} else if (status?.icon === infoIcon) {
|
|
1208
|
-
this.class = `${McpServerStatusAction_1.CLASS} extension-status-info ${ThemeIcon.asClassName(infoIcon)}`;
|
|
1209
|
-
} else if (status?.icon === trustIcon) {
|
|
1210
|
-
this.class = `${McpServerStatusAction_1.CLASS} ${ThemeIcon.asClassName(trustIcon)}`;
|
|
1211
|
-
} else {
|
|
1212
|
-
this.class = `${McpServerStatusAction_1.CLASS} hide`;
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
this._onDidChangeStatus.fire();
|
|
1216
|
-
}
|
|
1217
|
-
async run() {
|
|
1218
|
-
if (this._status[0]?.icon === trustIcon) {
|
|
1219
|
-
return this.commandService.executeCommand("workbench.trust.manage");
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
};
|
|
1223
|
-
McpServerStatusAction = McpServerStatusAction_1 = ( __decorate([( __param(0, IMcpWorkbenchService)), ( __param(1, ICommandService))], McpServerStatusAction));
|
|
1224
|
-
|
|
1225
|
-
export { AuthServerAction, BrowseResourcesAction, ButtonWithDropDownExtensionAction, ButtonWithDropdownExtensionActionViewItem, ConfigureModelAccessAction, DropDownAction, DropDownExtensionActionViewItem, InstallAction, InstallInRemoteAction, InstallInWorkspaceAction, InstallingLabelAction, ManageMcpServerAction, McpServerAction, McpServerStatusAction, RestartServerAction, ShowSamplingRequestsAction, ShowServerConfigurationAction, ShowServerJsonConfigurationAction, ShowServerOutputAction, StartServerAction, StopServerAction, UninstallAction, getContextMenuActions };
|