mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
clean up - remove vscode mcp gallery (#268854)
This commit is contained in:
committed by
GitHub
parent
b94d2ed548
commit
26eedb3d25
@@ -105,7 +105,6 @@ export interface IProductConfiguration {
|
||||
readonly extensionsGallery?: {
|
||||
readonly serviceUrl: string;
|
||||
readonly controlUrl: string;
|
||||
readonly mcpUrl: string;
|
||||
readonly extensionUrlTemplate: string;
|
||||
readonly resourceUrlTemplate: string;
|
||||
readonly nlsBaseUrl: string;
|
||||
|
||||
@@ -33,22 +33,19 @@ export class McpGalleryManifestService extends Disposable implements IMcpGallery
|
||||
|
||||
protected createMcpGalleryManifest(url: string): IMcpGalleryManifest {
|
||||
url = url.endsWith('/') ? url.slice(0, -1) : url;
|
||||
const isVSCodeGalleryUrl = this.productService.extensionsGallery?.mcpUrl === url;
|
||||
const isProductGalleryUrl = this.productService.mcpGallery?.serviceUrl === url;
|
||||
const version = isVSCodeGalleryUrl ? undefined : 'v0';
|
||||
const serversUrl = isVSCodeGalleryUrl ? url : `${url}/${version}/servers`;
|
||||
const version = 'v0';
|
||||
const serversUrl = `${url}/${version}/servers`;
|
||||
const resources = [
|
||||
{
|
||||
id: serversUrl,
|
||||
type: McpGalleryResourceType.McpServersQueryService
|
||||
}
|
||||
];
|
||||
if (!isVSCodeGalleryUrl) {
|
||||
resources.push({
|
||||
},
|
||||
{
|
||||
id: `${serversUrl}/{id}`,
|
||||
type: McpGalleryResourceType.McpServerResourceUri
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
if (isProductGalleryUrl) {
|
||||
resources.push({
|
||||
|
||||
@@ -12,7 +12,6 @@ import { URI } from '../../../base/common/uri.js';
|
||||
import { localize } from '../../../nls.js';
|
||||
import { IFileService } from '../../files/common/files.js';
|
||||
import { ILogService } from '../../log/common/log.js';
|
||||
import { IProductService } from '../../product/common/productService.js';
|
||||
import { asJson, asText, IRequestService } from '../../request/common/request.js';
|
||||
import { IGalleryMcpServer, GalleryMcpServerStatus, IMcpGalleryService, IGalleryMcpServerConfiguration, IMcpServerPackage, IQueryOptions, SseTransport, StreamableHttpTransport, IMcpServerKeyValueInput, Transport, TransportType } from './mcpManagement.js';
|
||||
import { IMcpGalleryManifestService, McpGalleryManifestStatus, getMcpGalleryManifestResourceUri, McpGalleryResourceType, IMcpGalleryManifest } from './mcpGalleryManifest.js';
|
||||
@@ -196,30 +195,6 @@ interface IRawGalleryServersResult {
|
||||
readonly servers: readonly IRawGalleryMcpServer[];
|
||||
}
|
||||
|
||||
interface IVSCodeGalleryMcpServerDetail {
|
||||
readonly name: string;
|
||||
readonly displayName: string;
|
||||
readonly description: string;
|
||||
readonly repository?: {
|
||||
readonly url: string;
|
||||
readonly source: string;
|
||||
};
|
||||
readonly codicon?: string;
|
||||
readonly iconUrl?: string;
|
||||
readonly iconUrlDark?: string;
|
||||
readonly iconUrlLight?: string;
|
||||
readonly readmeUrl: string;
|
||||
readonly publisher?: {
|
||||
readonly displayName: string;
|
||||
readonly url: string;
|
||||
readonly is_verified: boolean;
|
||||
};
|
||||
readonly manifest: {
|
||||
readonly packages?: readonly IRawGalleryMcpServerPackage[];
|
||||
readonly remotes?: McpServerRemotes;
|
||||
};
|
||||
}
|
||||
|
||||
const DefaultPageSize = 50;
|
||||
|
||||
interface IQueryState {
|
||||
@@ -256,7 +231,6 @@ export class McpGalleryService extends Disposable implements IMcpGalleryService
|
||||
constructor(
|
||||
@IRequestService private readonly requestService: IRequestService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IMcpGalleryManifestService private readonly mcpGalleryManifestService: IMcpGalleryManifestService,
|
||||
) {
|
||||
@@ -324,11 +298,6 @@ export class McpGalleryService extends Disposable implements IMcpGalleryService
|
||||
return mcpServers;
|
||||
}
|
||||
|
||||
async getMcpServersFromVSCodeGallery(names: string[]): Promise<IGalleryMcpServer[]> {
|
||||
const servers = await this.fetchMcpServersFromVSCodeGallery();
|
||||
return servers.filter(item => names.includes(item.name));
|
||||
}
|
||||
|
||||
async getMcpServerConfiguration(gallery: IGalleryMcpServer, token: CancellationToken): Promise<IGalleryMcpServerConfiguration> {
|
||||
if (gallery.configuration) {
|
||||
return gallery.configuration;
|
||||
@@ -468,11 +437,6 @@ export class McpGalleryService extends Disposable implements IMcpGalleryService
|
||||
}
|
||||
|
||||
private async queryGalleryMcpServers(query: Query, mcpGalleryManifest: IMcpGalleryManifest, token: CancellationToken): Promise<{ servers: IGalleryMcpServer[]; metadata?: IRawGalleryServerListMetadata }> {
|
||||
if (mcpGalleryManifest.url === this.productService.extensionsGallery?.mcpUrl) {
|
||||
return {
|
||||
servers: await this.fetchMcpServersFromVSCodeGallery()
|
||||
};
|
||||
}
|
||||
const { servers, metadata } = await this.queryRawGalleryMcpServers(query, mcpGalleryManifest, token);
|
||||
return {
|
||||
servers: servers.map(item => this.toGalleryMcpServer(item, mcpGalleryManifest)),
|
||||
@@ -635,45 +599,6 @@ export class McpGalleryService extends Disposable implements IMcpGalleryService
|
||||
throw new Error('Unsupported MCP server schema version');
|
||||
}
|
||||
|
||||
private async fetchMcpServersFromVSCodeGallery(): Promise<IGalleryMcpServer[]> {
|
||||
const mcpGalleryUrl = this.productService.extensionsGallery?.mcpUrl;
|
||||
if (!mcpGalleryUrl) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const context = await this.requestService.request({
|
||||
type: 'GET',
|
||||
url: mcpGalleryUrl,
|
||||
}, CancellationToken.None);
|
||||
|
||||
const result = await asJson<{ servers: IVSCodeGalleryMcpServerDetail[] }>(context);
|
||||
if (!result) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return result.servers.map<IGalleryMcpServer>(item => {
|
||||
return {
|
||||
id: item.name,
|
||||
name: item.name,
|
||||
displayName: item.displayName,
|
||||
description: item.description,
|
||||
version: '0.0.1',
|
||||
isLatest: true,
|
||||
status: GalleryMcpServerStatus.Active,
|
||||
repositoryUrl: item.repository?.url,
|
||||
codicon: item.codicon,
|
||||
publisher: '',
|
||||
publisherDisplayName: item.publisher?.displayName,
|
||||
publisherDomain: item.publisher ? {
|
||||
link: item.publisher.url,
|
||||
verified: item.publisher.is_verified,
|
||||
} : undefined,
|
||||
readmeUrl: item.readmeUrl,
|
||||
configuration: this.toGalleryMcpServerConfiguration(item.manifest.packages, item.manifest.remotes)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private getServerUrl(id: string, mcpGalleryManifest: IMcpGalleryManifest): string | undefined {
|
||||
const resourceUriTemplate = getMcpGalleryManifestResourceUri(mcpGalleryManifest, McpGalleryResourceType.McpServerResourceUri);
|
||||
if (!resourceUriTemplate) {
|
||||
|
||||
@@ -168,7 +168,6 @@ export interface IMcpGalleryService {
|
||||
readonly _serviceBrand: undefined;
|
||||
isEnabled(): boolean;
|
||||
query(options?: IQueryOptions, token?: CancellationToken): Promise<IPager<IGalleryMcpServer>>;
|
||||
getMcpServersFromVSCodeGallery(servers: string[]): Promise<IGalleryMcpServer[]>;
|
||||
getMcpServersFromGallery(urls: string[]): Promise<IGalleryMcpServer[]>;
|
||||
getMcpServer(url: string): Promise<IGalleryMcpServer | undefined>;
|
||||
getMcpServerByName(name: string): Promise<IGalleryMcpServer | undefined>;
|
||||
|
||||
@@ -294,7 +294,6 @@ export class McpWorkbenchService extends Disposable implements IMcpWorkbenchServ
|
||||
|
||||
private async syncInstalledMcpServers(resetGallery?: boolean): Promise<void> {
|
||||
const galleryMcpServerUrls: string[] = [];
|
||||
const vscodeGalleryMcpServerNames: string[] = [];
|
||||
|
||||
for (const installed of this.local) {
|
||||
if (installed.local?.source !== 'gallery') {
|
||||
@@ -302,8 +301,6 @@ export class McpWorkbenchService extends Disposable implements IMcpWorkbenchServ
|
||||
}
|
||||
if (installed.local.galleryUrl) {
|
||||
galleryMcpServerUrls.push(installed.local.galleryUrl);
|
||||
} else if (!installed.local.manifest) {
|
||||
vscodeGalleryMcpServerNames.push(installed.local.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,13 +310,6 @@ export class McpWorkbenchService extends Disposable implements IMcpWorkbenchServ
|
||||
await this.syncInstalledMcpServersWithGallery(galleryServers, false, resetGallery);
|
||||
}
|
||||
}
|
||||
|
||||
if (vscodeGalleryMcpServerNames.length) {
|
||||
const galleryServers = await this.mcpGalleryService.getMcpServersFromVSCodeGallery(vscodeGalleryMcpServerNames);
|
||||
if (galleryServers.length) {
|
||||
await this.syncInstalledMcpServersWithGallery(galleryServers, true, resetGallery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async syncInstalledMcpServersWithGallery(gallery: IGalleryMcpServer[], vscodeGallery: boolean, resetGallery?: boolean): Promise<void> {
|
||||
@@ -648,21 +638,10 @@ export class McpWorkbenchService extends Disposable implements IMcpWorkbenchServ
|
||||
|
||||
try {
|
||||
const { name, inputs, gallery, ...config } = parsed;
|
||||
|
||||
if (gallery || !config || Object.keys(config).length === 0) {
|
||||
const [galleryServer] = await this.mcpGalleryService.getMcpServersFromVSCodeGallery([name]);
|
||||
if (!galleryServer) {
|
||||
throw new Error(`MCP server '${name}' not found in gallery`);
|
||||
}
|
||||
const local = this.local.find(e => e.name === name && e.local?.scope !== LocalMcpServerScope.Workspace)
|
||||
?? this.instantiationService.createInstance(McpWorkbenchServer, e => this.getInstallState(e), undefined, galleryServer, undefined);
|
||||
this.open(local);
|
||||
} else {
|
||||
if (config.type === undefined) {
|
||||
(<Mutable<IMcpServerConfiguration>>config).type = (<IMcpStdioServerConfiguration>parsed).command ? McpServerType.LOCAL : McpServerType.REMOTE;
|
||||
}
|
||||
this.open(this.instantiationService.createInstance(McpWorkbenchServer, e => this.getInstallState(e), undefined, undefined, { name, config, inputs }));
|
||||
if (config.type === undefined) {
|
||||
(<Mutable<IMcpServerConfiguration>>config).type = (<IMcpStdioServerConfiguration>parsed).command ? McpServerType.LOCAL : McpServerType.REMOTE;
|
||||
}
|
||||
this.open(this.instantiationService.createInstance(McpWorkbenchServer, e => this.getInstallState(e), undefined, undefined, { name, config, inputs }));
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user