mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-16 13:34:04 +08:00
refactor(mcp): complete v3.7.0 cleanup - remove legacy code and warnings
This commit finalizes the v3.7.0 unified MCP architecture migration by removing all deprecated code paths and eliminating compiler warnings. Frontend Changes (~950 lines removed): - Remove deprecated components: McpPanel, McpListItem, McpToggle - Remove deprecated hook: useMcpActions - Remove unused API methods: importFrom*, syncEnabledTo*, syncAllServers - Simplify McpFormModal by removing dual-mode logic (unified/legacy) - Remove syncOtherSide checkbox and conflict detection - Clean up unused imports and state variables - Delete associated test files Backend Changes (~400 lines cleaned): - Remove unused Tauri commands: import_mcp_from_*, sync_enabled_mcp_to_* - Delete unused Gemini MCP functions: get_mcp_status, upsert/delete_mcp_server - Add #[allow(deprecated)] to compatibility layer commands - Add #[allow(dead_code)] to legacy helper functions for future migration - Simplify boolean expression in mcp.rs per Clippy suggestion API Deprecation: - Mark legacy APIs with @deprecated JSDoc (getConfig, upsertServerInConfig, etc.) - Preserve backward compatibility for v3.x, planned removal in v4.0 Verification: - ✅ Zero TypeScript errors (pnpm typecheck) - ✅ Zero Clippy warnings (cargo clippy) - ✅ All code formatted (prettier + cargo fmt) - ✅ Builds successfully Total cleanup: ~1,350 lines of code removed/marked Breaking changes: None (all legacy APIs still functional)
This commit is contained in:
+12
-31
@@ -32,18 +32,16 @@ export const mcpApi = {
|
||||
return await invoke("validate_mcp_command", { cmd });
|
||||
},
|
||||
|
||||
/**
|
||||
* @deprecated 使用 getAllServers() 代替(v3.7.0+)
|
||||
*/
|
||||
async getConfig(app: AppId = "claude"): Promise<McpConfigResponse> {
|
||||
return await invoke("get_mcp_config", { app });
|
||||
},
|
||||
|
||||
async importFromClaude(): Promise<number> {
|
||||
return await invoke("import_mcp_from_claude");
|
||||
},
|
||||
|
||||
async importFromCodex(): Promise<number> {
|
||||
return await invoke("import_mcp_from_codex");
|
||||
},
|
||||
|
||||
/**
|
||||
* @deprecated 使用 upsertUnifiedServer() 代替(v3.7.0+)
|
||||
*/
|
||||
async upsertServerInConfig(
|
||||
app: AppId,
|
||||
id: string,
|
||||
@@ -61,6 +59,9 @@ export const mcpApi = {
|
||||
return await invoke("upsert_mcp_server_in_config", payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* @deprecated 使用 deleteUnifiedServer() 代替(v3.7.0+)
|
||||
*/
|
||||
async deleteServerInConfig(
|
||||
app: AppId,
|
||||
id: string,
|
||||
@@ -76,26 +77,13 @@ export const mcpApi = {
|
||||
return await invoke("delete_mcp_server_in_config", payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* @deprecated 使用 toggleApp() 代替(v3.7.0+)
|
||||
*/
|
||||
async setEnabled(app: AppId, id: string, enabled: boolean): Promise<boolean> {
|
||||
return await invoke("set_mcp_enabled", { app, id, enabled });
|
||||
},
|
||||
|
||||
async syncEnabledToClaude(): Promise<boolean> {
|
||||
return await invoke("sync_enabled_mcp_to_claude");
|
||||
},
|
||||
|
||||
async syncEnabledToCodex(): Promise<boolean> {
|
||||
return await invoke("sync_enabled_mcp_to_codex");
|
||||
},
|
||||
|
||||
async syncEnabledToGemini(): Promise<boolean> {
|
||||
return await invoke("sync_enabled_mcp_to_gemini");
|
||||
},
|
||||
|
||||
async importFromGemini(): Promise<number> {
|
||||
return await invoke("import_mcp_from_gemini");
|
||||
},
|
||||
|
||||
// ========================================================================
|
||||
// v3.7.0 新增:统一 MCP 管理 API
|
||||
// ========================================================================
|
||||
@@ -131,11 +119,4 @@ export const mcpApi = {
|
||||
): Promise<void> {
|
||||
return await invoke("toggle_mcp_app", { serverId, app, enabled });
|
||||
},
|
||||
|
||||
/**
|
||||
* 手动同步所有启用的 MCP 服务器到对应的应用
|
||||
*/
|
||||
async syncAllServers(): Promise<void> {
|
||||
return await invoke("sync_all_mcp_servers");
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user