fix(mcp): properly save and display description field

- Initialize formDescription from initialData.description when editing
- Save formDescription to server object before submitting
- Display only description in list items, hide technical details
- Show empty space when description is not available
This commit is contained in:
Jason
2025-10-09 23:13:33 +08:00
parent 29b8d5edde
commit eb8d9352c8
3 changed files with 20 additions and 14 deletions

View File

@@ -29,10 +29,8 @@ const McpListItem: React.FC<McpListItemProps> = ({
// 默认启用
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 (
<div className={cn(cardStyles.interactive, "!p-4")}>
@@ -50,9 +48,11 @@ const McpListItem: React.FC<McpListItemProps> = ({
<h3 className="font-medium text-gray-900 dark:text-gray-100 mb-1">
{id}
</h3>
<p className="text-sm text-gray-500 dark:text-gray-400 truncate">
{details}
</p>
{description && (
<p className="text-sm text-gray-500 dark:text-gray-400 truncate">
{description}
</p>
)}
</div>
{/* 右侧:操作按钮 */}