Spaces:
Running
Running
Merge pull request #763 from Maanas-Verma/config-refactor
Browse files
src/fastmcp/client/transports.py
CHANGED
|
@@ -8,7 +8,7 @@ import sys
|
|
| 8 |
import warnings
|
| 9 |
from collections.abc import AsyncIterator, Callable
|
| 10 |
from pathlib import Path
|
| 11 |
-
from typing import
|
| 12 |
|
| 13 |
import anyio
|
| 14 |
import httpx
|
|
@@ -27,9 +27,6 @@ from fastmcp.server.server import FastMCP
|
|
| 27 |
from fastmcp.utilities.logging import get_logger
|
| 28 |
from fastmcp.utilities.mcp_config import MCPConfig, infer_transport_type_from_url
|
| 29 |
|
| 30 |
-
if TYPE_CHECKING:
|
| 31 |
-
from fastmcp.utilities.mcp_config import MCPConfig
|
| 32 |
-
|
| 33 |
logger = get_logger(__name__)
|
| 34 |
|
| 35 |
# TypeVar for preserving specific ClientTransport subclass types
|
|
@@ -870,7 +867,6 @@ def infer_transport(
|
|
| 870 |
transport = infer_transport(config)
|
| 871 |
```
|
| 872 |
"""
|
| 873 |
-
from fastmcp.utilities.mcp_config import MCPConfig
|
| 874 |
|
| 875 |
# the transport is already a ClientTransport
|
| 876 |
if isinstance(transport, ClientTransport):
|
|
|
|
| 8 |
import warnings
|
| 9 |
from collections.abc import AsyncIterator, Callable
|
| 10 |
from pathlib import Path
|
| 11 |
+
from typing import Any, Literal, TypedDict, TypeVar, cast, overload
|
| 12 |
|
| 13 |
import anyio
|
| 14 |
import httpx
|
|
|
|
| 27 |
from fastmcp.utilities.logging import get_logger
|
| 28 |
from fastmcp.utilities.mcp_config import MCPConfig, infer_transport_type_from_url
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
logger = get_logger(__name__)
|
| 31 |
|
| 32 |
# TypeVar for preserving specific ClientTransport subclass types
|
|
|
|
| 867 |
transport = infer_transport(config)
|
| 868 |
```
|
| 869 |
"""
|
|
|
|
| 870 |
|
| 871 |
# the transport is already a ClientTransport
|
| 872 |
if isinstance(transport, ClientTransport):
|
src/fastmcp/utilities/mcp_config.py
CHANGED
|
@@ -55,7 +55,7 @@ class StdioMCPServer(FastMCPBaseModel):
|
|
| 55 |
class RemoteMCPServer(FastMCPBaseModel):
|
| 56 |
url: str
|
| 57 |
headers: dict[str, str] = Field(default_factory=dict)
|
| 58 |
-
transport: Literal["streamable-http", "sse"
|
| 59 |
auth: Annotated[
|
| 60 |
str | Literal["oauth"] | None,
|
| 61 |
Field(
|
|
|
|
| 55 |
class RemoteMCPServer(FastMCPBaseModel):
|
| 56 |
url: str
|
| 57 |
headers: dict[str, str] = Field(default_factory=dict)
|
| 58 |
+
transport: Literal["streamable-http", "sse"] | None = None
|
| 59 |
auth: Annotated[
|
| 60 |
str | Literal["oauth"] | None,
|
| 61 |
Field(
|