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:
Jason
2025-11-14 22:43:25 +08:00
parent fafca841cb
commit 2f18d6ec00
19 changed files with 100 additions and 1420 deletions

View File

@@ -163,11 +163,7 @@ impl McpService {
Ok(())
}
fn remove_server_from_app(
_state: &AppState,
id: &str,
app: &AppType,
) -> Result<(), AppError> {
fn remove_server_from_app(_state: &AppState, id: &str, app: &AppType) -> Result<(), AppError> {
match app {
AppType::Claude => mcp::remove_server_from_claude(id)?,
AppType::Codex => mcp::remove_server_from_codex(id)?,
@@ -236,7 +232,10 @@ impl McpService {
}
/// [已废弃] 从 Claude 导入 MCP兼容旧 API
#[deprecated(since = "3.7.0", note = "Import will be handled differently in unified structure")]
#[deprecated(
since = "3.7.0",
note = "Import will be handled differently in unified structure"
)]
pub fn import_from_claude(state: &AppState) -> Result<usize, AppError> {
let mut cfg = state.config.write()?;
let count = mcp::import_from_claude(&mut cfg)?;
@@ -246,7 +245,10 @@ impl McpService {
}
/// [已废弃] 从 Codex 导入 MCP兼容旧 API
#[deprecated(since = "3.7.0", note = "Import will be handled differently in unified structure")]
#[deprecated(
since = "3.7.0",
note = "Import will be handled differently in unified structure"
)]
pub fn import_from_codex(state: &AppState) -> Result<usize, AppError> {
let mut cfg = state.config.write()?;
let count = mcp::import_from_codex(&mut cfg)?;
@@ -256,7 +258,10 @@ impl McpService {
}
/// [已废弃] 从 Gemini 导入 MCP兼容旧 API
#[deprecated(since = "3.7.0", note = "Import will be handled differently in unified structure")]
#[deprecated(
since = "3.7.0",
note = "Import will be handled differently in unified structure"
)]
pub fn import_from_gemini(state: &AppState) -> Result<usize, AppError> {
let mut cfg = state.config.write()?;
let count = mcp::import_from_gemini(&mut cfg)?;