@codingame/monaco-vscode-mcp-service-override 17.2.0 → 18.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 +20 -2
- package/package.json +14 -5
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.d.ts +26 -0
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +170 -0
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +35 -0
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +292 -0
- package/vscode/src/vs/platform/mcp/common/mcpPlatformTypes.d.ts +65 -0
- package/vscode/src/vs/platform/mcp/common/mcpPlatformTypes.js +9 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +64 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpDiscovery.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +73 -27
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.d.ts +106 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +423 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +542 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +45 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +272 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +193 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +176 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.js +27 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +8 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +6 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +4 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigPathsService.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.js +89 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.js +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +8 -6
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +30 -47
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.js +206 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +110 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +256 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +29 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +313 -116
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +15 -17
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +16 -7
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +58 -39
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +109 -46
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.js +296 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts +27 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js +73 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.d.ts +51 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +391 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.d.ts +27 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js +105 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.d.ts +0 -395
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.js +0 -14
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { addDisposableListener, EventType, finalHandler, append, $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
|
|
5
|
+
import { getDefaultHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
6
|
+
import { renderIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
7
|
+
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
8
|
+
import { Disposable, DisposableStore, toDisposable } 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 { language } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
11
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
12
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
13
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
14
|
+
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
15
|
+
import { verifiedPublisherIcon } from '@codingame/monaco-vscode-93784a59-b4cf-520c-8339-f8104d3a4f3e-common/vscode/vs/workbench/services/extensionManagement/common/extensionsIcons';
|
|
16
|
+
import { installCountIcon, starFullIcon, starHalfIcon, starEmptyIcon } from '@codingame/monaco-vscode-93784a59-b4cf-520c-8339-f8104d3a4f3e-common/vscode/vs/workbench/contrib/extensions/browser/extensionsIcons';
|
|
17
|
+
import { mcpServerIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
18
|
+
|
|
19
|
+
var InstallCountWidget_1;
|
|
20
|
+
class McpServerWidget extends Disposable {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this._mcpServer = null;
|
|
24
|
+
}
|
|
25
|
+
get mcpServer() { return this._mcpServer; }
|
|
26
|
+
set mcpServer(mcpServer) { this._mcpServer = mcpServer; this.update(); }
|
|
27
|
+
update() { this.render(); }
|
|
28
|
+
}
|
|
29
|
+
function onClick(element, callback) {
|
|
30
|
+
const disposables = ( new DisposableStore());
|
|
31
|
+
disposables.add(addDisposableListener(element, EventType.CLICK, finalHandler(callback)));
|
|
32
|
+
disposables.add(addDisposableListener(element, EventType.KEY_UP, e => {
|
|
33
|
+
const keyboardEvent = ( new StandardKeyboardEvent(e));
|
|
34
|
+
if (keyboardEvent.equals(KeyCode.Space) || keyboardEvent.equals(KeyCode.Enter)) {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
callback();
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
return disposables;
|
|
41
|
+
}
|
|
42
|
+
class McpServerIconWidget extends McpServerWidget {
|
|
43
|
+
constructor(container) {
|
|
44
|
+
super();
|
|
45
|
+
this.disposables = this._register(( new DisposableStore()));
|
|
46
|
+
this.element = append(container, $('.extension-icon'));
|
|
47
|
+
this.iconElement = append(this.element, $('img.icon', { alt: '' }));
|
|
48
|
+
this.iconElement.style.display = 'none';
|
|
49
|
+
this.defaultIconElement = append(this.element, $(ThemeIcon.asCSSSelector(mcpServerIcon)));
|
|
50
|
+
this.defaultIconElement.style.display = 'none';
|
|
51
|
+
this.render();
|
|
52
|
+
this._register(toDisposable(() => this.clear()));
|
|
53
|
+
}
|
|
54
|
+
clear() {
|
|
55
|
+
this.iconUrl = undefined;
|
|
56
|
+
this.iconElement.src = '';
|
|
57
|
+
this.iconElement.style.display = 'none';
|
|
58
|
+
this.defaultIconElement.style.display = 'none';
|
|
59
|
+
this.disposables.clear();
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
if (!this.mcpServer) {
|
|
63
|
+
this.clear();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this.mcpServer.iconUrl) {
|
|
67
|
+
this.iconElement.style.display = 'inherit';
|
|
68
|
+
this.defaultIconElement.style.display = 'none';
|
|
69
|
+
if (this.iconUrl !== this.mcpServer.iconUrl) {
|
|
70
|
+
this.iconUrl = this.mcpServer.iconUrl;
|
|
71
|
+
this.disposables.add(addDisposableListener(this.iconElement, 'error', () => {
|
|
72
|
+
this.iconElement.style.display = 'none';
|
|
73
|
+
this.defaultIconElement.style.display = 'inherit';
|
|
74
|
+
}, { once: true }));
|
|
75
|
+
this.iconElement.src = this.iconUrl;
|
|
76
|
+
if (!this.iconElement.complete) {
|
|
77
|
+
this.iconElement.style.visibility = 'hidden';
|
|
78
|
+
this.iconElement.onload = () => this.iconElement.style.visibility = 'inherit';
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.iconElement.style.visibility = 'inherit';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.iconUrl = undefined;
|
|
87
|
+
this.iconElement.style.display = 'none';
|
|
88
|
+
this.iconElement.src = '';
|
|
89
|
+
this.defaultIconElement.style.display = 'inherit';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
let PublisherWidget = class PublisherWidget extends McpServerWidget {
|
|
94
|
+
constructor(container, small, hoverService, openerService) {
|
|
95
|
+
super();
|
|
96
|
+
this.container = container;
|
|
97
|
+
this.small = small;
|
|
98
|
+
this.hoverService = hoverService;
|
|
99
|
+
this.openerService = openerService;
|
|
100
|
+
this.disposables = this._register(( new DisposableStore()));
|
|
101
|
+
this.render();
|
|
102
|
+
this._register(toDisposable(() => this.clear()));
|
|
103
|
+
}
|
|
104
|
+
clear() {
|
|
105
|
+
this.element?.remove();
|
|
106
|
+
this.disposables.clear();
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
this.clear();
|
|
110
|
+
if (!this.mcpServer?.publisherDisplayName) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.element = append(this.container, $('.publisher'));
|
|
114
|
+
const publisherDisplayName = $('.publisher-name.ellipsis');
|
|
115
|
+
publisherDisplayName.textContent = this.mcpServer.publisherDisplayName;
|
|
116
|
+
const verifiedPublisher = $('.verified-publisher');
|
|
117
|
+
append(verifiedPublisher, $('span.extension-verified-publisher.clickable'), renderIcon(verifiedPublisherIcon));
|
|
118
|
+
if (this.small) {
|
|
119
|
+
if (this.mcpServer.gallery?.publisherDomain?.verified) {
|
|
120
|
+
append(this.element, verifiedPublisher);
|
|
121
|
+
}
|
|
122
|
+
append(this.element, publisherDisplayName);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
this.element.setAttribute('role', 'button');
|
|
126
|
+
this.element.tabIndex = 0;
|
|
127
|
+
this.containerHover = this.disposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), this.element, ( localize(7913, "Publisher ({0})", this.mcpServer.publisherDisplayName))));
|
|
128
|
+
append(this.element, publisherDisplayName);
|
|
129
|
+
if (this.mcpServer.gallery?.publisherDomain?.verified) {
|
|
130
|
+
append(this.element, verifiedPublisher);
|
|
131
|
+
const publisherDomainLink = ( URI.parse(this.mcpServer.gallery?.publisherDomain.link));
|
|
132
|
+
verifiedPublisher.tabIndex = 0;
|
|
133
|
+
verifiedPublisher.setAttribute('role', 'button');
|
|
134
|
+
this.containerHover.update(( localize(
|
|
135
|
+
7914,
|
|
136
|
+
"This publisher has verified ownership of {0}",
|
|
137
|
+
this.mcpServer.gallery?.publisherDomain.link
|
|
138
|
+
)));
|
|
139
|
+
verifiedPublisher.setAttribute('role', 'link');
|
|
140
|
+
append(verifiedPublisher, $('span.extension-verified-publisher-domain', undefined, publisherDomainLink.authority.startsWith('www.') ? publisherDomainLink.authority.substring(4) : publisherDomainLink.authority));
|
|
141
|
+
this.disposables.add(onClick(verifiedPublisher, () => this.openerService.open(publisherDomainLink)));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
PublisherWidget = ( __decorate([
|
|
147
|
+
( __param(2, IHoverService)),
|
|
148
|
+
( __param(3, IOpenerService))
|
|
149
|
+
], PublisherWidget));
|
|
150
|
+
let InstallCountWidget = InstallCountWidget_1 = class InstallCountWidget extends McpServerWidget {
|
|
151
|
+
constructor(container, small, hoverService) {
|
|
152
|
+
super();
|
|
153
|
+
this.container = container;
|
|
154
|
+
this.small = small;
|
|
155
|
+
this.hoverService = hoverService;
|
|
156
|
+
this.disposables = this._register(( new DisposableStore()));
|
|
157
|
+
this.render();
|
|
158
|
+
this._register(toDisposable(() => this.clear()));
|
|
159
|
+
}
|
|
160
|
+
clear() {
|
|
161
|
+
this.container.innerText = '';
|
|
162
|
+
this.disposables.clear();
|
|
163
|
+
}
|
|
164
|
+
render() {
|
|
165
|
+
this.clear();
|
|
166
|
+
if (!this.mcpServer?.installCount) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const installLabel = InstallCountWidget_1.getInstallLabel(this.mcpServer, this.small);
|
|
170
|
+
if (!installLabel) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const parent = this.small ? this.container : append(this.container, $('span.install', { tabIndex: 0 }));
|
|
174
|
+
append(parent, $('span' + ThemeIcon.asCSSSelector(installCountIcon)));
|
|
175
|
+
const count = append(parent, $('span.count'));
|
|
176
|
+
count.textContent = installLabel;
|
|
177
|
+
if (!this.small) {
|
|
178
|
+
this.disposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), this.container, ( localize(7915, "Install count"))));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
static getInstallLabel(extension, small) {
|
|
182
|
+
const installCount = extension.installCount;
|
|
183
|
+
if (!installCount) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
let installLabel;
|
|
187
|
+
if (small) {
|
|
188
|
+
if (installCount > 1000000) {
|
|
189
|
+
installLabel = `${Math.floor(installCount / 100000) / 10}M`;
|
|
190
|
+
}
|
|
191
|
+
else if (installCount > 1000) {
|
|
192
|
+
installLabel = `${Math.floor(installCount / 1000)}K`;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
installLabel = String(installCount);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
installLabel = installCount.toLocaleString(language);
|
|
200
|
+
}
|
|
201
|
+
return installLabel;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
InstallCountWidget = InstallCountWidget_1 = ( __decorate([
|
|
205
|
+
( __param(2, IHoverService))
|
|
206
|
+
], InstallCountWidget));
|
|
207
|
+
let RatingsWidget = class RatingsWidget extends McpServerWidget {
|
|
208
|
+
constructor(container, small, hoverService) {
|
|
209
|
+
super();
|
|
210
|
+
this.container = container;
|
|
211
|
+
this.small = small;
|
|
212
|
+
this.hoverService = hoverService;
|
|
213
|
+
this.disposables = this._register(( new DisposableStore()));
|
|
214
|
+
container.classList.add('extension-ratings');
|
|
215
|
+
if (this.small) {
|
|
216
|
+
container.classList.add('small');
|
|
217
|
+
}
|
|
218
|
+
this.render();
|
|
219
|
+
this._register(toDisposable(() => this.clear()));
|
|
220
|
+
}
|
|
221
|
+
clear() {
|
|
222
|
+
this.container.innerText = '';
|
|
223
|
+
this.disposables.clear();
|
|
224
|
+
}
|
|
225
|
+
render() {
|
|
226
|
+
this.clear();
|
|
227
|
+
if (!this.mcpServer) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (this.mcpServer.rating === undefined) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (this.small && !this.mcpServer.ratingCount) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (!this.mcpServer.url) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const rating = Math.round(this.mcpServer.rating * 2) / 2;
|
|
240
|
+
if (this.small) {
|
|
241
|
+
append(this.container, $('span' + ThemeIcon.asCSSSelector(starFullIcon)));
|
|
242
|
+
const count = append(this.container, $('span.count'));
|
|
243
|
+
count.textContent = String(rating);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
const element = append(this.container, $('span.rating.clickable', { tabIndex: 0 }));
|
|
247
|
+
for (let i = 1; i <= 5; i++) {
|
|
248
|
+
if (rating >= i) {
|
|
249
|
+
append(element, $('span' + ThemeIcon.asCSSSelector(starFullIcon)));
|
|
250
|
+
}
|
|
251
|
+
else if (rating >= i - 0.5) {
|
|
252
|
+
append(element, $('span' + ThemeIcon.asCSSSelector(starHalfIcon)));
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
append(element, $('span' + ThemeIcon.asCSSSelector(starEmptyIcon)));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (this.mcpServer.ratingCount) {
|
|
259
|
+
const ratingCountElement = append(element, $('span', undefined, ` (${this.mcpServer.ratingCount})`));
|
|
260
|
+
ratingCountElement.style.paddingLeft = '1px';
|
|
261
|
+
}
|
|
262
|
+
this.containerHover = this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('mouse'), element, ''));
|
|
263
|
+
this.containerHover.update(( localize(7916, "Average rating: {0} out of 5", rating)));
|
|
264
|
+
element.setAttribute('role', 'link');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
RatingsWidget = ( __decorate([
|
|
269
|
+
( __param(2, IHoverService))
|
|
270
|
+
], RatingsWidget));
|
|
271
|
+
|
|
272
|
+
export { InstallCountWidget, McpServerIconWidget, McpServerWidget, PublisherWidget, RatingsWidget, onClick };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IPagedModel } from "@codingame/monaco-vscode-9ed6fe06-a052-57c2-a234-5d9b94d2e7e0-common/vscode/vs/base/common/paging";
|
|
2
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
3
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
4
|
+
import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
|
|
5
|
+
import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
|
|
6
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
7
|
+
import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
8
|
+
import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
|
|
9
|
+
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
|
10
|
+
import { ViewPane } from "@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/viewPane";
|
|
11
|
+
import { IViewletViewOptions } from "@codingame/monaco-vscode-2a94c04a-b85b-5669-b06b-89c1bfa11cb9-common/vscode/vs/workbench/browser/parts/views/viewsViewlet";
|
|
12
|
+
import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service";
|
|
13
|
+
import { IWorkbenchMcpServer } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
14
|
+
import { IMcpWorkbenchService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service";
|
|
15
|
+
export declare class McpServersListView extends ViewPane {
|
|
16
|
+
private readonly mcpWorkbenchService;
|
|
17
|
+
private list;
|
|
18
|
+
private readonly contextMenuActionRunner;
|
|
19
|
+
constructor(options: IViewletViewOptions, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, instantiationService: IInstantiationService, themeService: IThemeService, hoverService: IHoverService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, viewDescriptorService: IViewDescriptorService, openerService: IOpenerService, mcpWorkbenchService: IMcpWorkbenchService);
|
|
20
|
+
protected renderBody(container: HTMLElement): void;
|
|
21
|
+
private onContextMenu;
|
|
22
|
+
protected layoutBody(height: number, width: number): void;
|
|
23
|
+
show(query: string): Promise<IPagedModel<IWorkbenchMcpServer>>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { append, $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { ActionBar } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
5
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
+
import { DisposableStore, isDisposable, combinedDisposable, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { PagedModel, DelayedPagedModel } from '@codingame/monaco-vscode-9ed6fe06-a052-57c2-a234-5d9b94d2e7e0-common/vscode/vs/base/common/paging';
|
|
8
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
9
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
11
|
+
import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
|
|
12
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
13
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
|
+
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
15
|
+
import { WorkbenchPagedList } from '@codingame/monaco-vscode-api/vscode/vs/platform/list/browser/listService';
|
|
16
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
17
|
+
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
18
|
+
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
19
|
+
import { ViewPane, getLocationBasedViewColors } from '@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
20
|
+
import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
|
|
21
|
+
import { McpServerContainers } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
22
|
+
import { IMcpWorkbenchService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service';
|
|
23
|
+
import { ManageMcpServerAction, DropDownAction, InstallAction } from './mcpServerActions.js';
|
|
24
|
+
import { McpServerIconWidget, PublisherWidget, InstallCountWidget, RatingsWidget } from './mcpServerWidgets.js';
|
|
25
|
+
import { ActionRunner, Separator } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
26
|
+
|
|
27
|
+
var McpServerRenderer_1;
|
|
28
|
+
let McpServersListView = class McpServersListView extends ViewPane {
|
|
29
|
+
constructor(options, keybindingService, contextMenuService, instantiationService, themeService, hoverService, configurationService, contextKeyService, viewDescriptorService, openerService, mcpWorkbenchService) {
|
|
30
|
+
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService);
|
|
31
|
+
this.mcpWorkbenchService = mcpWorkbenchService;
|
|
32
|
+
this.list = null;
|
|
33
|
+
this.contextMenuActionRunner = this._register(( new ActionRunner()));
|
|
34
|
+
}
|
|
35
|
+
renderBody(container) {
|
|
36
|
+
super.renderBody(container);
|
|
37
|
+
const mcpServersList = append(container, $('.mcp-servers-list'));
|
|
38
|
+
this.list = this._register(this.instantiationService.createInstance(WorkbenchPagedList, `${this.id}-MCP-Servers`, mcpServersList, {
|
|
39
|
+
getHeight() { return 72; },
|
|
40
|
+
getTemplateId: () => McpServerRenderer.templateId,
|
|
41
|
+
}, [this.instantiationService.createInstance(McpServerRenderer)], {
|
|
42
|
+
multipleSelectionSupport: false,
|
|
43
|
+
setRowLineHeight: false,
|
|
44
|
+
horizontalScrolling: false,
|
|
45
|
+
accessibilityProvider: {
|
|
46
|
+
getAriaLabel(mcpServer) {
|
|
47
|
+
return mcpServer?.label ?? '';
|
|
48
|
+
},
|
|
49
|
+
getWidgetAriaLabel() {
|
|
50
|
+
return localize(7917, "MCP Servers");
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
overrideStyles: getLocationBasedViewColors(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles,
|
|
54
|
+
openOnSingleClick: true,
|
|
55
|
+
}));
|
|
56
|
+
this._register(Event.debounce(Event.filter(this.list.onDidOpen, e => e.element !== null), (_, event) => event, 75, true)(options => {
|
|
57
|
+
this.mcpWorkbenchService.open(options.element, options.editorOptions);
|
|
58
|
+
}));
|
|
59
|
+
this._register(this.list.onContextMenu(e => this.onContextMenu(e), this));
|
|
60
|
+
}
|
|
61
|
+
async onContextMenu(e) {
|
|
62
|
+
if (e.element) {
|
|
63
|
+
const disposables = ( new DisposableStore());
|
|
64
|
+
const manageExtensionAction = disposables.add(this.instantiationService.createInstance(ManageMcpServerAction, false));
|
|
65
|
+
const extension = e.element ? this.mcpWorkbenchService.local.find(local => local.name === e.element.name) || e.element
|
|
66
|
+
: e.element;
|
|
67
|
+
manageExtensionAction.mcpServer = extension;
|
|
68
|
+
let groups = [];
|
|
69
|
+
if (manageExtensionAction.enabled) {
|
|
70
|
+
groups = await manageExtensionAction.getActionGroups();
|
|
71
|
+
}
|
|
72
|
+
const actions = [];
|
|
73
|
+
for (const menuActions of groups) {
|
|
74
|
+
for (const menuAction of menuActions) {
|
|
75
|
+
actions.push(menuAction);
|
|
76
|
+
if (isDisposable(menuAction)) {
|
|
77
|
+
disposables.add(menuAction);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
actions.push(( new Separator()));
|
|
81
|
+
}
|
|
82
|
+
actions.pop();
|
|
83
|
+
this.contextMenuService.showContextMenu({
|
|
84
|
+
getAnchor: () => e.anchor,
|
|
85
|
+
getActions: () => actions,
|
|
86
|
+
actionRunner: this.contextMenuActionRunner,
|
|
87
|
+
onHide: () => disposables.dispose()
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
layoutBody(height, width) {
|
|
92
|
+
super.layoutBody(height, width);
|
|
93
|
+
this.list?.layout(height, width);
|
|
94
|
+
}
|
|
95
|
+
async show(query) {
|
|
96
|
+
if (!this.list) {
|
|
97
|
+
return ( new PagedModel([]));
|
|
98
|
+
}
|
|
99
|
+
query = query.trim();
|
|
100
|
+
const servers = query ? await this.mcpWorkbenchService.queryGallery({ text: query.replace('@mcp', '') }) : await this.mcpWorkbenchService.queryLocal();
|
|
101
|
+
this.list.model = ( new DelayedPagedModel(( new PagedModel(servers))));
|
|
102
|
+
return this.list.model;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
McpServersListView = ( __decorate([
|
|
106
|
+
( __param(1, IKeybindingService)),
|
|
107
|
+
( __param(2, IContextMenuService)),
|
|
108
|
+
( __param(3, IInstantiationService)),
|
|
109
|
+
( __param(4, IThemeService)),
|
|
110
|
+
( __param(5, IHoverService)),
|
|
111
|
+
( __param(6, IConfigurationService)),
|
|
112
|
+
( __param(7, IContextKeyService)),
|
|
113
|
+
( __param(8, IViewDescriptorService)),
|
|
114
|
+
( __param(9, IOpenerService)),
|
|
115
|
+
( __param(10, IMcpWorkbenchService))
|
|
116
|
+
], McpServersListView));
|
|
117
|
+
let McpServerRenderer = class McpServerRenderer {
|
|
118
|
+
static { McpServerRenderer_1 = this; }
|
|
119
|
+
static { this.templateId = 'mcpServer'; }
|
|
120
|
+
constructor(instantiationService, notificationService) {
|
|
121
|
+
this.instantiationService = instantiationService;
|
|
122
|
+
this.notificationService = notificationService;
|
|
123
|
+
this.templateId = McpServerRenderer_1.templateId;
|
|
124
|
+
}
|
|
125
|
+
renderTemplate(root) {
|
|
126
|
+
const element = append(root, $('.mcp-server-item.extension-list-item'));
|
|
127
|
+
const iconContainer = append(element, $('.icon-container'));
|
|
128
|
+
const iconWidget = this.instantiationService.createInstance(McpServerIconWidget, iconContainer);
|
|
129
|
+
const details = append(element, $('.details'));
|
|
130
|
+
const headerContainer = append(details, $('.header-container'));
|
|
131
|
+
const header = append(headerContainer, $('.header'));
|
|
132
|
+
const name = append(header, $('span.name'));
|
|
133
|
+
const installCount = append(header, $('span.install-count'));
|
|
134
|
+
const ratings = append(header, $('span.ratings'));
|
|
135
|
+
const description = append(details, $('.description.ellipsis'));
|
|
136
|
+
const footer = append(details, $('.footer'));
|
|
137
|
+
const publisherWidget = this.instantiationService.createInstance(PublisherWidget, append(footer, $('.publisher-container')), true);
|
|
138
|
+
const actionbar = ( new ActionBar(footer, {
|
|
139
|
+
actionViewItemProvider: (action, options) => {
|
|
140
|
+
if (action instanceof DropDownAction) {
|
|
141
|
+
return action.createActionViewItem(options);
|
|
142
|
+
}
|
|
143
|
+
return undefined;
|
|
144
|
+
},
|
|
145
|
+
focusOnlyEnabledItems: true
|
|
146
|
+
}));
|
|
147
|
+
actionbar.setFocusable(false);
|
|
148
|
+
const actionBarListener = actionbar.onDidRun(({ error }) => error && this.notificationService.error(error));
|
|
149
|
+
const actions = [
|
|
150
|
+
this.instantiationService.createInstance(InstallAction),
|
|
151
|
+
this.instantiationService.createInstance(ManageMcpServerAction, false),
|
|
152
|
+
];
|
|
153
|
+
const widgets = [
|
|
154
|
+
iconWidget,
|
|
155
|
+
publisherWidget,
|
|
156
|
+
this.instantiationService.createInstance(InstallCountWidget, installCount, true),
|
|
157
|
+
this.instantiationService.createInstance(RatingsWidget, ratings, true),
|
|
158
|
+
];
|
|
159
|
+
const extensionContainers = this.instantiationService.createInstance(McpServerContainers, [...actions, ...widgets]);
|
|
160
|
+
actionbar.push(actions, { icon: true, label: true });
|
|
161
|
+
const disposable = combinedDisposable(...actions, ...widgets, actionbar, actionBarListener, extensionContainers);
|
|
162
|
+
return {
|
|
163
|
+
root, element, name, description, installCount, ratings, disposables: [disposable], actionbar,
|
|
164
|
+
mcpServerDisposables: [],
|
|
165
|
+
set mcpServer(mcpServer) {
|
|
166
|
+
extensionContainers.mcpServer = mcpServer;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
renderElement(mcpServer, index, data) {
|
|
171
|
+
data.element.classList.remove('loading');
|
|
172
|
+
data.mcpServerDisposables = dispose(data.mcpServerDisposables);
|
|
173
|
+
data.root.setAttribute('data-mcp-server-id', mcpServer.id);
|
|
174
|
+
data.name.textContent = mcpServer.label;
|
|
175
|
+
data.description.textContent = mcpServer.description;
|
|
176
|
+
data.installCount.style.display = '';
|
|
177
|
+
data.ratings.style.display = '';
|
|
178
|
+
data.mcpServer = mcpServer;
|
|
179
|
+
}
|
|
180
|
+
disposeElement(mcpServer, index, data) {
|
|
181
|
+
data.mcpServerDisposables = dispose(data.mcpServerDisposables);
|
|
182
|
+
}
|
|
183
|
+
disposeTemplate(data) {
|
|
184
|
+
data.mcpServerDisposables = dispose(data.mcpServerDisposables);
|
|
185
|
+
data.disposables = dispose(data.disposables);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
McpServerRenderer = McpServerRenderer_1 = ( __decorate([
|
|
189
|
+
( __param(0, IInstantiationService)),
|
|
190
|
+
( __param(1, INotificationService))
|
|
191
|
+
], McpServerRenderer));
|
|
192
|
+
|
|
193
|
+
export { McpServersListView };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
4
|
+
import { IEditorOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor";
|
|
5
|
+
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
6
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
7
|
+
import { IGalleryMcpServer, ILocalMcpServer, IQueryOptions } from "@codingame/monaco-vscode-aa9ead53-dfd3-59da-b9e7-f163d201de8d-common/vscode/vs/platform/mcp/common/mcpManagement";
|
|
8
|
+
import { IMcpManagementService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
|
|
9
|
+
import { IMcpGalleryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpManagement.service";
|
|
10
|
+
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
11
|
+
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
12
|
+
import { IWorkbenchMcpServer } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
13
|
+
import { IMcpWorkbenchService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service";
|
|
14
|
+
declare class McpWorkbenchServer implements IWorkbenchMcpServer {
|
|
15
|
+
local: ILocalMcpServer | undefined;
|
|
16
|
+
gallery: IGalleryMcpServer | undefined;
|
|
17
|
+
private readonly mcpGalleryService;
|
|
18
|
+
private readonly fileService;
|
|
19
|
+
constructor(local: ILocalMcpServer | undefined, gallery: IGalleryMcpServer | undefined, mcpGalleryService: IMcpGalleryService, fileService: IFileService);
|
|
20
|
+
get id(): string;
|
|
21
|
+
get name(): string;
|
|
22
|
+
get label(): string;
|
|
23
|
+
get iconUrl(): string | undefined;
|
|
24
|
+
get publisherDisplayName(): string | undefined;
|
|
25
|
+
get publisherUrl(): string | undefined;
|
|
26
|
+
get description(): string;
|
|
27
|
+
get installCount(): number;
|
|
28
|
+
get url(): string | undefined;
|
|
29
|
+
get repository(): string | undefined;
|
|
30
|
+
getReadme(token: CancellationToken): Promise<string>;
|
|
31
|
+
}
|
|
32
|
+
export declare class McpWorkbenchService extends Disposable implements IMcpWorkbenchService {
|
|
33
|
+
private readonly mcpGalleryService;
|
|
34
|
+
private readonly mcpManagementService;
|
|
35
|
+
private readonly editorService;
|
|
36
|
+
private readonly instantiationService;
|
|
37
|
+
_serviceBrand: undefined;
|
|
38
|
+
private _local;
|
|
39
|
+
get local(): readonly McpWorkbenchServer[];
|
|
40
|
+
private readonly _onChange;
|
|
41
|
+
readonly onChange: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<IWorkbenchMcpServer | undefined>;
|
|
42
|
+
constructor(mcpGalleryService: IMcpGalleryService, mcpManagementService: IMcpManagementService, editorService: IEditorService, instantiationService: IInstantiationService);
|
|
43
|
+
private onDidUninstallMcpServer;
|
|
44
|
+
private onDidInstallMcpServers;
|
|
45
|
+
private fromGallery;
|
|
46
|
+
queryGallery(options?: IQueryOptions, token?: CancellationToken): Promise<IWorkbenchMcpServer[]>;
|
|
47
|
+
queryLocal(): Promise<IWorkbenchMcpServer[]>;
|
|
48
|
+
install(server: IWorkbenchMcpServer): Promise<void>;
|
|
49
|
+
uninstall(server: IWorkbenchMcpServer): Promise<void>;
|
|
50
|
+
open(extension: IWorkbenchMcpServer, options?: IEditorOptions): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
export declare class MCPContextsInitialisation extends Disposable implements IWorkbenchContribution {
|
|
53
|
+
static ID: string;
|
|
54
|
+
constructor(mcpWorkbenchService: IMcpWorkbenchService, mcpGalleryService: IMcpGalleryService, contextKeyService: IContextKeyService);
|
|
55
|
+
}
|
|
56
|
+
export {};
|