feat(frontend): implement unified MCP panel for v3.7.0

Complete Phase 3 (P0) frontend implementation for unified MCP management:

**New Files:**
- src/hooks/useMcp.ts: React Query hooks for unified MCP operations
- src/components/mcp/UnifiedMcpPanel.tsx: Unified MCP management panel
- src/components/ui/checkbox.tsx: Checkbox component from shadcn/ui

**Features:**
- Unified panel with three-column layout: server info + app checkboxes + actions
- Multi-app control: Claude/Codex/Gemini checkboxes for each server
- Real-time stats: Show enabled server counts per app
- Full CRUD operations: Add, edit, delete, sync all servers

**Integration:**
- Replace old app-specific McpPanel with UnifiedMcpPanel in App.tsx
- Update McpFormModal to support unified mode with apps field
- Add i18n support: mcp.unifiedPanel namespace (zh/en)

**Type Safety:**
- Ensure McpServer.apps field always initialized
- Fix all test files to include apps field
- TypeScript type check passes 

**Architecture:**
- Single source of truth: mcp.servers manages all MCP configs
- Per-server app control: apps.claude/codex/gemini boolean flags
- Backward compatible: McpFormModal supports both unified and legacy modes

Next: P1 tasks (import dialogs, sub-components, tests)
This commit is contained in:
Jason
2025-11-14 15:24:48 +08:00
parent 32a6de074c
commit 9e8abf5f26
10 changed files with 569 additions and 15 deletions

View File

@@ -441,6 +441,22 @@
"claudeTitle": "Claude Code MCP Management",
"codexTitle": "Codex MCP Management",
"geminiTitle": "Gemini MCP Management",
"unifiedPanel": {
"title": "MCP Server Management",
"addServer": "Add Server",
"editServer": "Edit Server",
"deleteServer": "Delete Server",
"deleteConfirm": "Are you sure you want to delete server \"{{id}}\"? This action cannot be undone.",
"syncAll": "Sync All",
"syncAllSuccess": "All enabled servers have been synced to application configs",
"noServers": "No servers yet",
"enabledApps": "Enabled Apps",
"apps": {
"claude": "Claude",
"codex": "Codex",
"gemini": "Gemini"
}
},
"userLevelPath": "User-level MCP path",
"serverList": "Servers",
"loading": "Loading...",