@codingame/monaco-vscode-mcp-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/platform/mcp/common/allowedMcpServersService.js +5 -5
- package/vscode/src/vs/platform/mcp/common/mcpGalleryManifestService.js +20 -30
- package/vscode/src/vs/platform/mcp/common/mcpGalleryService.js +195 -135
- package/vscode/src/vs/platform/mcp/common/mcpManagementIpc.js +65 -26
- package/vscode/src/vs/platform/mcp/common/mcpManagementService.js +222 -139
- package/vscode/src/vs/platform/mcp/common/mcpResourceScannerService.js +45 -34
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +65 -32
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpAddContextContribution.js +11 -14
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.d.ts +7 -1
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpCommands.js +437 -362
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpDiscovery.js +4 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpElicitationService.js +298 -160
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +184 -141
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpMigration.js +52 -56
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpResourceQuickAccess.js +169 -118
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerActions.js +369 -237
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditor.js +425 -252
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerEditorInput.js +9 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerIcons.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServerWidgets.js +127 -91
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpServersView.js +229 -160
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpWorkbenchService.js +220 -120
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +28 -27
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.js +33 -26
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +31 -29
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +43 -20
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpRemoteDiscovery.js +20 -13
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +21 -16
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigFileUtils.js +4 -4
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.js +32 -27
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.service.js +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpLanguageModelToolContribution.js +157 -81
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +208 -139
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistryInputStorage.js +42 -25
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.js +86 -50
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingLog.js +31 -23
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.js +124 -74
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +46 -23
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +282 -195
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +59 -35
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.js +22 -23
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.js +109 -73
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpUsageService.js +14 -17
- package/vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.d.ts +1 -1
- package/vscode/src/vs/workbench/services/mcp/browser/mcpGalleryManifestService.js +25 -21
- package/vscode/src/vs/workbench/services/mcp/browser/mcpWorkbenchManagementService.js +24 -13
- package/vscode/src/vs/workbench/services/mcp/common/mcpWorkbenchManagementService.js +215 -108
- package/vscode/src/vs/base/common/uriTransformer.d.ts +0 -2
- package/vscode/src/vs/base/common/uriTransformer.js +0 -39
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpDevMode.js +0 -90
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpIcons.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpIcons.js +0 -107
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +0 -206
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +0 -886
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTaskManager.d.ts +0 -68
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTaskManager.js +0 -168
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.js +0 -296
|
@@ -30,17 +30,24 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
30
30
|
}
|
|
31
31
|
getMcpServerConfigurationFromManifest(manifest, packageType) {
|
|
32
32
|
if (packageType === RegistryType.REMOTE && manifest.remotes?.length) {
|
|
33
|
-
const
|
|
33
|
+
const url = manifest.remotes[0].url;
|
|
34
|
+
const headers = manifest.remotes[0].headers ?? [];
|
|
35
|
+
const {
|
|
36
|
+
inputs,
|
|
37
|
+
variables
|
|
38
|
+
} = this.processKeyValueInputs(
|
|
39
|
+
url.startsWith("https://api.githubcopilot.com/mcp") ? headers.filter(h => h.name.toLowerCase() !== "authorization") : headers
|
|
40
|
+
);
|
|
34
41
|
return {
|
|
35
42
|
mcpServerConfiguration: {
|
|
36
43
|
config: {
|
|
37
44
|
type: McpServerType.REMOTE,
|
|
38
45
|
url: manifest.remotes[0].url,
|
|
39
|
-
headers: ( Object.keys(inputs)).length ? inputs : undefined
|
|
46
|
+
headers: ( Object.keys(inputs)).length ? inputs : undefined
|
|
40
47
|
},
|
|
41
|
-
inputs: variables.length ? variables : undefined
|
|
48
|
+
inputs: variables.length ? variables : undefined
|
|
42
49
|
},
|
|
43
|
-
notices: []
|
|
50
|
+
notices: []
|
|
44
51
|
};
|
|
45
52
|
}
|
|
46
53
|
const serverPackage = manifest.packages?.find(p => p.registryType === packageType) ?? manifest.packages?.[0];
|
|
@@ -52,9 +59,9 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
52
59
|
const env = {};
|
|
53
60
|
const notices = [];
|
|
54
61
|
if (serverPackage.registryType === RegistryType.DOCKER) {
|
|
55
|
-
args.push(
|
|
56
|
-
args.push(
|
|
57
|
-
args.push(
|
|
62
|
+
args.push("run");
|
|
63
|
+
args.push("-i");
|
|
64
|
+
args.push("--rm");
|
|
58
65
|
}
|
|
59
66
|
if (serverPackage.runtimeArguments?.length) {
|
|
60
67
|
const result = this.processArguments(serverPackage.runtimeArguments ?? []);
|
|
@@ -63,34 +70,58 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
63
70
|
notices.push(...result.notices);
|
|
64
71
|
}
|
|
65
72
|
if (serverPackage.environmentVariables?.length) {
|
|
66
|
-
const {
|
|
73
|
+
const {
|
|
74
|
+
inputs: envInputs,
|
|
75
|
+
variables: envVariables,
|
|
76
|
+
notices: envNotices
|
|
77
|
+
} = this.processKeyValueInputs(serverPackage.environmentVariables ?? []);
|
|
67
78
|
inputs.push(...envVariables);
|
|
68
79
|
notices.push(...envNotices);
|
|
69
80
|
for (const [name, value] of Object.entries(envInputs)) {
|
|
70
81
|
env[name] = value;
|
|
71
82
|
if (serverPackage.registryType === RegistryType.DOCKER) {
|
|
72
|
-
args.push(
|
|
83
|
+
args.push("-e");
|
|
73
84
|
args.push(name);
|
|
74
85
|
}
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
88
|
switch (serverPackage.registryType) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
args.push(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
case RegistryType.NODE:
|
|
90
|
+
if (serverPackage.registryBaseUrl) {
|
|
91
|
+
args.push("--registry", serverPackage.registryBaseUrl);
|
|
92
|
+
}
|
|
93
|
+
args.push(
|
|
94
|
+
serverPackage.version ? `${serverPackage.identifier}@${serverPackage.version}` : serverPackage.identifier
|
|
95
|
+
);
|
|
96
|
+
break;
|
|
97
|
+
case RegistryType.PYTHON:
|
|
98
|
+
if (serverPackage.registryBaseUrl) {
|
|
99
|
+
args.push("--index-url", serverPackage.registryBaseUrl);
|
|
100
|
+
}
|
|
101
|
+
args.push(
|
|
102
|
+
serverPackage.version ? `${serverPackage.identifier}@${serverPackage.version}` : serverPackage.identifier
|
|
103
|
+
);
|
|
104
|
+
break;
|
|
105
|
+
case RegistryType.DOCKER:
|
|
106
|
+
{
|
|
107
|
+
const dockerIdentifier = serverPackage.registryBaseUrl ? `${serverPackage.registryBaseUrl}/${serverPackage.identifier}` : serverPackage.identifier;
|
|
108
|
+
args.push(
|
|
109
|
+
serverPackage.version ? `${dockerIdentifier}:${serverPackage.version}` : dockerIdentifier
|
|
110
|
+
);
|
|
93
111
|
break;
|
|
112
|
+
}
|
|
113
|
+
case RegistryType.NUGET:
|
|
114
|
+
args.push(
|
|
115
|
+
serverPackage.version ? `${serverPackage.identifier}@${serverPackage.version}` : serverPackage.identifier
|
|
116
|
+
);
|
|
117
|
+
args.push("--yes");
|
|
118
|
+
if (serverPackage.registryBaseUrl) {
|
|
119
|
+
args.push("--source", serverPackage.registryBaseUrl);
|
|
120
|
+
}
|
|
121
|
+
if (serverPackage.packageArguments?.length) {
|
|
122
|
+
args.push("--");
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
94
125
|
}
|
|
95
126
|
if (serverPackage.packageArguments?.length) {
|
|
96
127
|
const result = this.processArguments(serverPackage.packageArguments);
|
|
@@ -105,18 +136,22 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
105
136
|
type: McpServerType.LOCAL,
|
|
106
137
|
command: this.getCommandName(serverPackage.registryType),
|
|
107
138
|
args: args.length ? args : undefined,
|
|
108
|
-
env: ( Object.keys(env)).length ? env : undefined
|
|
139
|
+
env: ( Object.keys(env)).length ? env : undefined
|
|
109
140
|
},
|
|
110
|
-
inputs: inputs.length ? inputs : undefined
|
|
141
|
+
inputs: inputs.length ? inputs : undefined
|
|
111
142
|
}
|
|
112
143
|
};
|
|
113
144
|
}
|
|
114
145
|
getCommandName(packageType) {
|
|
115
146
|
switch (packageType) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
147
|
+
case RegistryType.NODE:
|
|
148
|
+
return "npx";
|
|
149
|
+
case RegistryType.DOCKER:
|
|
150
|
+
return "docker";
|
|
151
|
+
case RegistryType.PYTHON:
|
|
152
|
+
return "uvx";
|
|
153
|
+
case RegistryType.NUGET:
|
|
154
|
+
return "dnx";
|
|
120
155
|
}
|
|
121
156
|
return packageType;
|
|
122
157
|
}
|
|
@@ -126,10 +161,10 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
126
161
|
variables.push({
|
|
127
162
|
id: key,
|
|
128
163
|
type: value.choices ? McpServerVariableType.PICK : McpServerVariableType.PROMPT,
|
|
129
|
-
description: value.description ??
|
|
164
|
+
description: value.description ?? "",
|
|
130
165
|
password: !!value.isSecret,
|
|
131
166
|
default: value.default,
|
|
132
|
-
options: value.choices
|
|
167
|
+
options: value.choices
|
|
133
168
|
});
|
|
134
169
|
}
|
|
135
170
|
return variables;
|
|
@@ -140,27 +175,30 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
140
175
|
const variables = [];
|
|
141
176
|
for (const input of keyValueInputs) {
|
|
142
177
|
const inputVariables = input.variables ? this.getVariables(input.variables) : [];
|
|
143
|
-
let value = input.value ||
|
|
178
|
+
let value = input.value || "";
|
|
144
179
|
if (inputVariables.length) {
|
|
145
180
|
for (const variable of inputVariables) {
|
|
146
181
|
value = value.replace(`{${variable.id}}`, `\${input:${variable.id}}`);
|
|
147
182
|
}
|
|
148
183
|
variables.push(...inputVariables);
|
|
149
|
-
}
|
|
150
|
-
else if (!value && (input.description || input.choices || input.default !== undefined)) {
|
|
184
|
+
} else if (!value && (input.description || input.choices || input.default !== undefined)) {
|
|
151
185
|
variables.push({
|
|
152
186
|
id: input.name,
|
|
153
187
|
type: input.choices ? McpServerVariableType.PICK : McpServerVariableType.PROMPT,
|
|
154
|
-
description: input.description ??
|
|
188
|
+
description: input.description ?? "",
|
|
155
189
|
password: !!input.isSecret,
|
|
156
190
|
default: input.default,
|
|
157
|
-
options: input.choices
|
|
191
|
+
options: input.choices
|
|
158
192
|
});
|
|
159
193
|
value = `\${input:${input.name}}`;
|
|
160
194
|
}
|
|
161
195
|
inputs[input.name] = value;
|
|
162
196
|
}
|
|
163
|
-
return {
|
|
197
|
+
return {
|
|
198
|
+
inputs,
|
|
199
|
+
variables,
|
|
200
|
+
notices
|
|
201
|
+
};
|
|
164
202
|
}
|
|
165
203
|
processArguments(argumentsList) {
|
|
166
204
|
const args = [];
|
|
@@ -168,7 +206,7 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
168
206
|
const notices = [];
|
|
169
207
|
for (const arg of argumentsList) {
|
|
170
208
|
const argVariables = arg.variables ? this.getVariables(arg.variables) : [];
|
|
171
|
-
if (arg.type ===
|
|
209
|
+
if (arg.type === "positional") {
|
|
172
210
|
let value = arg.value;
|
|
173
211
|
if (value) {
|
|
174
212
|
for (const variable of argVariables) {
|
|
@@ -178,22 +216,19 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
178
216
|
if (argVariables.length) {
|
|
179
217
|
variables.push(...argVariables);
|
|
180
218
|
}
|
|
181
|
-
}
|
|
182
|
-
else if (arg.valueHint && (arg.description || arg.default !== undefined)) {
|
|
219
|
+
} else if (arg.valueHint && (arg.description || arg.default !== undefined)) {
|
|
183
220
|
variables.push({
|
|
184
221
|
id: arg.valueHint,
|
|
185
222
|
type: McpServerVariableType.PROMPT,
|
|
186
|
-
description: arg.description ??
|
|
223
|
+
description: arg.description ?? "",
|
|
187
224
|
password: false,
|
|
188
|
-
default: arg.default
|
|
225
|
+
default: arg.default
|
|
189
226
|
});
|
|
190
227
|
args.push(`\${input:${arg.valueHint}}`);
|
|
228
|
+
} else {
|
|
229
|
+
args.push(arg.valueHint ?? "");
|
|
191
230
|
}
|
|
192
|
-
|
|
193
|
-
args.push(arg.valueHint ?? '');
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
else if (arg.type === 'named') {
|
|
231
|
+
} else if (arg.type === "named") {
|
|
197
232
|
if (!arg.name) {
|
|
198
233
|
notices.push(`Named argument is missing a name. ${JSON.stringify(arg)}`);
|
|
199
234
|
continue;
|
|
@@ -208,32 +243,49 @@ let AbstractCommonMcpManagementService = class AbstractCommonMcpManagementServic
|
|
|
208
243
|
if (argVariables.length) {
|
|
209
244
|
variables.push(...argVariables);
|
|
210
245
|
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const variableId = arg.name.replace(/^--?/, '');
|
|
246
|
+
} else if (arg.description || arg.default !== undefined) {
|
|
247
|
+
const variableId = arg.name.replace(/^--?/, "");
|
|
214
248
|
variables.push({
|
|
215
249
|
id: variableId,
|
|
216
250
|
type: McpServerVariableType.PROMPT,
|
|
217
|
-
description: arg.description ??
|
|
251
|
+
description: arg.description ?? "",
|
|
218
252
|
password: false,
|
|
219
|
-
default: arg.default
|
|
253
|
+
default: arg.default
|
|
220
254
|
});
|
|
221
255
|
args.push(`\${input:${variableId}}`);
|
|
222
256
|
}
|
|
223
257
|
}
|
|
224
258
|
}
|
|
225
|
-
return {
|
|
259
|
+
return {
|
|
260
|
+
args,
|
|
261
|
+
variables,
|
|
262
|
+
notices
|
|
263
|
+
};
|
|
226
264
|
}
|
|
227
265
|
};
|
|
228
|
-
AbstractCommonMcpManagementService = ( __decorate([
|
|
229
|
-
( __param(0, ILogService))
|
|
230
|
-
], AbstractCommonMcpManagementService));
|
|
266
|
+
AbstractCommonMcpManagementService = ( __decorate([( __param(0, ILogService))], AbstractCommonMcpManagementService));
|
|
231
267
|
let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementService extends AbstractCommonMcpManagementService {
|
|
232
|
-
get onDidInstallMcpServers() {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
get
|
|
236
|
-
|
|
268
|
+
get onDidInstallMcpServers() {
|
|
269
|
+
return this._onDidInstallMcpServers.event;
|
|
270
|
+
}
|
|
271
|
+
get onDidUpdateMcpServers() {
|
|
272
|
+
return this._onDidUpdateMcpServers.event;
|
|
273
|
+
}
|
|
274
|
+
get onUninstallMcpServer() {
|
|
275
|
+
return this._onUninstallMcpServer.event;
|
|
276
|
+
}
|
|
277
|
+
get onDidUninstallMcpServer() {
|
|
278
|
+
return this._onDidUninstallMcpServer.event;
|
|
279
|
+
}
|
|
280
|
+
constructor(
|
|
281
|
+
mcpResource,
|
|
282
|
+
target,
|
|
283
|
+
mcpGalleryService,
|
|
284
|
+
fileService,
|
|
285
|
+
uriIdentityService,
|
|
286
|
+
logService,
|
|
287
|
+
mcpResourceScannerService
|
|
288
|
+
) {
|
|
237
289
|
super(logService);
|
|
238
290
|
this.mcpResource = mcpResource;
|
|
239
291
|
this.target = target;
|
|
@@ -255,8 +307,7 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
255
307
|
this.initializePromise = (async () => {
|
|
256
308
|
try {
|
|
257
309
|
this.local = await this.populateLocalServers();
|
|
258
|
-
}
|
|
259
|
-
finally {
|
|
310
|
+
} finally {
|
|
260
311
|
this.startWatching();
|
|
261
312
|
}
|
|
262
313
|
})();
|
|
@@ -264,7 +315,10 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
264
315
|
return this.initializePromise;
|
|
265
316
|
}
|
|
266
317
|
async populateLocalServers() {
|
|
267
|
-
this.logService.trace(
|
|
318
|
+
this.logService.trace(
|
|
319
|
+
"AbstractMcpResourceManagementService#populateLocalServers",
|
|
320
|
+
( this.mcpResource.toString())
|
|
321
|
+
);
|
|
268
322
|
const local = ( new Map());
|
|
269
323
|
try {
|
|
270
324
|
const scannedMcpServers = await this.mcpResourceScannerService.scanMcpServers(this.mcpResource, this.target);
|
|
@@ -274,9 +328,8 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
274
328
|
local.set(name, server);
|
|
275
329
|
})));
|
|
276
330
|
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
this.logService.debug('Could not read user MCP servers:', error);
|
|
331
|
+
} catch (error) {
|
|
332
|
+
this.logService.debug("Could not read user MCP servers:", error);
|
|
280
333
|
throw error;
|
|
281
334
|
}
|
|
282
335
|
return local;
|
|
@@ -305,29 +358,34 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
305
358
|
updated.push(server);
|
|
306
359
|
this.local.set(name, server);
|
|
307
360
|
}
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
361
|
+
} else {
|
|
310
362
|
added.push(server);
|
|
311
363
|
this.local.set(name, server);
|
|
312
364
|
}
|
|
313
365
|
}
|
|
314
366
|
for (const server of removed) {
|
|
315
367
|
this.local.delete(server);
|
|
316
|
-
this._onDidUninstallMcpServer.fire({
|
|
368
|
+
this._onDidUninstallMcpServer.fire({
|
|
369
|
+
name: server,
|
|
370
|
+
mcpResource: this.mcpResource
|
|
371
|
+
});
|
|
317
372
|
}
|
|
318
373
|
if (updated.length) {
|
|
319
|
-
this._onDidUpdateMcpServers.fire(( updated.map(
|
|
320
|
-
|
|
321
|
-
|
|
374
|
+
this._onDidUpdateMcpServers.fire(( updated.map(server => ({
|
|
375
|
+
name: server.name,
|
|
376
|
+
local: server,
|
|
377
|
+
mcpResource: this.mcpResource
|
|
378
|
+
}))));
|
|
322
379
|
}
|
|
323
380
|
if (added.length) {
|
|
324
|
-
this._onDidInstallMcpServers.fire(( added.map(
|
|
325
|
-
|
|
326
|
-
|
|
381
|
+
this._onDidInstallMcpServers.fire(( added.map(server => ({
|
|
382
|
+
name: server.name,
|
|
383
|
+
local: server,
|
|
384
|
+
mcpResource: this.mcpResource
|
|
385
|
+
}))));
|
|
327
386
|
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
this.logService.error('Failed to load installed MCP servers:', error);
|
|
387
|
+
} catch (error) {
|
|
388
|
+
this.logService.error("Failed to load installed MCP servers:", error);
|
|
331
389
|
}
|
|
332
390
|
}
|
|
333
391
|
async getInstalled() {
|
|
@@ -337,7 +395,11 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
337
395
|
async scanLocalServer(name, config) {
|
|
338
396
|
let mcpServerInfo = await this.getLocalServerInfo(name, config);
|
|
339
397
|
if (!mcpServerInfo) {
|
|
340
|
-
mcpServerInfo = {
|
|
398
|
+
mcpServerInfo = {
|
|
399
|
+
name,
|
|
400
|
+
version: config.version,
|
|
401
|
+
galleryUrl: isString(config.gallery) ? config.gallery : undefined
|
|
402
|
+
};
|
|
341
403
|
}
|
|
342
404
|
return {
|
|
343
405
|
name,
|
|
@@ -356,12 +418,15 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
356
418
|
icon: mcpServerInfo.icon,
|
|
357
419
|
codicon: mcpServerInfo.codicon,
|
|
358
420
|
manifest: mcpServerInfo.manifest,
|
|
359
|
-
source: config.gallery ?
|
|
421
|
+
source: config.gallery ? "gallery" : "local"
|
|
360
422
|
};
|
|
361
423
|
}
|
|
362
424
|
async install(server, options) {
|
|
363
|
-
this.logService.trace(
|
|
364
|
-
this._onInstallMcpServer.fire({
|
|
425
|
+
this.logService.trace("MCP Management Service: install", server.name);
|
|
426
|
+
this._onInstallMcpServer.fire({
|
|
427
|
+
name: server.name,
|
|
428
|
+
mcpResource: this.mcpResource
|
|
429
|
+
});
|
|
365
430
|
try {
|
|
366
431
|
await this.mcpResourceScannerService.addMcpServers([server], this.mcpResource, this.target);
|
|
367
432
|
await this.updateLocal();
|
|
@@ -370,15 +435,21 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
370
435
|
throw ( new Error(`Failed to install MCP server: ${server.name}`));
|
|
371
436
|
}
|
|
372
437
|
return local;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
438
|
+
} catch (e) {
|
|
439
|
+
this._onDidInstallMcpServers.fire([{
|
|
440
|
+
name: server.name,
|
|
441
|
+
error: e,
|
|
442
|
+
mcpResource: this.mcpResource
|
|
443
|
+
}]);
|
|
376
444
|
throw e;
|
|
377
445
|
}
|
|
378
446
|
}
|
|
379
447
|
async uninstall(server, options) {
|
|
380
|
-
this.logService.trace(
|
|
381
|
-
this._onUninstallMcpServer.fire({
|
|
448
|
+
this.logService.trace("MCP Management Service: uninstall", server.name);
|
|
449
|
+
this._onUninstallMcpServer.fire({
|
|
450
|
+
name: server.name,
|
|
451
|
+
mcpResource: this.mcpResource
|
|
452
|
+
});
|
|
382
453
|
try {
|
|
383
454
|
const currentServers = await this.mcpResourceScannerService.scanMcpServers(this.mcpResource, this.target);
|
|
384
455
|
if (!currentServers.servers) {
|
|
@@ -386,30 +457,45 @@ let AbstractMcpResourceManagementService = class AbstractMcpResourceManagementSe
|
|
|
386
457
|
}
|
|
387
458
|
await this.mcpResourceScannerService.removeMcpServers([server.name], this.mcpResource, this.target);
|
|
388
459
|
if (server.location) {
|
|
389
|
-
await this.fileService.del(URI.revive(server.location), {
|
|
460
|
+
await this.fileService.del(URI.revive(server.location), {
|
|
461
|
+
recursive: true
|
|
462
|
+
});
|
|
390
463
|
}
|
|
391
464
|
await this.updateLocal();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
465
|
+
} catch (e) {
|
|
466
|
+
this._onDidUninstallMcpServer.fire({
|
|
467
|
+
name: server.name,
|
|
468
|
+
error: e,
|
|
469
|
+
mcpResource: this.mcpResource
|
|
470
|
+
});
|
|
395
471
|
throw e;
|
|
396
472
|
}
|
|
397
473
|
}
|
|
398
474
|
};
|
|
399
|
-
AbstractMcpResourceManagementService = ( __decorate([
|
|
400
|
-
( __param(2, IMcpGalleryService)),
|
|
401
|
-
( __param(3, IFileService)),
|
|
402
|
-
( __param(4, IUriIdentityService)),
|
|
403
|
-
( __param(5, ILogService)),
|
|
404
|
-
( __param(6, IMcpResourceScannerService))
|
|
405
|
-
], AbstractMcpResourceManagementService));
|
|
475
|
+
AbstractMcpResourceManagementService = ( __decorate([( __param(2, IMcpGalleryService)), ( __param(3, IFileService)), ( __param(4, IUriIdentityService)), ( __param(5, ILogService)), ( __param(6, IMcpResourceScannerService))], AbstractMcpResourceManagementService));
|
|
406
476
|
let McpUserResourceManagementService = class McpUserResourceManagementService extends AbstractMcpResourceManagementService {
|
|
407
|
-
constructor(
|
|
408
|
-
|
|
409
|
-
|
|
477
|
+
constructor(
|
|
478
|
+
mcpResource,
|
|
479
|
+
mcpGalleryService,
|
|
480
|
+
fileService,
|
|
481
|
+
uriIdentityService,
|
|
482
|
+
logService,
|
|
483
|
+
mcpResourceScannerService,
|
|
484
|
+
environmentService
|
|
485
|
+
) {
|
|
486
|
+
super(
|
|
487
|
+
mcpResource,
|
|
488
|
+
ConfigurationTarget.USER,
|
|
489
|
+
mcpGalleryService,
|
|
490
|
+
fileService,
|
|
491
|
+
uriIdentityService,
|
|
492
|
+
logService,
|
|
493
|
+
mcpResourceScannerService
|
|
494
|
+
);
|
|
495
|
+
this.mcpLocation = uriIdentityService.extUri.joinPath(environmentService.userRoamingDataHome, "mcp");
|
|
410
496
|
}
|
|
411
497
|
async installFromGallery(server, options) {
|
|
412
|
-
throw ( new Error(
|
|
498
|
+
throw ( new Error("Not supported"));
|
|
413
499
|
}
|
|
414
500
|
async updateMetadata(local, gallery) {
|
|
415
501
|
await this.updateMetadataFromGallery(gallery);
|
|
@@ -423,7 +509,7 @@ let McpUserResourceManagementService = class McpUserResourceManagementService ex
|
|
|
423
509
|
async updateMetadataFromGallery(gallery) {
|
|
424
510
|
const manifest = gallery.configuration;
|
|
425
511
|
const location = this.getLocation(gallery.name, gallery.version);
|
|
426
|
-
const manifestPath = this.uriIdentityService.extUri.joinPath(location,
|
|
512
|
+
const manifestPath = this.uriIdentityService.extUri.joinPath(location, "manifest.json");
|
|
427
513
|
const local = {
|
|
428
514
|
galleryUrl: gallery.galleryUrl,
|
|
429
515
|
galleryId: gallery.id,
|
|
@@ -437,12 +523,15 @@ let McpUserResourceManagementService = class McpUserResourceManagementService ex
|
|
|
437
523
|
licenseUrl: gallery.license,
|
|
438
524
|
icon: gallery.icon,
|
|
439
525
|
codicon: gallery.codicon,
|
|
440
|
-
manifest
|
|
526
|
+
manifest
|
|
441
527
|
};
|
|
442
528
|
await this.fileService.writeFile(manifestPath, VSBuffer.fromString(JSON.stringify(local)));
|
|
443
529
|
if (gallery.readmeUrl || gallery.readme) {
|
|
444
530
|
const readme = gallery.readme ? gallery.readme : await this.mcpGalleryService.getReadme(gallery, CancellationToken.None);
|
|
445
|
-
await this.fileService.writeFile(
|
|
531
|
+
await this.fileService.writeFile(
|
|
532
|
+
this.uriIdentityService.extUri.joinPath(location, "README.md"),
|
|
533
|
+
VSBuffer.fromString(readme)
|
|
534
|
+
);
|
|
446
535
|
}
|
|
447
536
|
return manifest;
|
|
448
537
|
}
|
|
@@ -452,46 +541,38 @@ let McpUserResourceManagementService = class McpUserResourceManagementService ex
|
|
|
452
541
|
let readmeUrl;
|
|
453
542
|
if (mcpServerConfig.gallery) {
|
|
454
543
|
location = this.getLocation(name, mcpServerConfig.version);
|
|
455
|
-
const manifestLocation = this.uriIdentityService.extUri.joinPath(location,
|
|
544
|
+
const manifestLocation = this.uriIdentityService.extUri.joinPath(location, "manifest.json");
|
|
456
545
|
try {
|
|
457
546
|
const content = await this.fileService.readFile(manifestLocation);
|
|
458
547
|
storedMcpServerInfo = JSON.parse(( content.value.toString()));
|
|
459
|
-
if (storedMcpServerInfo.galleryUrl?.includes(
|
|
460
|
-
storedMcpServerInfo.galleryUrl = storedMcpServerInfo.galleryUrl.substring(0, storedMcpServerInfo.galleryUrl.indexOf(
|
|
548
|
+
if (storedMcpServerInfo.galleryUrl?.includes("/v0/")) {
|
|
549
|
+
storedMcpServerInfo.galleryUrl = storedMcpServerInfo.galleryUrl.substring(0, storedMcpServerInfo.galleryUrl.indexOf("/v0/"));
|
|
461
550
|
await this.fileService.writeFile(manifestLocation, VSBuffer.fromString(JSON.stringify(storedMcpServerInfo)));
|
|
462
551
|
}
|
|
463
552
|
storedMcpServerInfo.location = location;
|
|
464
|
-
readmeUrl = this.uriIdentityService.extUri.joinPath(location,
|
|
553
|
+
readmeUrl = this.uriIdentityService.extUri.joinPath(location, "README.md");
|
|
465
554
|
if (!(await this.fileService.exists(readmeUrl))) {
|
|
466
555
|
readmeUrl = undefined;
|
|
467
556
|
}
|
|
468
557
|
storedMcpServerInfo.readmeUrl = readmeUrl;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
this.logService.error('MCP Management Service: failed to read manifest', ( location.toString()), e);
|
|
558
|
+
} catch (e) {
|
|
559
|
+
this.logService.error("MCP Management Service: failed to read manifest", ( location.toString()), e);
|
|
472
560
|
}
|
|
473
561
|
}
|
|
474
562
|
return storedMcpServerInfo;
|
|
475
563
|
}
|
|
476
564
|
getLocation(name, version) {
|
|
477
|
-
name = name.replace(
|
|
565
|
+
name = name.replace("/", ".");
|
|
478
566
|
return this.uriIdentityService.extUri.joinPath(this.mcpLocation, version ? `${name}-${version}` : name);
|
|
479
567
|
}
|
|
480
568
|
installFromUri(uri, options) {
|
|
481
|
-
throw ( new Error(
|
|
569
|
+
throw ( new Error("Method not supported."));
|
|
482
570
|
}
|
|
483
571
|
canInstall() {
|
|
484
|
-
throw ( new Error(
|
|
572
|
+
throw ( new Error("Not supported"));
|
|
485
573
|
}
|
|
486
574
|
};
|
|
487
|
-
McpUserResourceManagementService = ( __decorate([
|
|
488
|
-
( __param(1, IMcpGalleryService)),
|
|
489
|
-
( __param(2, IFileService)),
|
|
490
|
-
( __param(3, IUriIdentityService)),
|
|
491
|
-
( __param(4, ILogService)),
|
|
492
|
-
( __param(5, IMcpResourceScannerService)),
|
|
493
|
-
( __param(6, IEnvironmentService))
|
|
494
|
-
], McpUserResourceManagementService));
|
|
575
|
+
McpUserResourceManagementService = ( __decorate([( __param(1, IMcpGalleryService)), ( __param(2, IFileService)), ( __param(3, IUriIdentityService)), ( __param(4, ILogService)), ( __param(5, IMcpResourceScannerService)), ( __param(6, IEnvironmentService))], McpUserResourceManagementService));
|
|
495
576
|
let AbstractMcpManagementService = class AbstractMcpManagementService extends AbstractCommonMcpManagementService {
|
|
496
577
|
constructor(allowedMcpServersService, logService) {
|
|
497
578
|
super(logService);
|
|
@@ -501,7 +582,7 @@ let AbstractMcpManagementService = class AbstractMcpManagementService extends Ab
|
|
|
501
582
|
const allowedToInstall = this.allowedMcpServersService.isAllowed(server);
|
|
502
583
|
if (allowedToInstall !== true) {
|
|
503
584
|
return (new MarkdownString(localize(
|
|
504
|
-
|
|
585
|
+
2005,
|
|
505
586
|
"This mcp server cannot be installed because {0}",
|
|
506
587
|
allowedToInstall.value
|
|
507
588
|
)));
|
|
@@ -509,12 +590,14 @@ let AbstractMcpManagementService = class AbstractMcpManagementService extends Ab
|
|
|
509
590
|
return true;
|
|
510
591
|
}
|
|
511
592
|
};
|
|
512
|
-
AbstractMcpManagementService = ( __decorate([
|
|
513
|
-
( __param(0, IAllowedMcpServersService)),
|
|
514
|
-
( __param(1, ILogService))
|
|
515
|
-
], AbstractMcpManagementService));
|
|
593
|
+
AbstractMcpManagementService = ( __decorate([( __param(0, IAllowedMcpServersService)), ( __param(1, ILogService))], AbstractMcpManagementService));
|
|
516
594
|
let McpManagementService = class McpManagementService extends AbstractMcpManagementService {
|
|
517
|
-
constructor(
|
|
595
|
+
constructor(
|
|
596
|
+
allowedMcpServersService,
|
|
597
|
+
logService,
|
|
598
|
+
userDataProfilesService,
|
|
599
|
+
instantiationService
|
|
600
|
+
) {
|
|
518
601
|
super(allowedMcpServersService, logService);
|
|
519
602
|
this.userDataProfilesService = userDataProfilesService;
|
|
520
603
|
this.instantiationService = instantiationService;
|
|
@@ -539,8 +622,13 @@ let McpManagementService = class McpManagementService extends AbstractMcpManagem
|
|
|
539
622
|
disposables.add(service.onDidInstallMcpServers(e => this._onDidInstallMcpServers.fire(e)));
|
|
540
623
|
disposables.add(service.onDidUpdateMcpServers(e => this._onDidUpdateMcpServers.fire(e)));
|
|
541
624
|
disposables.add(service.onUninstallMcpServer(e => this._onUninstallMcpServer.fire(e)));
|
|
542
|
-
disposables.add(
|
|
543
|
-
|
|
625
|
+
disposables.add(
|
|
626
|
+
service.onDidUninstallMcpServer(e => this._onDidUninstallMcpServer.fire(e))
|
|
627
|
+
);
|
|
628
|
+
this.mcpResourceManagementServices.set(mcpResource, mcpResourceManagementService = {
|
|
629
|
+
service,
|
|
630
|
+
dispose: () => disposables.dispose()
|
|
631
|
+
});
|
|
544
632
|
}
|
|
545
633
|
return mcpResourceManagementService.service;
|
|
546
634
|
}
|
|
@@ -572,11 +660,6 @@ let McpManagementService = class McpManagementService extends AbstractMcpManagem
|
|
|
572
660
|
return this.instantiationService.createInstance(McpUserResourceManagementService, mcpResource);
|
|
573
661
|
}
|
|
574
662
|
};
|
|
575
|
-
McpManagementService = ( __decorate([
|
|
576
|
-
( __param(0, IAllowedMcpServersService)),
|
|
577
|
-
( __param(1, ILogService)),
|
|
578
|
-
( __param(2, IUserDataProfilesService)),
|
|
579
|
-
( __param(3, IInstantiationService))
|
|
580
|
-
], McpManagementService));
|
|
663
|
+
McpManagementService = ( __decorate([( __param(0, IAllowedMcpServersService)), ( __param(1, ILogService)), ( __param(2, IUserDataProfilesService)), ( __param(3, IInstantiationService))], McpManagementService));
|
|
581
664
|
|
|
582
665
|
export { AbstractCommonMcpManagementService, AbstractMcpManagementService, AbstractMcpResourceManagementService, McpManagementService, McpUserResourceManagementService };
|