feat(mcp): add front-end API wrappers and types

- Add McpServer and McpStatus types
- Add window.api wrappers for MCP commands
- Extend vite-env.d.ts global typings for MCP APIs
This commit is contained in:
Jason
2025-10-08 22:35:02 +08:00
parent e7a584c5ba
commit 94192a3720
3 changed files with 95 additions and 2 deletions

12
src/vite-env.d.ts vendored
View File

@@ -1,6 +1,6 @@
/// <reference types="vite/client" />
import { Provider, Settings, CustomEndpoint } from "./types";
import { Provider, Settings, CustomEndpoint, McpStatus } from "./types";
import { AppType } from "./lib/tauri-api";
import type { UnlistenFn } from "@tauri-apps/api/event";
@@ -61,6 +61,16 @@ declare global {
official: boolean;
}) => Promise<boolean>;
isClaudePluginApplied: () => Promise<boolean>;
// Claude MCP
getClaudeMcpStatus: () => Promise<McpStatus>;
readClaudeMcpConfig: () => Promise<string | null>;
setClaudeMcpEnableAllProjects: (enable: boolean) => Promise<boolean>;
upsertClaudeMcpServer: (
id: string,
spec: Record<string, any>,
) => Promise<boolean>;
deleteClaudeMcpServer: (id: string) => Promise<boolean>;
validateMcpCommand: (cmd: string) => Promise<boolean>;
testApiEndpoints: (
urls: string[],
options?: { timeoutSecs?: number },