Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { z } from "zod";
const accessControlFields = {
allowTools: z.array(z.string()).optional(),
blockTools: z.array(z.string()).optional(),
/** Per-service tool call timeout in milliseconds. Overrides MCP2CLI_TOOL_TIMEOUT env var. */
timeout: z.number().int().positive().optional(),
};

/**
Expand Down
7 changes: 5 additions & 2 deletions src/daemon/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ export function createDaemonServer(opts: DaemonServerOptions) {
callTool = body.tool;
const conn = await pool.getConnection(body.service, getConfig());

// MEM-02: AbortSignal timeout on tool calls (default 30s, configurable)
const timeout = parseInt(process.env.MCP2CLI_TOOL_TIMEOUT ?? "30000", 10);
// MEM-02: AbortSignal timeout on tool calls
// Priority: per-service config > MCP2CLI_TOOL_TIMEOUT env > 30s default
const serviceConfig = getConfig().services[body.service];
const perServiceTimeout = serviceConfig && "timeout" in serviceConfig ? serviceConfig.timeout : undefined;
const timeout = perServiceTimeout ?? parseInt(process.env.MCP2CLI_TOOL_TIMEOUT ?? "30000", 10);
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeout);

Expand Down
Loading