From c92bfa1f1237ce6ca09b82fc44795a3429edc49b Mon Sep 17 00:00:00 2001 From: matevip Date: Wed, 3 Jun 2026 09:47:18 +0800 Subject: [PATCH] fix(mcp): raise default tool read timeout from 30s to 60s (#247) --- .../java/vip/mate/tool/mcp/service/McpServerService.java | 2 +- mateclaw-server/src/main/resources/db/data-en.sql | 4 ++-- mateclaw-server/src/main/resources/db/data-mysql-en.sql | 4 ++-- mateclaw-server/src/main/resources/db/data-mysql-zh.sql | 4 ++-- mateclaw-server/src/main/resources/db/data-zh.sql | 4 ++-- .../migration/h2/V139__mcp_default_read_timeout_60s.sql | 8 ++++++++ .../mysql/V139__mcp_default_read_timeout_60s.sql | 8 ++++++++ mateclaw-ui/src/views/mcp/McpFormModal.vue | 2 +- mateclaw-ui/src/views/mcp/types.ts | 2 +- 9 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 mateclaw-server/src/main/resources/db/migration/h2/V139__mcp_default_read_timeout_60s.sql create mode 100644 mateclaw-server/src/main/resources/db/migration/mysql/V139__mcp_default_read_timeout_60s.sql diff --git a/mateclaw-server/src/main/java/vip/mate/tool/mcp/service/McpServerService.java b/mateclaw-server/src/main/java/vip/mate/tool/mcp/service/McpServerService.java index deaad663..5ef6d87f 100644 --- a/mateclaw-server/src/main/java/vip/mate/tool/mcp/service/McpServerService.java +++ b/mateclaw-server/src/main/java/vip/mate/tool/mcp/service/McpServerService.java @@ -68,7 +68,7 @@ public class McpServerService { entity.setConnectTimeoutSeconds(30); } if (entity.getReadTimeoutSeconds() == null) { - entity.setReadTimeoutSeconds(30); + entity.setReadTimeoutSeconds(60); } entity.setLastStatus("disconnected"); entity.setToolCount(0); diff --git a/mateclaw-server/src/main/resources/db/data-en.sql b/mateclaw-server/src/main/resources/db/data-en.sql index 47731a4d..752e1772 100644 --- a/mateclaw-server/src/main/resources/db/data-en.sql +++ b/mateclaw-server/src/main/resources/db/data-en.sql @@ -547,7 +547,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, @@ -578,7 +578,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, diff --git a/mateclaw-server/src/main/resources/db/data-mysql-en.sql b/mateclaw-server/src/main/resources/db/data-mysql-en.sql index b037de0e..05d553a3 100644 --- a/mateclaw-server/src/main/resources/db/data-mysql-en.sql +++ b/mateclaw-server/src/main/resources/db/data-mysql-en.sql @@ -596,7 +596,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, @@ -627,7 +627,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, diff --git a/mateclaw-server/src/main/resources/db/data-mysql-zh.sql b/mateclaw-server/src/main/resources/db/data-mysql-zh.sql index e60f8ee5..90252fb9 100644 --- a/mateclaw-server/src/main/resources/db/data-mysql-zh.sql +++ b/mateclaw-server/src/main/resources/db/data-mysql-zh.sql @@ -593,7 +593,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, @@ -624,7 +624,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, diff --git a/mateclaw-server/src/main/resources/db/data-zh.sql b/mateclaw-server/src/main/resources/db/data-zh.sql index 6ccb790e..c480a59a 100644 --- a/mateclaw-server/src/main/resources/db/data-zh.sql +++ b/mateclaw-server/src/main/resources/db/data-zh.sql @@ -548,7 +548,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, @@ -579,7 +579,7 @@ VALUES ( NULL, FALSE, 30, - 30, + 60, 'disconnected', NULL, NULL, diff --git a/mateclaw-server/src/main/resources/db/migration/h2/V139__mcp_default_read_timeout_60s.sql b/mateclaw-server/src/main/resources/db/migration/h2/V139__mcp_default_read_timeout_60s.sql new file mode 100644 index 00000000..541bc6dc --- /dev/null +++ b/mateclaw-server/src/main/resources/db/migration/h2/V139__mcp_default_read_timeout_60s.sql @@ -0,0 +1,8 @@ +-- Raise the default per-request (read) timeout for MCP servers from 30s to 60s. +-- A 30s ceiling cut off MCP tools whose single callTool round-trip legitimately +-- runs longer (data-heavy or compute-heavy tools), surfacing as a request timeout +-- with no retry. The application layer already falls back to 60s when the column +-- is null; this aligns the schema default so the value is consistent everywhere. +-- Only changes the column default for newly inserted rows — existing rows keep +-- whatever value they were given. Idempotent. +ALTER TABLE mate_mcp_server ALTER COLUMN read_timeout_seconds SET DEFAULT 60; diff --git a/mateclaw-server/src/main/resources/db/migration/mysql/V139__mcp_default_read_timeout_60s.sql b/mateclaw-server/src/main/resources/db/migration/mysql/V139__mcp_default_read_timeout_60s.sql new file mode 100644 index 00000000..541bc6dc --- /dev/null +++ b/mateclaw-server/src/main/resources/db/migration/mysql/V139__mcp_default_read_timeout_60s.sql @@ -0,0 +1,8 @@ +-- Raise the default per-request (read) timeout for MCP servers from 30s to 60s. +-- A 30s ceiling cut off MCP tools whose single callTool round-trip legitimately +-- runs longer (data-heavy or compute-heavy tools), surfacing as a request timeout +-- with no retry. The application layer already falls back to 60s when the column +-- is null; this aligns the schema default so the value is consistent everywhere. +-- Only changes the column default for newly inserted rows — existing rows keep +-- whatever value they were given. Idempotent. +ALTER TABLE mate_mcp_server ALTER COLUMN read_timeout_seconds SET DEFAULT 60; diff --git a/mateclaw-ui/src/views/mcp/McpFormModal.vue b/mateclaw-ui/src/views/mcp/McpFormModal.vue index 476c3b4e..7a02d898 100644 --- a/mateclaw-ui/src/views/mcp/McpFormModal.vue +++ b/mateclaw-ui/src/views/mcp/McpFormModal.vue @@ -189,7 +189,7 @@ function hydrateFromServer(s: McpServer) { envJson: s.envJson || '', cwd: s.cwd || '', connectTimeoutSeconds: s.connectTimeoutSeconds || 30, - readTimeoutSeconds: s.readTimeoutSeconds || 30, + readTimeoutSeconds: s.readTimeoutSeconds || 60, enabled: s.enabled, }) } diff --git a/mateclaw-ui/src/views/mcp/types.ts b/mateclaw-ui/src/views/mcp/types.ts index b02e2fcc..eee8994c 100644 --- a/mateclaw-ui/src/views/mcp/types.ts +++ b/mateclaw-ui/src/views/mcp/types.ts @@ -63,7 +63,7 @@ export function emptyMcpForm(): McpServerForm { envJson: '', cwd: '', connectTimeoutSeconds: 30, - readTimeoutSeconds: 30, + readTimeoutSeconds: 60, enabled: true, } }