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:
Jason
2025-11-14 10:02:27 +08:00
parent 146b42fb68
commit 1616c63c0b
7 changed files with 344 additions and 7 deletions

View File

@@ -51,6 +51,9 @@ const McpPanel: React.FC<McpPanelProps> = ({ open, onOpenChange, appId }) => {
} else if (appId === "codex") {
const mcpApi = await import("@/lib/api").then((m) => m.mcpApi);
await mcpApi.importFromCodex();
} else if (appId === "gemini") {
const mcpApi = await import("@/lib/api").then((m) => m.mcpApi);
await mcpApi.importFromGemini();
}
} catch (e) {
console.warn("MCP initialization import failed (ignored)", e);

View File

@@ -86,4 +86,12 @@ export const mcpApi = {
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");
},
};