From 97c9b9cbe44979cd7847a0e8de8fe43bf246643a Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Sat, 31 May 2025 20:30:36 -0400 Subject: [PATCH] Fix import --- src/fastmcp/client/transports.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/fastmcp/client/transports.py b/src/fastmcp/client/transports.py index cafe9588c..5ab1d9a9e 100644 --- a/src/fastmcp/client/transports.py +++ b/src/fastmcp/client/transports.py @@ -37,7 +37,6 @@ from pydantic import AnyUrl from typing_extensions import Unpack from fastmcp.client.auth import OAuth -from fastmcp.server import FastMCP as FastMCPServer from fastmcp.server.dependencies import get_http_headers from fastmcp.server.server import FastMCP from fastmcp.utilities.logging import get_logger @@ -55,7 +54,6 @@ __all__ = [ "ClientTransport", "SSETransport", "StreamableHttpTransport", - "FastMCPServer", "StdioTransport", "PythonStdioTransport", "FastMCPStdioTransport", @@ -656,7 +654,7 @@ class FastMCPTransport(ClientTransport): tests or scenarios where client and server run in the same runtime. """ - def __init__(self, mcp: FastMCPServer | FastMCP1Server): + def __init__(self, mcp: FastMCP | FastMCP1Server): """Initialize a FastMCPTransport from a FastMCP server instance.""" # Accept both FastMCP 2.x and FastMCP 1.0 servers. Both expose a @@ -770,7 +768,7 @@ def infer_transport(transport: ClientTransportT) -> ClientTransportT: ... @overload -def infer_transport(transport: FastMCPServer) -> FastMCPTransport: ... +def infer_transport(transport: FastMCP) -> FastMCPTransport: ... @overload @@ -805,7 +803,7 @@ def infer_transport(transport: Path) -> PythonStdioTransport | NodeStdioTranspor def infer_transport( transport: ClientTransport - | FastMCPServer + | FastMCP | FastMCP1Server | AnyUrl | Path @@ -822,7 +820,7 @@ def infer_transport( The function supports these input types: - ClientTransport: Used directly without modification - - FastMCPServer or FastMCP1Server: Creates an in-memory FastMCPTransport + - FastMCP or FastMCP1Server: Creates an in-memory FastMCPTransport - Path or str (file path): Creates PythonStdioTransport (.py) or NodeStdioTransport (.js) - AnyUrl or str (URL): Creates StreamableHttpTransport (default) or SSETransport (for /sse endpoints) - MCPConfig or dict: Creates MCPConfigTransport, potentially connecting to multiple servers @@ -860,7 +858,7 @@ def infer_transport( return transport # the transport is a FastMCP server (2.x or 1.0) - elif isinstance(transport, FastMCPServer | FastMCP1Server): + elif isinstance(transport, FastMCP | FastMCP1Server): inferred_transport = FastMCPTransport(mcp=transport) # the transport is a path to a script