mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-30 05:26:46 +01:00
mcp: fix add-mcp command errors out on insiders (#252705)
Fixes #252512
This commit is contained in:
@@ -68,6 +68,9 @@ import { AllowedExtensionsService } from '../../platform/extensionManagement/com
|
||||
import { McpManagementCli } from '../../platform/mcp/common/mcpManagementCli.js';
|
||||
import { IExtensionGalleryManifestService } from '../../platform/extensionManagement/common/extensionGalleryManifest.js';
|
||||
import { ExtensionGalleryManifestService } from '../../platform/extensionManagement/common/extensionGalleryManifestService.js';
|
||||
import { IMcpManagementService } from '../../platform/mcp/common/mcpManagement.js';
|
||||
import { McpManagementService } from '../../platform/mcp/common/mcpManagementService.js';
|
||||
import { IMcpResourceScannerService, McpResourceScannerService } from '../../platform/mcp/common/mcpResourceScannerService.js';
|
||||
|
||||
class CliMain extends Disposable {
|
||||
|
||||
@@ -224,6 +227,10 @@ class CliMain extends Disposable {
|
||||
// Localizations
|
||||
services.set(ILanguagePackService, new SyncDescriptor(NativeLanguagePackService, undefined, false));
|
||||
|
||||
// MCP
|
||||
services.set(IMcpResourceScannerService, new SyncDescriptor(McpResourceScannerService, undefined, true));
|
||||
services.set(IMcpManagementService, new SyncDescriptor(McpManagementService, undefined, true));
|
||||
|
||||
// Telemetry
|
||||
const appenders: ITelemetryAppender[] = [];
|
||||
const isInternal = isInternalTelemetry(productService, configurationService);
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ILogger } from '../../log/common/log.js';
|
||||
import { IMcpServerConfiguration } from './mcpPlatformTypes.js';
|
||||
import { IMcpServerConfiguration, IMcpServerVariable } from './mcpPlatformTypes.js';
|
||||
import { IMcpManagementService } from './mcpManagement.js';
|
||||
|
||||
type ValidatedConfig = { name: string; config: IMcpServerConfiguration };
|
||||
type ValidatedConfig = { name: string; config: IMcpServerConfiguration; inputs?: IMcpServerVariable[] };
|
||||
|
||||
export class McpManagementCli {
|
||||
constructor(
|
||||
@@ -24,11 +24,11 @@ export class McpManagementCli {
|
||||
}
|
||||
|
||||
private async updateMcpInResource(configs: ValidatedConfig[]) {
|
||||
await Promise.all(configs.map(({ name, config }) => this._mcpManagementService.install({ name, config })));
|
||||
await Promise.all(configs.map(({ name, config, inputs }) => this._mcpManagementService.install({ name, config, inputs })));
|
||||
}
|
||||
|
||||
private validateConfiguration(config: string): ValidatedConfig {
|
||||
let parsed: IMcpServerConfiguration & { name: string };
|
||||
let parsed: IMcpServerConfiguration & { name: string; inputs?: IMcpServerVariable[] };
|
||||
try {
|
||||
parsed = JSON.parse(config);
|
||||
} catch (e) {
|
||||
@@ -43,8 +43,8 @@ export class McpManagementCli {
|
||||
throw new InvalidMcpOperationError(`Missing command or URL property in ${config}`);
|
||||
}
|
||||
|
||||
const { name, ...rest } = parsed;
|
||||
return { name, config: rest as IMcpServerConfiguration };
|
||||
const { name, inputs, ...rest } = parsed;
|
||||
return { name, inputs, config: rest as IMcpServerConfiguration };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user