mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-11 05:46:01 +08:00
This commit implements a three-layer fix to restore the "Sync to other side" feature when adding or editing MCP servers across Claude and Codex. Root Cause Analysis: 1. Frontend issue: New MCP entries had their `enabled` field deleted 2. Backend issue: Default value was `false` when `enabled` was missing 3. Core issue: MCP entries were never copied to the other app's servers Changes: Frontend (McpFormModal.tsx): - Set `enabled=true` by default for new MCP entries - Preserve existing `enabled` state when editing Backend (services/mcp.rs): - Change default value from `unwrap_or(false)` to `unwrap_or(true)` - Implement cross-app MCP replication when `sync_other_side=true` - Clone MCP entry to other app's servers before syncing to live files Impact: - "Sync to Codex" checkbox now correctly adds MCP to both Claude and Codex - "Sync to Claude" checkbox now correctly adds MCP to both Codex and Claude - Both config.json and live files (~/.claude.json, ~/.codex/config.toml) are updated - Fixes regression introduced during project restructure Tested: - TypeScript type checking passed - Rust clippy linting passed - Manual testing: MCP sync works bidirectionally