From b8e0f663a06303d5c68ca5dede1fd33a520a8fe5 Mon Sep 17 00:00:00 2001 From: Buseong Kim Date: Thu, 15 Jan 2026 17:45:53 +0900 Subject: [PATCH] feat(mcp): allow 'never' option for mcp_timeout to disable timeout --- packages/opencode/src/config/config.ts | 6 ++---- packages/opencode/src/mcp/index.ts | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index bf4a6035bd8c..1b98f00c87e1 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -1036,11 +1036,9 @@ export namespace Config { .describe("Tools that should only be available to primary agents."), continue_loop_on_deny: z.boolean().optional().describe("Continue the agent loop when a tool call is denied"), mcp_timeout: z - .number() - .int() - .positive() + .union([z.literal("never"), z.number().int().positive()]) .optional() - .describe("Timeout in milliseconds for model context protocol (MCP) requests"), + .describe("Timeout in milliseconds for MCP requests, or 'never' to disable timeout"), }) .optional(), }) diff --git a/packages/opencode/src/mcp/index.ts b/packages/opencode/src/mcp/index.ts index 4e0968391f3f..822e690b94b3 100644 --- a/packages/opencode/src/mcp/index.ts +++ b/packages/opencode/src/mcp/index.ts @@ -125,6 +125,7 @@ export namespace MCP { description: mcpTool.description ?? "", inputSchema: jsonSchema(schema), execute: async (args: unknown) => { + const timeout = config.experimental?.mcp_timeout return client.callTool( { name: mcpTool.name, @@ -133,7 +134,7 @@ export namespace MCP { CallToolResultSchema, { resetTimeoutOnProgress: true, - timeout: config.experimental?.mcp_timeout, + timeout: timeout === "never" ? undefined : timeout, }, ) },