π The fast, Pythonic way to build MCP servers and clients.
accept timeouts in MCPConfig
Chris Egersdoerfer3a304b46af3a
diff --git a/src/fastmcp/utilities/mcp_config.py b/src/fastmcp/utilities/mcp_config.pyindex de7aad8f1..f51591956 100644--- a/src/fastmcp/utilities/mcp_config.py+++ b/src/fastmcp/utilities/mcp_config.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport refrom typing import TYPE_CHECKING, Annotated, Any, Literalfrom urllib.parse import urlparse+import datetimeimport httpxfrom pydantic import AnyUrl, ConfigDict, Field@@ -65,6 +66,7 @@ class RemoteMCPServer(FastMCPBaseModel):description='Either a string representing a Bearer token, the literal "oauth" to use OAuth authentication, or an httpx.Auth instance for custom authentication.',),] = None+ sse_read_timeout: datetime.timedelta | int | float | None = Nonemodel_config = ConfigDict(arbitrary_types_allowed=True)@@ -77,11 +79,19 @@ class RemoteMCPServer(FastMCPBaseModel):transport = self.transportif transport == "sse":- return SSETransport(self.url, headers=self.headers, auth=self.auth)+ return SSETransport(+ self.url,+ headers=self.headers,+ auth=self.auth,+ sse_read_timeout=self.sse_read_timeout,+ )else:# Both "http" and "streamable-http" map to StreamableHttpTransportreturn StreamableHttpTransport(- self.url, headers=self.headers, auth=self.auth+ self.url,+ headers=self.headers,+ auth=self.auth,+ sse_read_timeout=self.sse_read_timeout,)