feat(mcp): use project config as SSOT and sync enabled servers to ~/.claude.json
- Add McpConfig to MultiAppConfig and persist MCP servers in ~/.cc-switch/config.json - Add Tauri commands: get_mcp_config, upsert_mcp_server_in_config, delete_mcp_server_in_config, set_mcp_enabled, sync_enabled_mcp_to_claude, import_mcp_from_claude - Only write enabled MCPs to ~/.claude.json (mcpServers) and strip UI-only fields (enabled/source) - Frontend: update API wrappers and MCP panel to read/write via config.json; seed presets on first open; import from ~/.claude.json - Fix warnings (remove unused mut, dead code) - Verified with cargo check and pnpm typecheck
This commit is contained in:
12
src/vite-env.d.ts
vendored
12
src/vite-env.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
import { Provider, Settings, CustomEndpoint, McpStatus } from "./types";
|
||||
import { Provider, Settings, CustomEndpoint, McpStatus, McpConfigResponse } from "./types";
|
||||
import { AppType } from "./lib/tauri-api";
|
||||
import type { UnlistenFn } from "@tauri-apps/api/event";
|
||||
|
||||
@@ -70,6 +70,16 @@ declare global {
|
||||
) => Promise<boolean>;
|
||||
deleteClaudeMcpServer: (id: string) => Promise<boolean>;
|
||||
validateMcpCommand: (cmd: string) => Promise<boolean>;
|
||||
// 新:config.json 为 SSOT 的 MCP API
|
||||
getMcpConfig: () => Promise<McpConfigResponse>;
|
||||
upsertMcpServerInConfig: (
|
||||
id: string,
|
||||
spec: Record<string, any>,
|
||||
) => Promise<boolean>;
|
||||
deleteMcpServerInConfig: (id: string) => Promise<boolean>;
|
||||
setMcpEnabled: (id: string, enabled: boolean) => Promise<boolean>;
|
||||
syncEnabledMcpToClaude: () => Promise<boolean>;
|
||||
importMcpFromClaude: () => Promise<number>;
|
||||
testApiEndpoints: (
|
||||
urls: string[],
|
||||
options?: { timeoutSecs?: number },
|
||||
|
||||
Reference in New Issue
Block a user