feat(frontend): add unified MCP types and API layer for v3.7.0
## Type Definitions - Update McpServer interface with new apps field (McpApps) - Add McpApps interface for multi-app enable state - Add McpServersMap type for server collections - Mark enabled field as deprecated (use apps instead) - Maintain backward compatibility with optional fields ## API Layer Updates - Add unified MCP management methods to mcpApi: * getAllServers() - retrieve all servers with apps state * upsertUnifiedServer() - add/update server with apps * deleteUnifiedServer() - remove server * toggleApp() - enable/disable server for specific app * syncAllServers() - sync all enabled servers to live configs - Import new McpServersMap type ## Code Organization - Keep all types in src/types.ts (removed duplicate types/mcp.ts) - Follow existing project structure conventions Related: v3.7.0 unified MCP management
This commit is contained in:
20
src/types.ts
20
src/types.ts
@@ -125,20 +125,32 @@ export interface McpServerSpec {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// MCP 服务器条目(含元信息)
|
||||
// v3.7.0: MCP 服务器应用启用状态
|
||||
export interface McpApps {
|
||||
claude: boolean;
|
||||
codex: boolean;
|
||||
gemini: boolean;
|
||||
}
|
||||
|
||||
// MCP 服务器条目(v3.7.0 统一结构)
|
||||
export interface McpServer {
|
||||
id: string;
|
||||
name?: string;
|
||||
name: string;
|
||||
server: McpServerSpec;
|
||||
apps: McpApps; // v3.7.0: 标记应用到哪些客户端
|
||||
description?: string;
|
||||
tags?: string[];
|
||||
homepage?: string;
|
||||
docs?: string;
|
||||
enabled?: boolean;
|
||||
server: McpServerSpec;
|
||||
// 兼容旧字段(v3.6.x 及以前)
|
||||
enabled?: boolean; // 已废弃,v3.7.0 使用 apps 字段
|
||||
source?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// MCP 服务器映射(id -> McpServer)
|
||||
export type McpServersMap = Record<string, McpServer>;
|
||||
|
||||
// MCP 配置状态
|
||||
export interface McpStatus {
|
||||
userConfigPath: string;
|
||||
|
||||
Reference in New Issue
Block a user