From bdf8f103c896b5fbe2c721e32d47a25b06f224ff Mon Sep 17 00:00:00 2001 From: Sun <97452846+Xtaiyang@users.noreply.github.com> Date: Fri, 9 Jan 2026 17:24:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(mcp):=20=E4=BF=AE=E5=A4=8D=20MCP=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20timeout=20=E5=AD=97=E6=AE=B5=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#12384)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(mcp): allow string input for timeout in mcp config Co-authored-by: Sun <10309831+x_taiyang@user.noreply.gitee.com> --- src/renderer/src/types/mcp.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/types/mcp.ts b/src/renderer/src/types/mcp.ts index 48f48a6167..e16ebb2e04 100644 --- a/src/renderer/src/types/mcp.ts +++ b/src/renderer/src/types/mcp.ts @@ -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包的版本。