diff --git a/fastmcp_slim/fastmcp/client/client.py b/fastmcp_slim/fastmcp/client/client.py index 805365ec4..be485bf49 100644 --- a/fastmcp_slim/fastmcp/client/client.py +++ b/fastmcp_slim/fastmcp/client/client.py @@ -57,10 +57,7 @@ from fastmcp.client.tasks import ( from fastmcp.mcp_config import MCPConfig from fastmcp.utilities.exceptions import get_catch_handlers from fastmcp.utilities.logging import get_logger -from fastmcp.utilities.timeout import ( - normalize_timeout_to_seconds, - normalize_timeout_to_timedelta, -) +from fastmcp.utilities.timeout import normalize_timeout_to_seconds if TYPE_CHECKING: from fastmcp.server import FastMCP @@ -305,8 +302,8 @@ class Client( self._progress_handler = progress_handler - # Convert timeout to timedelta if needed - timeout = normalize_timeout_to_timedelta(timeout) + # Convert request timeout to float seconds (0 means disabled -> None) + read_timeout_seconds = normalize_timeout_to_seconds(timeout) # handle init handshake timeout (0 means disabled) if init_timeout is None: @@ -320,7 +317,7 @@ class Client( "list_roots_callback": None, "logging_callback": create_log_callback(log_handler), "message_handler": message_handler or TaskNotificationHandler(self), - "read_timeout_seconds": timeout, + "read_timeout_seconds": read_timeout_seconds, "client_info": client_info, } diff --git a/fastmcp_slim/fastmcp/client/transports/base.py b/fastmcp_slim/fastmcp/client/transports/base.py index b21d4efb8..bc13782be 100644 --- a/fastmcp_slim/fastmcp/client/transports/base.py +++ b/fastmcp_slim/fastmcp/client/transports/base.py @@ -1,6 +1,5 @@ import abc import contextlib -import datetime from collections.abc import AsyncIterator from typing import Literal, TypeVar @@ -23,7 +22,7 @@ ClientTransportT = TypeVar("ClientTransportT", bound="ClientTransport") class SessionKwargs(TypedDict, total=False): """Keyword arguments for the MCP ClientSession constructor.""" - read_timeout_seconds: datetime.timedelta | None + read_timeout_seconds: float | None sampling_callback: SamplingFnT | None sampling_capabilities: mcp_types.SamplingCapability | None list_roots_callback: ListRootsFnT | None