feat(gemini): implement full MCP management functionality
- Add gemini_mcp.rs module for Gemini MCP file I/O operations - Implement sync_enabled_to_gemini to export enabled MCPs to ~/.gemini/settings.json - Implement import_from_gemini to import MCPs from Gemini config - Add Gemini sync logic in services/mcp.rs (upsert_server, delete_server, set_enabled) - Register Tauri commands for Gemini MCP sync and import - Update frontend API calls and McpPanel to support Gemini Fixes the issue where adding MCP servers in Gemini tab would not sync to ~/.gemini/settings.json
This commit is contained in:
@@ -129,3 +129,17 @@ pub async fn import_mcp_from_claude(state: State<'_, AppState>) -> Result<usize,
|
||||
pub async fn import_mcp_from_codex(state: State<'_, AppState>) -> Result<usize, String> {
|
||||
McpService::import_from_codex(&state).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// 手动同步:将启用的 MCP 投影到 ~/.gemini/settings.json
|
||||
#[tauri::command]
|
||||
pub async fn sync_enabled_mcp_to_gemini(state: State<'_, AppState>) -> Result<bool, String> {
|
||||
McpService::sync_enabled(&state, AppType::Gemini)
|
||||
.map(|_| true)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// 从 ~/.gemini/settings.json 导入 MCP 定义到 config.json
|
||||
#[tauri::command]
|
||||
pub async fn import_mcp_from_gemini(state: State<'_, AppState>) -> Result<usize, String> {
|
||||
McpService::import_from_gemini(&state).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user