mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-05 20:41:30 +08:00
feat(MCPSettings): enhance JSON loading to inherit all MCPServer fields (#8498)
Use spread operator to copy all fields from parsed JSON instead of manually mapping specific fields. This ensures all MCPServer properties including headers, timeout, dxtVersion, and other optional fields are preserved during JSON import. Previously missing fields: - headers: Record<string, string> - timeout: number - dxtVersion: string - dxtPath: string - Other optional MCPServer properties 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
03b996d626
commit
20438989f8
@ -216,19 +216,10 @@ const AddMcpServerModal: FC<AddMcpServerModalProps> = ({
|
||||
// 如果成功解析並通過所有檢查,立即加入伺服器(非啟用狀態)並關閉對話框
|
||||
const newServer: MCPServer = {
|
||||
id: nanoid(),
|
||||
name: serverToAdd!.name!,
|
||||
description: serverToAdd!.description ?? '',
|
||||
...serverToAdd!,
|
||||
name: serverToAdd!.name || t('settings.mcp.newServer'),
|
||||
baseUrl: serverToAdd!.baseUrl ?? serverToAdd!.url ?? '',
|
||||
command: serverToAdd!.command ?? '',
|
||||
args: Array.isArray(serverToAdd!.args) ? serverToAdd!.args : [],
|
||||
env: serverToAdd!.env || {},
|
||||
isActive: false,
|
||||
type: serverToAdd!.type,
|
||||
logoUrl: serverToAdd!.logoUrl,
|
||||
provider: serverToAdd!.provider,
|
||||
providerUrl: serverToAdd!.providerUrl,
|
||||
tags: serverToAdd!.tags,
|
||||
configSample: serverToAdd!.configSample
|
||||
isActive: false // 初始狀態為非啟用
|
||||
}
|
||||
|
||||
onSuccess(newServer)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user