diff --git a/src/components/mcp/McpFormModal.tsx b/src/components/mcp/McpFormModal.tsx index e21e000..b99b16e 100644 --- a/src/components/mcp/McpFormModal.tsx +++ b/src/components/mcp/McpFormModal.tsx @@ -41,7 +41,9 @@ const McpFormModal: React.FC = ({ }) => { const { t } = useTranslation(); const [formId, setFormId] = useState(editingId || ""); - const [formDescription, setFormDescription] = useState(""); + const [formDescription, setFormDescription] = useState( + (initialData as any)?.description || "" + ); const [formJson, setFormJson] = useState( initialData ? JSON.stringify(initialData, null, 2) : "", ); @@ -140,6 +142,11 @@ const McpFormModal: React.FC = ({ server.enabled = initialData.enabled; } + // 保存 description 到 server 对象 + if (formDescription.trim()) { + (server as any).description = formDescription.trim(); + } + // 显式等待父组件保存流程,以便正确处理成功/失败 await onSave(formId.trim(), server); } catch (error: any) { diff --git a/src/components/mcp/McpListItem.tsx b/src/components/mcp/McpListItem.tsx index f92c4ec..757182a 100644 --- a/src/components/mcp/McpListItem.tsx +++ b/src/components/mcp/McpListItem.tsx @@ -29,10 +29,8 @@ const McpListItem: React.FC = ({ // 默认启用 const enabled = server.enabled !== false; - // 构建详细信息文本 - const details = ([server.type, server.command, ...(server.args || [])] - .filter(Boolean) as string[]) - .join(" · "); + // 只显示 description,没有则留空 + const description = (server as any).description || ""; return (
@@ -50,9 +48,11 @@ const McpListItem: React.FC = ({

{id}

-

- {details} -

+ {description && ( +

+ {description} +

+ )}
{/* 右侧:操作按钮 */} diff --git a/src/components/mcp/McpPanel.tsx b/src/components/mcp/McpPanel.tsx index 2dd7b8f..4e90b81 100644 --- a/src/components/mcp/McpPanel.tsx +++ b/src/components/mcp/McpPanel.tsx @@ -251,9 +251,6 @@ const McpPanel: React.FC = ({ onClose, onNotify }) => { ...(p.server as McpServer), enabled: false, } as McpServer; - const details = [s.type, s.command, ...(s.args || [])].join( - " · ", - ); return (
= ({ onClose, onNotify }) => {

{p.id}

-

- {details} -

+ {p.description && ( +

+ {p.description} +

+ )}