export interface McpRuntimeConfig {
  callTimeoutSeconds: number;
  maxBinarySizeMb: number;
  maxOutputFilesPerJob: number;
  maxOutputSizeMbPerJob: number;
  toolCacheTtlSeconds: number;
  oauthPendingTtlMinutes: number;
  /**
   * When true, skip the SSRF strict-check for MCP server URLs that resolve to
   * private/loopback addresses. Intended for self-hosted MCP servers on a local
   * network. Default false — all server URLs must resolve to public IPs.
   */
  allowPrivateAddresses: boolean;
}

export const MCP_DEFAULTS: McpRuntimeConfig = {
  callTimeoutSeconds: 60,
  maxBinarySizeMb: 20,
  maxOutputFilesPerJob: 10,
  maxOutputSizeMbPerJob: 200,
  toolCacheTtlSeconds: 600,
  oauthPendingTtlMinutes: 10,
  allowPrivateAddresses: false,
};

export function mergeMcpConfig(partial: Partial<McpRuntimeConfig> | undefined): McpRuntimeConfig {
  return { ...MCP_DEFAULTS, ...(partial ?? {}) };
}
