diff --git a/src/components/mcp/McpFormModal.tsx b/src/components/mcp/McpFormModal.tsx index d762af9..e609744 100644 --- a/src/components/mcp/McpFormModal.tsx +++ b/src/components/mcp/McpFormModal.tsx @@ -1,6 +1,6 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { X, Save, AlertCircle } from "lucide-react"; +import { X, Save, AlertCircle, ChevronDown, ChevronUp } from "lucide-react"; import { McpServer, McpServerSpec } from "../../types"; import { mcpPresets } from "../../config/mcpPresets"; import { buttonStyles, inputStyles } from "../../lib/styles"; @@ -80,6 +80,22 @@ const McpFormModal: React.FC = ({ const [formDocs, setFormDocs] = useState(initialData?.docs || ""); const [formTags, setFormTags] = useState(initialData?.tags?.join(", ") || ""); + // 编辑模式下禁止修改 ID + const isEditing = !!editingId; + + // 判断是否在编辑模式下有附加信息 + const hasAdditionalInfo = !!( + initialData?.description || + initialData?.tags?.length || + initialData?.homepage || + initialData?.docs + ); + + // 附加信息展开状态(编辑模式下有值时默认展开) + const [showMetadata, setShowMetadata] = useState( + isEditing ? hasAdditionalInfo : false, + ); + // 根据 appType 决定初始格式 const [formConfig, setFormConfig] = useState(() => { const spec = initialData?.server; @@ -95,9 +111,6 @@ const McpFormModal: React.FC = ({ const [isWizardOpen, setIsWizardOpen] = useState(false); const [idError, setIdError] = useState(""); - // 编辑模式下禁止修改 ID - const isEditing = !!editingId; - // 判断是否使用 TOML 格式 const useToml = appType === "codex"; @@ -503,57 +516,78 @@ const McpFormModal: React.FC = ({ /> - {/* Description (描述) */} + {/* 可折叠的附加信息按钮 */}
- - setFormDescription(e.target.value)} - /> +
- {/* Tags */} -
- - setFormTags(e.target.value)} - /> -
+ {/* 附加信息区域(可折叠) */} + {showMetadata && ( + <> + {/* Description (描述) */} +
+ + setFormDescription(e.target.value)} + /> +
- {/* Homepage */} -
- - setFormHomepage(e.target.value)} - /> -
+ {/* Tags */} +
+ + setFormTags(e.target.value)} + /> +
- {/* Docs */} -
- - setFormDocs(e.target.value)} - /> -
+ {/* Homepage */} +
+ + setFormHomepage(e.target.value)} + /> +
+ + {/* Docs */} +
+ + setFormDocs(e.target.value)} + /> +
+ + )} {/* 配置输入框(根据格式显示 JSON 或 TOML) */}
diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 1770eaa..4c36bbf 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -291,6 +291,7 @@ "homepagePlaceholder": "https://example.com", "docs": "Docs", "docsPlaceholder": "https://example.com/docs", + "additionalInfo": "Additional Info", "jsonConfig": "JSON Configuration", "jsonPlaceholder": "{\n \"type\": \"stdio\",\n \"command\": \"uvx\",\n \"args\": [\"mcp-server-fetch\"]\n}", "tomlConfig": "TOML Configuration", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 4ebb98a..8988a19 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -291,6 +291,7 @@ "homepagePlaceholder": "https://example.com", "docs": "文档链接", "docsPlaceholder": "https://example.com/docs", + "additionalInfo": "附加信息", "jsonConfig": "JSON 配置", "jsonPlaceholder": "{\n \"type\": \"stdio\",\n \"command\": \"uvx\",\n \"args\": [\"mcp-server-fetch\"]\n}", "tomlConfig": "TOML 配置",