fix(mcp): 修复 MCP 配置 timeout 字段不支持字符串类型的问题 (#12384)

fix(mcp): allow string input for timeout in mcp config

Co-authored-by: Sun <10309831+x_taiyang@user.noreply.gitee.com>
This commit is contained in:
Sun 2026-01-09 17:24:08 +08:00 committed by GitHub
parent 7a7089e315
commit bdf8f103c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -123,7 +123,15 @@ export const McpServerConfigSchema = z
*
* 60
*/
timeout: z.number().optional().describe('Timeout in seconds for requests to this server'),
timeout: z
.preprocess((val) => {
if (typeof val === 'string' && val.trim() !== '') {
const parsed = Number(val)
return isNaN(parsed) ? val : parsed
}
return val
}, z.number().optional())
.describe('Timeout in seconds for requests to this server'),
/**
* DXT包版本号
* DXT包的版本