mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 00:35:32 +08:00
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:
+11
-1
@@ -55,9 +55,19 @@ export const translateMcpBackendError = (
|
||||
}
|
||||
if (
|
||||
msg.includes("MCP 服务器定义必须为 JSON 对象") ||
|
||||
msg.includes("MCP 服务器条目必须为 JSON 对象") ||
|
||||
msg.includes("MCP 服务器条目缺少 server 字段") ||
|
||||
msg.includes("MCP 服务器 server 字段必须为 JSON 对象") ||
|
||||
msg.includes("MCP 服务器连接定义必须为 JSON 对象") ||
|
||||
msg.includes("MCP 服务器 '" /* 不是对象 */) ||
|
||||
msg.includes("不是对象") ||
|
||||
msg.includes("服务器配置必须是对象")
|
||||
msg.includes("服务器配置必须是对象") ||
|
||||
msg.includes("MCP 服务器 name 必须为字符串") ||
|
||||
msg.includes("MCP 服务器 description 必须为字符串") ||
|
||||
msg.includes("MCP 服务器 homepage 必须为字符串") ||
|
||||
msg.includes("MCP 服务器 docs 必须为字符串") ||
|
||||
msg.includes("MCP 服务器 tags 必须为字符串数组") ||
|
||||
msg.includes("MCP 服务器 enabled 必须为布尔值")
|
||||
) {
|
||||
return t("mcp.error.jsonInvalid");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user