@codingame/monaco-vscode-mcp-service-override 21.6.0 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -15
- package/vscode/src/vs/base/common/uriTransformer.d.ts +2 -0
- package/vscode/src/vs/base/common/uriTransformer.js +39 -0
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +3 -6
- package/vscode/src/vs/platform/mcp/common/mcpGalleryManifestService.d.ts +1 -1
- package/vscode/src/vs/platform/mcp/common/mcpGalleryManifestService.js +43 -7
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.d.ts +11 -7
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +800 -109
- package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.d.ts +2 -1
- package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.js +5 -3
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.d.ts +21 -18
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +179 -122
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +6 -7
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +64 -79
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +31 -21
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +19 -19
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +6 -6
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +12 -8
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +30 -32
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +113 -68
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +6 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +35 -7
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +115 -34
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +36 -31
- package/vscode/src/vs/workbench/contrib/mcp/browser/openPanelChatAndGetWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +66 -25
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +4 -23
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpIcons.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpIcons.js +85 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +48 -32
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +38 -20
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.js +22 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +15 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +28 -12
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +130 -66
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +8 -7
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +24 -7
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +10 -10
- package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.d.ts +2 -1
- package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js +11 -9
- package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.d.ts +2 -1
- package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.js +14 -11
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypesUtils.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypesUtils.js +0 -68
|
@@ -9,22 +9,675 @@ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
|
9
9
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
10
10
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
11
11
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
12
|
-
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
13
12
|
import { asJson, asText } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request';
|
|
14
13
|
import { IRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/request/common/request.service';
|
|
15
|
-
import { GalleryMcpServerStatus } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/platform/mcp/common/mcpManagement';
|
|
14
|
+
import { TransportType, RegistryType, GalleryMcpServerStatus } from '@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common/vscode/vs/platform/mcp/common/mcpManagement';
|
|
16
15
|
import { McpGalleryManifestStatus, getMcpGalleryManifestResourceUri, McpGalleryResourceType } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest';
|
|
17
16
|
import { IMcpGalleryManifestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/mcp/common/mcpGalleryManifest.service';
|
|
18
17
|
import { singlePagePager, PageIteratorPager } from '@codingame/monaco-vscode-62190c26-af1c-5f7a-a364-e05a59cfb7c7-common/vscode/vs/base/common/paging';
|
|
19
18
|
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
20
19
|
import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
var McpServerOldSchema;
|
|
22
|
+
(function (McpServerOldSchema) {
|
|
23
|
+
class Serializer {
|
|
24
|
+
toRawGalleryMcpServerResult(input) {
|
|
25
|
+
if (!input || !Array.isArray(input.servers)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const from = input;
|
|
29
|
+
const servers = [];
|
|
30
|
+
for (const server of from.servers) {
|
|
31
|
+
const rawServer = this.toRawGalleryMcpServer(server);
|
|
32
|
+
if (!rawServer) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
servers.push(rawServer);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
metadata: from.metadata,
|
|
39
|
+
servers
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
toRawGalleryMcpServer(input) {
|
|
43
|
+
if (!input || !input.server) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const from = input;
|
|
47
|
+
const registryInfo = from['x-io.modelcontextprotocol.registry'];
|
|
48
|
+
function convertServerInput(input) {
|
|
49
|
+
return {
|
|
50
|
+
...input,
|
|
51
|
+
isRequired: input.is_required,
|
|
52
|
+
isSecret: input.is_secret,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function convertVariables(variables) {
|
|
56
|
+
const result = {};
|
|
57
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
58
|
+
result[key] = convertServerInput(value);
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function convertServerArgument(arg) {
|
|
63
|
+
if (arg.type === 'positional') {
|
|
64
|
+
return {
|
|
65
|
+
...arg,
|
|
66
|
+
valueHint: arg.value_hint,
|
|
67
|
+
isRepeated: arg.is_repeated,
|
|
68
|
+
isRequired: arg.is_required,
|
|
69
|
+
isSecret: arg.is_secret,
|
|
70
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
...arg,
|
|
75
|
+
isRepeated: arg.is_repeated,
|
|
76
|
+
isRequired: arg.is_required,
|
|
77
|
+
isSecret: arg.is_secret,
|
|
78
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function convertKeyValueInput(input) {
|
|
82
|
+
return {
|
|
83
|
+
...input,
|
|
84
|
+
isRequired: input.is_required,
|
|
85
|
+
isSecret: input.is_secret,
|
|
86
|
+
variables: input.variables ? convertVariables(input.variables) : undefined,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function convertTransport(input) {
|
|
90
|
+
switch (input.type) {
|
|
91
|
+
case 'stdio':
|
|
92
|
+
return {
|
|
93
|
+
type: TransportType.STDIO,
|
|
94
|
+
};
|
|
95
|
+
case 'streamable-http':
|
|
96
|
+
return {
|
|
97
|
+
type: TransportType.STREAMABLE_HTTP,
|
|
98
|
+
url: input.url,
|
|
99
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
100
|
+
};
|
|
101
|
+
case 'sse':
|
|
102
|
+
return {
|
|
103
|
+
type: TransportType.SSE,
|
|
104
|
+
url: input.url,
|
|
105
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
106
|
+
};
|
|
107
|
+
default:
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function convertRegistryType(input) {
|
|
112
|
+
switch (input) {
|
|
113
|
+
case 'npm':
|
|
114
|
+
return RegistryType.NODE;
|
|
115
|
+
case 'docker':
|
|
116
|
+
case 'docker-hub':
|
|
117
|
+
case 'oci':
|
|
118
|
+
return RegistryType.DOCKER;
|
|
119
|
+
case 'pypi':
|
|
120
|
+
return RegistryType.PYTHON;
|
|
121
|
+
case 'nuget':
|
|
122
|
+
return RegistryType.NUGET;
|
|
123
|
+
case 'mcpb':
|
|
124
|
+
return RegistryType.MCPB;
|
|
125
|
+
default:
|
|
126
|
+
return RegistryType.NODE;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
name: from.server.name,
|
|
131
|
+
description: from.server.description,
|
|
132
|
+
repository: from.server.repository ? {
|
|
133
|
+
url: from.server.repository.url,
|
|
134
|
+
source: from.server.repository.source,
|
|
135
|
+
id: from.server.repository.id,
|
|
136
|
+
readme: from.server.repository.readme
|
|
137
|
+
} : undefined,
|
|
138
|
+
version: from.server.version_detail.version,
|
|
139
|
+
createdAt: from.server.created_at,
|
|
140
|
+
updatedAt: from.server.updated_at,
|
|
141
|
+
packages: from.server.packages?.map(p => ({
|
|
142
|
+
identifier: p.identifier ?? p.name,
|
|
143
|
+
registryType: convertRegistryType(p.registry_type ?? p.registry_name),
|
|
144
|
+
version: p.version,
|
|
145
|
+
fileSha256: p.file_sha256,
|
|
146
|
+
registryBaseUrl: p.registry_base_url,
|
|
147
|
+
transport: p.transport ? convertTransport(p.transport) : undefined,
|
|
148
|
+
packageArguments: p.package_arguments?.map(convertServerArgument),
|
|
149
|
+
runtimeHint: p.runtime_hint,
|
|
150
|
+
runtimeArguments: p.runtime_arguments?.map(convertServerArgument),
|
|
151
|
+
environmentVariables: p.environment_variables?.map(convertKeyValueInput),
|
|
152
|
+
})),
|
|
153
|
+
remotes: from.server.remotes?.map(remote => {
|
|
154
|
+
const type = remote.type ?? remote.transport_type ?? remote.transport;
|
|
155
|
+
return {
|
|
156
|
+
type: type === TransportType.SSE ? TransportType.SSE : TransportType.STREAMABLE_HTTP,
|
|
157
|
+
url: remote.url,
|
|
158
|
+
headers: remote.headers?.map(convertKeyValueInput)
|
|
159
|
+
};
|
|
160
|
+
}),
|
|
161
|
+
registryInfo: {
|
|
162
|
+
id: registryInfo.id,
|
|
163
|
+
isLatest: registryInfo.is_latest,
|
|
164
|
+
publishedAt: registryInfo.published_at,
|
|
165
|
+
updatedAt: registryInfo.updated_at,
|
|
166
|
+
},
|
|
167
|
+
githubInfo: from['x-github'],
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
McpServerOldSchema.SERIALIZER = ( new Serializer());
|
|
172
|
+
})(McpServerOldSchema || (McpServerOldSchema = {}));
|
|
173
|
+
var McpServer1ESSchema;
|
|
174
|
+
(function (McpServer1ESSchema) {
|
|
175
|
+
class Serializer {
|
|
176
|
+
toRawGalleryMcpServerResult(input) {
|
|
177
|
+
if (!input || !Array.isArray(input.servers)) {
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
const from = input;
|
|
181
|
+
const servers = [];
|
|
182
|
+
for (const server of from.servers) {
|
|
183
|
+
const rawServer = this.toRawGalleryMcpServer(server);
|
|
184
|
+
if (!rawServer) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
servers.push(rawServer);
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
metadata: from.metadata,
|
|
191
|
+
servers
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
toRawGalleryMcpServer(input) {
|
|
195
|
+
if (!input || input.server || input.$schema) {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
const from = input;
|
|
199
|
+
function convertServerInput(input) {
|
|
200
|
+
return {
|
|
201
|
+
...input,
|
|
202
|
+
isRequired: input.is_required,
|
|
203
|
+
isSecret: input.is_secret,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function convertVariables(variables) {
|
|
207
|
+
const result = {};
|
|
208
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
209
|
+
result[key] = convertServerInput(value);
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
}
|
|
213
|
+
function convertServerArgument(arg) {
|
|
214
|
+
if (arg.type === 'positional') {
|
|
215
|
+
return {
|
|
216
|
+
...arg,
|
|
217
|
+
valueHint: arg.value_hint,
|
|
218
|
+
isRepeated: arg.is_repeated,
|
|
219
|
+
isRequired: arg.is_required,
|
|
220
|
+
isSecret: arg.is_secret,
|
|
221
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
...arg,
|
|
226
|
+
isRepeated: arg.is_repeated,
|
|
227
|
+
isRequired: arg.is_required,
|
|
228
|
+
isSecret: arg.is_secret,
|
|
229
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function convertKeyValueInput(input) {
|
|
233
|
+
return {
|
|
234
|
+
...input,
|
|
235
|
+
isRequired: input.is_required,
|
|
236
|
+
isSecret: input.is_secret,
|
|
237
|
+
variables: input.variables ? convertVariables(input.variables) : undefined,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function convertTransport(input) {
|
|
241
|
+
switch (input.type) {
|
|
242
|
+
case 'stdio':
|
|
243
|
+
return {
|
|
244
|
+
type: TransportType.STDIO,
|
|
245
|
+
};
|
|
246
|
+
case 'streamable-http':
|
|
247
|
+
return {
|
|
248
|
+
type: TransportType.STREAMABLE_HTTP,
|
|
249
|
+
url: input.url,
|
|
250
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
251
|
+
};
|
|
252
|
+
case 'sse':
|
|
253
|
+
return {
|
|
254
|
+
type: TransportType.SSE,
|
|
255
|
+
url: input.url,
|
|
256
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
257
|
+
};
|
|
258
|
+
default:
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function convertRegistryType(input) {
|
|
263
|
+
switch (input) {
|
|
264
|
+
case 'npm':
|
|
265
|
+
return RegistryType.NODE;
|
|
266
|
+
case 'docker':
|
|
267
|
+
case 'docker-hub':
|
|
268
|
+
case 'oci':
|
|
269
|
+
return RegistryType.DOCKER;
|
|
270
|
+
case 'pypi':
|
|
271
|
+
return RegistryType.PYTHON;
|
|
272
|
+
case 'nuget':
|
|
273
|
+
return RegistryType.NUGET;
|
|
274
|
+
case 'mcpb':
|
|
275
|
+
return RegistryType.MCPB;
|
|
276
|
+
default:
|
|
277
|
+
return RegistryType.NODE;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
name: from.name,
|
|
282
|
+
description: from.description,
|
|
283
|
+
repository: from.repository ? {
|
|
284
|
+
url: from.repository.url,
|
|
285
|
+
source: from.repository.source,
|
|
286
|
+
id: from.repository.id,
|
|
287
|
+
readme: from.repository.readme
|
|
288
|
+
} : undefined,
|
|
289
|
+
version: from.version_detail.version,
|
|
290
|
+
createdAt: from.created_at,
|
|
291
|
+
updatedAt: from.updated_at,
|
|
292
|
+
packages: from.packages?.map(p => ({
|
|
293
|
+
identifier: p.identifier ?? p.name,
|
|
294
|
+
registryType: convertRegistryType(p.registry_type ?? p.registry_name),
|
|
295
|
+
version: p.version,
|
|
296
|
+
fileSha256: p.file_sha256,
|
|
297
|
+
registryBaseUrl: p.registry_base_url,
|
|
298
|
+
transport: p.transport ? convertTransport(p.transport) : undefined,
|
|
299
|
+
packageArguments: p.package_arguments?.map(convertServerArgument),
|
|
300
|
+
runtimeHint: p.runtime_hint,
|
|
301
|
+
runtimeArguments: p.runtime_arguments?.map(convertServerArgument),
|
|
302
|
+
environmentVariables: p.environment_variables?.map(convertKeyValueInput),
|
|
303
|
+
})),
|
|
304
|
+
remotes: from.remotes?.map(remote => {
|
|
305
|
+
const type = remote.type ?? remote.transport_type ?? remote.transport;
|
|
306
|
+
return {
|
|
307
|
+
type: type === TransportType.SSE ? TransportType.SSE : TransportType.STREAMABLE_HTTP,
|
|
308
|
+
url: remote.url,
|
|
309
|
+
headers: remote.headers?.map(convertKeyValueInput)
|
|
310
|
+
};
|
|
311
|
+
}),
|
|
312
|
+
registryInfo: {
|
|
313
|
+
id: from.id,
|
|
314
|
+
isLatest: true,
|
|
315
|
+
updatedAt: from.updated_at,
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
McpServer1ESSchema.SERIALIZER = ( new Serializer());
|
|
321
|
+
})(McpServer1ESSchema || (McpServer1ESSchema = {}));
|
|
322
|
+
var McpServerSchemaVersion_2025_01_09;
|
|
323
|
+
(function (McpServerSchemaVersion_2025_01_09) {
|
|
324
|
+
McpServerSchemaVersion_2025_01_09.VERSION = '2025-09-01';
|
|
325
|
+
McpServerSchemaVersion_2025_01_09.SCHEMA = `https://static.modelcontextprotocol.io/schemas/${McpServerSchemaVersion_2025_01_09.VERSION}/server.schema.json`;
|
|
326
|
+
class Serializer {
|
|
327
|
+
toRawGalleryMcpServerResult(input) {
|
|
328
|
+
if (!input || !Array.isArray(input.servers)) {
|
|
329
|
+
return undefined;
|
|
330
|
+
}
|
|
331
|
+
const from = input;
|
|
332
|
+
const servers = [];
|
|
333
|
+
for (const server of from.servers) {
|
|
334
|
+
const rawServer = this.toRawGalleryMcpServer(server);
|
|
335
|
+
if (!rawServer) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
servers.push(rawServer);
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
metadata: from.metadata,
|
|
342
|
+
servers
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
toRawGalleryMcpServer(input) {
|
|
346
|
+
if (!input || input.$schema !== McpServerSchemaVersion_2025_01_09.SCHEMA) {
|
|
347
|
+
return undefined;
|
|
348
|
+
}
|
|
349
|
+
const from = input;
|
|
350
|
+
const registryInfo = from._meta?.['io.modelcontextprotocol.registry'];
|
|
351
|
+
function convertServerInput(input) {
|
|
352
|
+
return {
|
|
353
|
+
...input,
|
|
354
|
+
isRequired: input.is_required,
|
|
355
|
+
isSecret: input.is_secret,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function convertVariables(variables) {
|
|
359
|
+
const result = {};
|
|
360
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
361
|
+
result[key] = convertServerInput(value);
|
|
362
|
+
}
|
|
363
|
+
return result;
|
|
364
|
+
}
|
|
365
|
+
function convertServerArgument(arg) {
|
|
366
|
+
if (arg.type === 'positional') {
|
|
367
|
+
return {
|
|
368
|
+
...arg,
|
|
369
|
+
valueHint: arg.value_hint,
|
|
370
|
+
isRepeated: arg.is_repeated,
|
|
371
|
+
isRequired: arg.is_required,
|
|
372
|
+
isSecret: arg.is_secret,
|
|
373
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
return {
|
|
377
|
+
...arg,
|
|
378
|
+
isRepeated: arg.is_repeated,
|
|
379
|
+
isRequired: arg.is_required,
|
|
380
|
+
isSecret: arg.is_secret,
|
|
381
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function convertKeyValueInput(input) {
|
|
385
|
+
return {
|
|
386
|
+
...input,
|
|
387
|
+
isRequired: input.is_required,
|
|
388
|
+
isSecret: input.is_secret,
|
|
389
|
+
variables: input.variables ? convertVariables(input.variables) : undefined,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function convertTransport(input) {
|
|
393
|
+
switch (input.type) {
|
|
394
|
+
case 'stdio':
|
|
395
|
+
return {
|
|
396
|
+
type: TransportType.STDIO,
|
|
397
|
+
};
|
|
398
|
+
case 'streamable-http':
|
|
399
|
+
return {
|
|
400
|
+
type: TransportType.STREAMABLE_HTTP,
|
|
401
|
+
url: input.url,
|
|
402
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
403
|
+
};
|
|
404
|
+
case 'sse':
|
|
405
|
+
return {
|
|
406
|
+
type: TransportType.SSE,
|
|
407
|
+
url: input.url,
|
|
408
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
409
|
+
};
|
|
410
|
+
default:
|
|
411
|
+
return undefined;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
function convertRegistryType(input) {
|
|
415
|
+
switch (input) {
|
|
416
|
+
case 'npm':
|
|
417
|
+
return RegistryType.NODE;
|
|
418
|
+
case 'docker':
|
|
419
|
+
case 'docker-hub':
|
|
420
|
+
case 'oci':
|
|
421
|
+
return RegistryType.DOCKER;
|
|
422
|
+
case 'pypi':
|
|
423
|
+
return RegistryType.PYTHON;
|
|
424
|
+
case 'nuget':
|
|
425
|
+
return RegistryType.NUGET;
|
|
426
|
+
case 'mcpb':
|
|
427
|
+
return RegistryType.MCPB;
|
|
428
|
+
default:
|
|
429
|
+
return RegistryType.NODE;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
name: from.name,
|
|
434
|
+
description: from.description,
|
|
435
|
+
repository: from.repository ? {
|
|
436
|
+
url: from.repository.url,
|
|
437
|
+
source: from.repository.source,
|
|
438
|
+
id: from.repository.id,
|
|
439
|
+
readme: from.repository.readme
|
|
440
|
+
} : undefined,
|
|
441
|
+
version: from.version_detail.version,
|
|
442
|
+
createdAt: from.created_at,
|
|
443
|
+
updatedAt: from.updated_at,
|
|
444
|
+
packages: from.packages?.map(p => ({
|
|
445
|
+
identifier: p.identifier ?? p.name,
|
|
446
|
+
registryType: convertRegistryType(p.registry_type ?? p.registry_name),
|
|
447
|
+
version: p.version,
|
|
448
|
+
fileSha256: p.file_sha256,
|
|
449
|
+
registryBaseUrl: p.registry_base_url,
|
|
450
|
+
transport: p.transport ? convertTransport(p.transport) : undefined,
|
|
451
|
+
packageArguments: p.package_arguments?.map(convertServerArgument),
|
|
452
|
+
runtimeHint: p.runtime_hint,
|
|
453
|
+
runtimeArguments: p.runtime_arguments?.map(convertServerArgument),
|
|
454
|
+
environmentVariables: p.environment_variables?.map(convertKeyValueInput),
|
|
455
|
+
})),
|
|
456
|
+
remotes: from.remotes?.map(remote => {
|
|
457
|
+
const type = remote.type ?? remote.transport_type ?? remote.transport;
|
|
458
|
+
return {
|
|
459
|
+
type: type === TransportType.SSE ? TransportType.SSE : TransportType.STREAMABLE_HTTP,
|
|
460
|
+
url: remote.url,
|
|
461
|
+
headers: remote.headers?.map(convertKeyValueInput)
|
|
462
|
+
};
|
|
463
|
+
}),
|
|
464
|
+
registryInfo: {
|
|
465
|
+
id: registryInfo.id,
|
|
466
|
+
isLatest: registryInfo.is_latest,
|
|
467
|
+
publishedAt: registryInfo.published_at,
|
|
468
|
+
updatedAt: registryInfo.updated_at,
|
|
469
|
+
},
|
|
470
|
+
githubInfo: from._meta.github,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
McpServerSchemaVersion_2025_01_09.SERIALIZER = ( new Serializer());
|
|
475
|
+
})(McpServerSchemaVersion_2025_01_09 || (McpServerSchemaVersion_2025_01_09 = {}));
|
|
476
|
+
var McpServerSchemaVersion_2025_07_09;
|
|
477
|
+
(function (McpServerSchemaVersion_2025_07_09) {
|
|
478
|
+
McpServerSchemaVersion_2025_07_09.VERSION = '2025-07-09';
|
|
479
|
+
McpServerSchemaVersion_2025_07_09.SCHEMA = `https://static.modelcontextprotocol.io/schemas/${McpServerSchemaVersion_2025_07_09.VERSION}/server.schema.json`;
|
|
480
|
+
class Serializer {
|
|
481
|
+
toRawGalleryMcpServerResult(input) {
|
|
482
|
+
if (!input || !Array.isArray(input.servers)) {
|
|
483
|
+
return undefined;
|
|
484
|
+
}
|
|
485
|
+
const from = input;
|
|
486
|
+
const servers = [];
|
|
487
|
+
for (const server of from.servers) {
|
|
488
|
+
const rawServer = this.toRawGalleryMcpServer(server);
|
|
489
|
+
if (!rawServer) {
|
|
490
|
+
return undefined;
|
|
491
|
+
}
|
|
492
|
+
servers.push(rawServer);
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
metadata: from.metadata,
|
|
496
|
+
servers
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
toRawGalleryMcpServer(input) {
|
|
500
|
+
if (!input || input.$schema !== McpServerSchemaVersion_2025_07_09.SCHEMA) {
|
|
501
|
+
return undefined;
|
|
502
|
+
}
|
|
503
|
+
const from = input;
|
|
504
|
+
const registryInfo = from._meta?.['io.modelcontextprotocol.registry/official'];
|
|
505
|
+
function convertServerInput(input) {
|
|
506
|
+
return {
|
|
507
|
+
...input,
|
|
508
|
+
isRequired: input.is_required,
|
|
509
|
+
isSecret: input.is_secret,
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
function convertVariables(variables) {
|
|
513
|
+
const result = {};
|
|
514
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
515
|
+
result[key] = convertServerInput(value);
|
|
516
|
+
}
|
|
517
|
+
return result;
|
|
518
|
+
}
|
|
519
|
+
function convertServerArgument(arg) {
|
|
520
|
+
if (arg.type === 'positional') {
|
|
521
|
+
return {
|
|
522
|
+
...arg,
|
|
523
|
+
valueHint: arg.value_hint,
|
|
524
|
+
isRepeated: arg.is_repeated,
|
|
525
|
+
isRequired: arg.is_required,
|
|
526
|
+
isSecret: arg.is_secret,
|
|
527
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
return {
|
|
531
|
+
...arg,
|
|
532
|
+
isRepeated: arg.is_repeated,
|
|
533
|
+
isRequired: arg.is_required,
|
|
534
|
+
isSecret: arg.is_secret,
|
|
535
|
+
variables: arg.variables ? convertVariables(arg.variables) : undefined,
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function convertKeyValueInput(input) {
|
|
539
|
+
return {
|
|
540
|
+
...input,
|
|
541
|
+
isRequired: input.is_required,
|
|
542
|
+
isSecret: input.is_secret,
|
|
543
|
+
variables: input.variables ? convertVariables(input.variables) : undefined,
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function convertTransport(input) {
|
|
547
|
+
switch (input.type) {
|
|
548
|
+
case 'stdio':
|
|
549
|
+
return {
|
|
550
|
+
type: TransportType.STDIO,
|
|
551
|
+
};
|
|
552
|
+
case 'streamable-http':
|
|
553
|
+
return {
|
|
554
|
+
type: TransportType.STREAMABLE_HTTP,
|
|
555
|
+
url: input.url,
|
|
556
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
557
|
+
};
|
|
558
|
+
case 'sse':
|
|
559
|
+
return {
|
|
560
|
+
type: TransportType.SSE,
|
|
561
|
+
url: input.url,
|
|
562
|
+
headers: input.headers?.map(convertKeyValueInput),
|
|
563
|
+
};
|
|
564
|
+
default:
|
|
565
|
+
return undefined;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function convertRegistryType(input) {
|
|
569
|
+
switch (input) {
|
|
570
|
+
case 'npm':
|
|
571
|
+
return RegistryType.NODE;
|
|
572
|
+
case 'docker':
|
|
573
|
+
case 'docker-hub':
|
|
574
|
+
case 'oci':
|
|
575
|
+
return RegistryType.DOCKER;
|
|
576
|
+
case 'pypi':
|
|
577
|
+
return RegistryType.PYTHON;
|
|
578
|
+
case 'nuget':
|
|
579
|
+
return RegistryType.NUGET;
|
|
580
|
+
case 'mcpb':
|
|
581
|
+
return RegistryType.MCPB;
|
|
582
|
+
default:
|
|
583
|
+
return RegistryType.NODE;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return {
|
|
587
|
+
name: from.name,
|
|
588
|
+
description: from.description,
|
|
589
|
+
repository: from.repository ? {
|
|
590
|
+
url: from.repository.url,
|
|
591
|
+
source: from.repository.source,
|
|
592
|
+
id: from.repository.id,
|
|
593
|
+
readme: from.repository.readme
|
|
594
|
+
} : undefined,
|
|
595
|
+
version: from.version,
|
|
596
|
+
createdAt: from.created_at,
|
|
597
|
+
updatedAt: from.updated_at,
|
|
598
|
+
packages: from.packages?.map(p => ({
|
|
599
|
+
identifier: p.identifier ?? p.name,
|
|
600
|
+
registryType: convertRegistryType(p.registry_type ?? p.registry_name),
|
|
601
|
+
version: p.version,
|
|
602
|
+
fileSha256: p.file_sha256,
|
|
603
|
+
registryBaseUrl: p.registry_base_url,
|
|
604
|
+
transport: p.transport ? convertTransport(p.transport) : undefined,
|
|
605
|
+
packageArguments: p.package_arguments?.map(convertServerArgument),
|
|
606
|
+
runtimeHint: p.runtime_hint,
|
|
607
|
+
runtimeArguments: p.runtime_arguments?.map(convertServerArgument),
|
|
608
|
+
environmentVariables: p.environment_variables?.map(convertKeyValueInput),
|
|
609
|
+
})),
|
|
610
|
+
remotes: from.remotes?.map(remote => {
|
|
611
|
+
const type = remote.type ?? remote.transport_type ?? remote.transport;
|
|
612
|
+
return {
|
|
613
|
+
type: type === TransportType.SSE ? TransportType.SSE : TransportType.STREAMABLE_HTTP,
|
|
614
|
+
url: remote.url,
|
|
615
|
+
headers: remote.headers?.map(convertKeyValueInput)
|
|
616
|
+
};
|
|
617
|
+
}),
|
|
618
|
+
registryInfo: {
|
|
619
|
+
id: registryInfo.id,
|
|
620
|
+
isLatest: registryInfo.is_latest,
|
|
621
|
+
publishedAt: registryInfo.published_at,
|
|
622
|
+
updatedAt: registryInfo.updated_at,
|
|
623
|
+
},
|
|
624
|
+
githubInfo: from._meta['io.modelcontextprotocol.registry/publisher-provided']?.github,
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
McpServerSchemaVersion_2025_07_09.SERIALIZER = ( new Serializer());
|
|
629
|
+
})(McpServerSchemaVersion_2025_07_09 || (McpServerSchemaVersion_2025_07_09 = {}));
|
|
630
|
+
var McpServerSchemaVersion_2025_16_09;
|
|
631
|
+
(function (McpServerSchemaVersion_2025_16_09) {
|
|
632
|
+
McpServerSchemaVersion_2025_16_09.VERSION = '2025-16-09';
|
|
633
|
+
McpServerSchemaVersion_2025_16_09.SCHEMA = `https://static.modelcontextprotocol.io/schemas/${McpServerSchemaVersion_2025_16_09.VERSION}/server.schema.json`;
|
|
634
|
+
class Serializer {
|
|
635
|
+
toRawGalleryMcpServerResult(input) {
|
|
636
|
+
if (!input || !Array.isArray(input.servers)) {
|
|
637
|
+
return undefined;
|
|
638
|
+
}
|
|
639
|
+
const from = input;
|
|
640
|
+
const servers = [];
|
|
641
|
+
for (const server of from.servers) {
|
|
642
|
+
const rawServer = this.toRawGalleryMcpServer(server);
|
|
643
|
+
if (!rawServer) {
|
|
644
|
+
return undefined;
|
|
645
|
+
}
|
|
646
|
+
servers.push(rawServer);
|
|
647
|
+
}
|
|
648
|
+
return {
|
|
649
|
+
metadata: from.metadata,
|
|
650
|
+
servers
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
toRawGalleryMcpServer(input) {
|
|
654
|
+
if (!input || input.$schema !== McpServerSchemaVersion_2025_16_09.SCHEMA) {
|
|
655
|
+
return undefined;
|
|
656
|
+
}
|
|
657
|
+
const from = input;
|
|
658
|
+
return {
|
|
659
|
+
name: from.name,
|
|
660
|
+
description: from.description,
|
|
661
|
+
repository: from.repository ? {
|
|
662
|
+
url: from.repository.url,
|
|
663
|
+
source: from.repository.source,
|
|
664
|
+
id: from.repository.id,
|
|
665
|
+
readme: from.repository.readme
|
|
666
|
+
} : undefined,
|
|
667
|
+
version: from.version,
|
|
668
|
+
status: from.status,
|
|
669
|
+
websiteUrl: from.websiteUrl,
|
|
670
|
+
createdAt: from.createdAt,
|
|
671
|
+
updatedAt: from.updatedAt,
|
|
672
|
+
packages: from.packages,
|
|
673
|
+
remotes: from.remotes,
|
|
674
|
+
registryInfo: from._meta?.['io.modelcontextprotocol.registry/official'],
|
|
675
|
+
githubInfo: from._meta['io.modelcontextprotocol.registry/publisher-provided']?.github,
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
McpServerSchemaVersion_2025_16_09.SERIALIZER = ( new Serializer());
|
|
680
|
+
})(McpServerSchemaVersion_2025_16_09 || (McpServerSchemaVersion_2025_16_09 = {}));
|
|
28
681
|
const DefaultPageSize = 50;
|
|
29
682
|
const DefaultQueryState = {
|
|
30
683
|
pageSize: DefaultPageSize,
|
|
@@ -35,6 +688,7 @@ class Query {
|
|
|
35
688
|
}
|
|
36
689
|
get pageSize() { return this.state.pageSize; }
|
|
37
690
|
get searchText() { return this.state.searchText; }
|
|
691
|
+
get cursor() { return this.state.cursor; }
|
|
38
692
|
withPage(cursor, pageSize = this.pageSize) {
|
|
39
693
|
return ( new Query({ ...this.state, pageSize, cursor }));
|
|
40
694
|
}
|
|
@@ -43,13 +697,18 @@ class Query {
|
|
|
43
697
|
}
|
|
44
698
|
}
|
|
45
699
|
let McpGalleryService = class McpGalleryService extends Disposable {
|
|
46
|
-
constructor(requestService, fileService,
|
|
700
|
+
constructor(requestService, fileService, logService, mcpGalleryManifestService) {
|
|
47
701
|
super();
|
|
48
702
|
this.requestService = requestService;
|
|
49
703
|
this.fileService = fileService;
|
|
50
|
-
this.productService = productService;
|
|
51
704
|
this.logService = logService;
|
|
52
705
|
this.mcpGalleryManifestService = mcpGalleryManifestService;
|
|
706
|
+
this.galleryMcpServerDataSerializers = ( new Map());
|
|
707
|
+
this.galleryMcpServerDataSerializers.set(McpServerSchemaVersion_2025_07_09.VERSION, McpServerSchemaVersion_2025_07_09.SERIALIZER);
|
|
708
|
+
this.galleryMcpServerDataSerializers.set(McpServerSchemaVersion_2025_01_09.VERSION, McpServerSchemaVersion_2025_01_09.SERIALIZER);
|
|
709
|
+
this.galleryMcpServerDataSerializers.set('old', McpServerOldSchema.SERIALIZER);
|
|
710
|
+
this.galleryMcpServerDataSerializers.set('1es', McpServer1ESSchema.SERIALIZER);
|
|
711
|
+
this.galleryMcpServerDataSerializers.set(McpServerSchemaVersion_2025_16_09.VERSION, McpServerSchemaVersion_2025_16_09.SERIALIZER);
|
|
53
712
|
}
|
|
54
713
|
isEnabled() {
|
|
55
714
|
return this.mcpGalleryManifestService.mcpGalleryManifestStatus === McpGalleryManifestStatus.Available;
|
|
@@ -59,14 +718,17 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
59
718
|
if (!mcpGalleryManifest) {
|
|
60
719
|
return singlePagePager([]);
|
|
61
720
|
}
|
|
62
|
-
|
|
721
|
+
let query = ( new Query());
|
|
722
|
+
if (options?.text) {
|
|
723
|
+
query = query.withSearchText(options.text.trim());
|
|
724
|
+
}
|
|
63
725
|
const { servers, metadata } = await this.queryGalleryMcpServers(query, mcpGalleryManifest, token);
|
|
64
726
|
const total = metadata?.total ?? metadata?.count ?? servers.length;
|
|
65
727
|
const getNextPage = async (cursor, ct) => {
|
|
66
728
|
if (ct.isCancellationRequested) {
|
|
67
729
|
throw ( new CancellationError());
|
|
68
730
|
}
|
|
69
|
-
const { servers, metadata } = cursor ? await this.queryGalleryMcpServers(query.withPage(cursor), mcpGalleryManifest, token) : { servers: [], metadata: undefined };
|
|
731
|
+
const { servers, metadata } = cursor ? await this.queryGalleryMcpServers(query.withPage(cursor).withSearchText(undefined), mcpGalleryManifest, token) : { servers: [], metadata: undefined };
|
|
70
732
|
return {
|
|
71
733
|
elements: servers,
|
|
72
734
|
total,
|
|
@@ -99,10 +761,6 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
99
761
|
})));
|
|
100
762
|
return mcpServers;
|
|
101
763
|
}
|
|
102
|
-
async getMcpServersFromVSCodeGallery(names) {
|
|
103
|
-
const servers = await this.fetchMcpServersFromVSCodeGallery();
|
|
104
|
-
return servers.filter(item => names.includes(item.name));
|
|
105
|
-
}
|
|
106
764
|
async getMcpServerConfiguration(gallery, token) {
|
|
107
765
|
if (gallery.configuration) {
|
|
108
766
|
return gallery.configuration;
|
|
@@ -118,7 +776,10 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
118
776
|
if (!result) {
|
|
119
777
|
throw ( new Error(`Failed to fetch configuration from ${gallery.url}`));
|
|
120
778
|
}
|
|
121
|
-
const server = this.
|
|
779
|
+
const server = this.serializeMcpServer(result);
|
|
780
|
+
if (!server) {
|
|
781
|
+
throw ( new Error(`Failed to serialize MCP server data from ${gallery.url}`, result));
|
|
782
|
+
}
|
|
122
783
|
const configuration = this.toGalleryMcpServerConfiguration(server.packages, server.remotes);
|
|
123
784
|
if (!configuration) {
|
|
124
785
|
throw ( new Error(`Failed to fetch configuration for ${gallery.url}`));
|
|
@@ -128,7 +789,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
128
789
|
async getReadme(gallery, token) {
|
|
129
790
|
const readmeUrl = gallery.readmeUrl;
|
|
130
791
|
if (!readmeUrl) {
|
|
131
|
-
return Promise.resolve(( localize(
|
|
792
|
+
return Promise.resolve(( localize(1973, 'No README available')));
|
|
132
793
|
}
|
|
133
794
|
const uri = ( URI.parse(readmeUrl));
|
|
134
795
|
if (uri.scheme === Schemas.file) {
|
|
@@ -141,7 +802,7 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
141
802
|
}
|
|
142
803
|
}
|
|
143
804
|
if (uri.authority !== 'raw.githubusercontent.com') {
|
|
144
|
-
return ( new MarkdownString(( localize(
|
|
805
|
+
return ( new MarkdownString(( localize(1974, "You can find information about this server [here]({0})", readmeUrl)))).value;
|
|
145
806
|
}
|
|
146
807
|
const context = await this.requestService.request({
|
|
147
808
|
type: 'GET',
|
|
@@ -153,14 +814,14 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
153
814
|
}
|
|
154
815
|
return result;
|
|
155
816
|
}
|
|
156
|
-
toGalleryMcpServer(server,
|
|
157
|
-
const registryInfo = server._meta?.['x-io.modelcontextprotocol.registry'];
|
|
158
|
-
const githubInfo = server._meta?.['github'] ?? server._meta?.['x-github'];
|
|
817
|
+
toGalleryMcpServer(server, manifest) {
|
|
159
818
|
let publisher = '';
|
|
160
819
|
let displayName = '';
|
|
161
|
-
if (githubInfo?.name) {
|
|
162
|
-
displayName = ( githubInfo.name.split('-').map(
|
|
163
|
-
|
|
820
|
+
if (server.githubInfo?.name) {
|
|
821
|
+
displayName = ( server.githubInfo.name.split('-').map(
|
|
822
|
+
s => s.toLowerCase() === 'mcp' ? 'MCP' : s.toLowerCase() === 'github' ? 'GitHub' : uppercaseFirstLetter(s)
|
|
823
|
+
)).join(' ');
|
|
824
|
+
publisher = server.githubInfo.name_with_owner.split('/')[0];
|
|
164
825
|
}
|
|
165
826
|
else {
|
|
166
827
|
const nameParts = server.name.split('/');
|
|
@@ -172,29 +833,36 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
172
833
|
}
|
|
173
834
|
displayName = ( nameParts[nameParts.length - 1].split('-').map(s => uppercaseFirstLetter(s))).join(' ');
|
|
174
835
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
836
|
+
if (server.githubInfo?.display_name) {
|
|
837
|
+
displayName = server.githubInfo.display_name;
|
|
838
|
+
}
|
|
839
|
+
const icon = server.githubInfo?.owner_avatar_url ? {
|
|
840
|
+
light: server.githubInfo.owner_avatar_url,
|
|
841
|
+
dark: server.githubInfo.owner_avatar_url
|
|
178
842
|
} : undefined;
|
|
843
|
+
const serverUrl = manifest ? this.getServerUrl(server.registryInfo.id, manifest) : undefined;
|
|
844
|
+
const webUrl = manifest ? this.getWebUrl(server.name, manifest) : undefined;
|
|
845
|
+
const publisherUrl = manifest ? this.getPublisherUrl(publisher, manifest) : undefined;
|
|
179
846
|
return {
|
|
180
|
-
id: server.id,
|
|
847
|
+
id: server.registryInfo.id,
|
|
181
848
|
name: server.name,
|
|
182
849
|
displayName,
|
|
183
850
|
url: serverUrl,
|
|
851
|
+
webUrl,
|
|
184
852
|
description: server.description,
|
|
185
853
|
status: server.status ?? GalleryMcpServerStatus.Active,
|
|
186
|
-
version: server.
|
|
187
|
-
isLatest: server.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
lastUpdated: registryInfo ? Date.parse(registryInfo.updated_at) : undefined,
|
|
854
|
+
version: server.version,
|
|
855
|
+
isLatest: server.registryInfo.isLatest,
|
|
856
|
+
publishDate: server.registryInfo.publishedAt ? Date.parse(server.registryInfo.publishedAt) : undefined,
|
|
857
|
+
lastUpdated: server.githubInfo?.pushed_at ? Date.parse(server.githubInfo.pushed_at) : server.registryInfo ? Date.parse(server.registryInfo.updatedAt) : undefined,
|
|
191
858
|
repositoryUrl: server.repository?.url,
|
|
192
859
|
readme: server.repository?.readme,
|
|
193
860
|
icon,
|
|
194
861
|
publisher,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
862
|
+
publisherUrl,
|
|
863
|
+
license: server.githubInfo?.license,
|
|
864
|
+
starsCount: server.githubInfo?.stargazer_count,
|
|
865
|
+
topics: server.githubInfo?.topics,
|
|
198
866
|
configuration: this.toGalleryMcpServerConfiguration(server.packages, server.remotes)
|
|
199
867
|
};
|
|
200
868
|
}
|
|
@@ -203,30 +871,19 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
203
871
|
return undefined;
|
|
204
872
|
}
|
|
205
873
|
return {
|
|
206
|
-
packages
|
|
207
|
-
...p,
|
|
208
|
-
identifier: p.identifier ?? p.name,
|
|
209
|
-
registry_type: p.registry_type ?? p.registry_name
|
|
210
|
-
})),
|
|
874
|
+
packages,
|
|
211
875
|
remotes
|
|
212
876
|
};
|
|
213
877
|
}
|
|
214
878
|
async queryGalleryMcpServers(query, mcpGalleryManifest, token) {
|
|
215
|
-
if (mcpGalleryManifest.url === this.productService.extensionsGallery?.mcpUrl) {
|
|
216
|
-
return {
|
|
217
|
-
servers: await this.fetchMcpServersFromVSCodeGallery()
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
879
|
const { servers, metadata } = await this.queryRawGalleryMcpServers(query, mcpGalleryManifest, token);
|
|
221
880
|
return {
|
|
222
|
-
servers: ( servers.map(
|
|
223
|
-
item => this.toGalleryMcpServer(item, this.getServerUrl(item.id, mcpGalleryManifest))
|
|
224
|
-
)),
|
|
881
|
+
servers: ( servers.map(item => this.toGalleryMcpServer(item, mcpGalleryManifest))),
|
|
225
882
|
metadata
|
|
226
883
|
};
|
|
227
884
|
}
|
|
228
885
|
async queryRawGalleryMcpServers(query, mcpGalleryManifest, token) {
|
|
229
|
-
const mcpGalleryUrl = this.getMcpGalleryUrl(mcpGalleryManifest);
|
|
886
|
+
const mcpGalleryUrl = query.searchText ? this.getSearchUrl(mcpGalleryManifest) : this.getMcpGalleryUrl(mcpGalleryManifest);
|
|
230
887
|
if (!mcpGalleryUrl) {
|
|
231
888
|
return { servers: [] };
|
|
232
889
|
}
|
|
@@ -241,24 +898,29 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
241
898
|
this.logService.error(`Failed to read file from ${uri}: ${error}`);
|
|
242
899
|
}
|
|
243
900
|
}
|
|
244
|
-
|
|
901
|
+
let url = `${mcpGalleryUrl}?limit=${query.pageSize}`;
|
|
902
|
+
if (query.cursor) {
|
|
903
|
+
url += `&cursor=${query.cursor}`;
|
|
904
|
+
}
|
|
905
|
+
if (query.searchText) {
|
|
906
|
+
const text = encodeURIComponent(query.searchText);
|
|
907
|
+
url += `&q=${text}`;
|
|
908
|
+
}
|
|
245
909
|
const context = await this.requestService.request({
|
|
246
910
|
type: 'GET',
|
|
247
911
|
url,
|
|
248
912
|
}, token);
|
|
249
|
-
const
|
|
250
|
-
if (!
|
|
913
|
+
const data = await asJson(context);
|
|
914
|
+
if (!data) {
|
|
251
915
|
return { servers: [] };
|
|
252
916
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
metadata: result.metadata
|
|
257
|
-
};
|
|
917
|
+
const result = this.serializeMcpServersResult(data);
|
|
918
|
+
if (!result) {
|
|
919
|
+
throw ( new Error(`Failed to serialize MCP servers result from ${mcpGalleryUrl}`, data));
|
|
258
920
|
}
|
|
259
921
|
return result;
|
|
260
922
|
}
|
|
261
|
-
async getMcpServer(mcpServerUrl) {
|
|
923
|
+
async getMcpServer(mcpServerUrl, mcpGalleryManifest) {
|
|
262
924
|
const context = await this.requestService.request({
|
|
263
925
|
type: 'GET',
|
|
264
926
|
url: mcpServerUrl,
|
|
@@ -266,77 +928,106 @@ let McpGalleryService = class McpGalleryService extends Disposable {
|
|
|
266
928
|
if (context.res.statusCode && context.res.statusCode >= 400 && context.res.statusCode < 500) {
|
|
267
929
|
return undefined;
|
|
268
930
|
}
|
|
269
|
-
const
|
|
270
|
-
if (!
|
|
931
|
+
const data = await asJson(context);
|
|
932
|
+
if (!data) {
|
|
271
933
|
return undefined;
|
|
272
934
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
'x-publisher': from['x-publisher']
|
|
283
|
-
}
|
|
284
|
-
};
|
|
935
|
+
const server = this.serializeMcpServer(data);
|
|
936
|
+
if (!server) {
|
|
937
|
+
throw ( new Error(`Failed to serialize MCP server from ${mcpServerUrl}`, data));
|
|
938
|
+
}
|
|
939
|
+
if (!mcpGalleryManifest) {
|
|
940
|
+
mcpGalleryManifest = await this.mcpGalleryManifestService.getMcpGalleryManifest();
|
|
941
|
+
if (mcpGalleryManifest && mcpServerUrl !== this.getServerUrl(basename(mcpServerUrl), mcpGalleryManifest)) {
|
|
942
|
+
mcpGalleryManifest = null;
|
|
943
|
+
}
|
|
285
944
|
}
|
|
286
|
-
return
|
|
945
|
+
return this.toGalleryMcpServer(server, mcpGalleryManifest);
|
|
287
946
|
}
|
|
288
|
-
async
|
|
289
|
-
const
|
|
290
|
-
if (!
|
|
291
|
-
return
|
|
947
|
+
async getMcpServerByName(name) {
|
|
948
|
+
const mcpGalleryManifest = await this.mcpGalleryManifestService.getMcpGalleryManifest();
|
|
949
|
+
if (!mcpGalleryManifest) {
|
|
950
|
+
return undefined;
|
|
951
|
+
}
|
|
952
|
+
const mcpServerUrl = this.getNamedServerUrl(name, mcpGalleryManifest);
|
|
953
|
+
if (!mcpServerUrl) {
|
|
954
|
+
return undefined;
|
|
292
955
|
}
|
|
293
956
|
const context = await this.requestService.request({
|
|
294
957
|
type: 'GET',
|
|
295
|
-
url:
|
|
958
|
+
url: mcpServerUrl,
|
|
296
959
|
}, CancellationToken.None);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return [];
|
|
960
|
+
if (context.res.statusCode && context.res.statusCode >= 400 && context.res.statusCode < 500) {
|
|
961
|
+
return undefined;
|
|
300
962
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
963
|
+
const data = await asJson(context);
|
|
964
|
+
if (!data) {
|
|
965
|
+
return undefined;
|
|
966
|
+
}
|
|
967
|
+
const server = this.serializeMcpServer(data);
|
|
968
|
+
if (!server) {
|
|
969
|
+
throw ( new Error(`Failed to serialize MCP server from ${mcpServerUrl}`, data));
|
|
970
|
+
}
|
|
971
|
+
return this.toGalleryMcpServer(server, mcpGalleryManifest);
|
|
972
|
+
}
|
|
973
|
+
serializeMcpServer(data) {
|
|
974
|
+
for (const [, serializer] of this.galleryMcpServerDataSerializers) {
|
|
975
|
+
const result = serializer.toRawGalleryMcpServer(data);
|
|
976
|
+
if (result) {
|
|
977
|
+
return result;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return undefined;
|
|
981
|
+
}
|
|
982
|
+
serializeMcpServersResult(data) {
|
|
983
|
+
for (const [, serializer] of this.galleryMcpServerDataSerializers) {
|
|
984
|
+
const result = serializer.toRawGalleryMcpServerResult(data);
|
|
985
|
+
if (result) {
|
|
986
|
+
return result;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
return undefined;
|
|
322
990
|
}
|
|
323
991
|
getServerUrl(id, mcpGalleryManifest) {
|
|
324
|
-
const resourceUriTemplate = getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.
|
|
992
|
+
const resourceUriTemplate = getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.McpServerResourceUri);
|
|
325
993
|
if (!resourceUriTemplate) {
|
|
326
994
|
return undefined;
|
|
327
995
|
}
|
|
328
996
|
return format2(resourceUriTemplate, { id });
|
|
329
997
|
}
|
|
998
|
+
getNamedServerUrl(name, mcpGalleryManifest) {
|
|
999
|
+
const namedResourceUriTemplate = getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.McpServerNamedResourceUri);
|
|
1000
|
+
if (!namedResourceUriTemplate) {
|
|
1001
|
+
return undefined;
|
|
1002
|
+
}
|
|
1003
|
+
return format2(namedResourceUriTemplate, { name });
|
|
1004
|
+
}
|
|
1005
|
+
getSearchUrl(mcpGalleryManifest) {
|
|
1006
|
+
return getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.McpServersSearchService);
|
|
1007
|
+
}
|
|
1008
|
+
getWebUrl(name, mcpGalleryManifest) {
|
|
1009
|
+
const resourceUriTemplate = getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.McpServerWebUri);
|
|
1010
|
+
if (!resourceUriTemplate) {
|
|
1011
|
+
return undefined;
|
|
1012
|
+
}
|
|
1013
|
+
return format2(resourceUriTemplate, { name });
|
|
1014
|
+
}
|
|
1015
|
+
getPublisherUrl(name, mcpGalleryManifest) {
|
|
1016
|
+
const resourceUriTemplate = getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.PublisherUriTemplate);
|
|
1017
|
+
if (!resourceUriTemplate) {
|
|
1018
|
+
return undefined;
|
|
1019
|
+
}
|
|
1020
|
+
return format2(resourceUriTemplate, { name });
|
|
1021
|
+
}
|
|
330
1022
|
getMcpGalleryUrl(mcpGalleryManifest) {
|
|
331
|
-
return getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.
|
|
1023
|
+
return getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.McpServersQueryService);
|
|
332
1024
|
}
|
|
333
1025
|
};
|
|
334
1026
|
McpGalleryService = ( __decorate([
|
|
335
1027
|
( __param(0, IRequestService)),
|
|
336
1028
|
( __param(1, IFileService)),
|
|
337
|
-
( __param(2,
|
|
338
|
-
( __param(3,
|
|
339
|
-
( __param(4, IMcpGalleryManifestService))
|
|
1029
|
+
( __param(2, ILogService)),
|
|
1030
|
+
( __param(3, IMcpGalleryManifestService))
|
|
340
1031
|
], McpGalleryService));
|
|
341
1032
|
|
|
342
1033
|
export { McpGalleryService };
|