refactor(mcp): improve data structure with metadata/spec separation

- Separate MCP server metadata from connection spec for cleaner architecture
- Add comprehensive server entry fields: name, description, tags, homepage, docs
- Remove legacy format compatibility logic from extract_server_spec
- Implement data validation and filtering in get_servers_snapshot_for
- Add strict id consistency check in upsert_in_config_for
- Enhance import logic with defensive programming for corrupted data
- Simplify frontend by removing normalization logic (moved to backend)
- Improve error messages with contextual information
- Add comprehensive i18n support for new metadata fields
This commit is contained in:
Jason
2025-10-12 00:08:37 +08:00
parent 668ab710c6
commit fb137c4a78
14 changed files with 477 additions and 115 deletions

View File

@@ -6,6 +6,7 @@ import {
CustomEndpoint,
McpStatus,
McpServer,
McpServerSpec,
McpConfigResponse,
} from "../types";
@@ -309,7 +310,7 @@ export const tauriAPI = {
// Claude MCP新增/更新服务器定义
upsertClaudeMcpServer: async (
id: string,
spec: McpServer | Record<string, any>,
spec: McpServerSpec | Record<string, any>,
): Promise<boolean> => {
try {
return await invoke<boolean>("upsert_claude_mcp_server", { id, spec });
@@ -352,7 +353,7 @@ export const tauriAPI = {
upsertMcpServerInConfig: async (
app: AppType = "claude",
id: string,
spec: McpServer | Record<string, any>,
spec: McpServer,
): Promise<boolean> => {
try {
return await invoke<boolean>("upsert_mcp_server_in_config", {