Spaces:
Running
Running
Maanas Verma commited on
remove http from remoteMCPServer model and resolve MCPConfig import in transports.py
Browse files
src/fastmcp/client/transports.py
CHANGED
|
@@ -37,7 +37,7 @@ from fastmcp.client.auth.oauth import OAuth
|
|
| 37 |
from fastmcp.server.dependencies import get_http_headers
|
| 38 |
from fastmcp.server.server import FastMCP
|
| 39 |
from fastmcp.utilities.logging import get_logger
|
| 40 |
-
from fastmcp.utilities.mcp_config import
|
| 41 |
|
| 42 |
if TYPE_CHECKING:
|
| 43 |
from fastmcp.utilities.mcp_config import MCPConfig
|
|
@@ -735,6 +735,7 @@ class MCPConfigTransport(ClientTransport):
|
|
| 735 |
|
| 736 |
def __init__(self, config: MCPConfig | dict):
|
| 737 |
from fastmcp.client.client import Client
|
|
|
|
| 738 |
|
| 739 |
if isinstance(config, dict):
|
| 740 |
config = MCPConfig.from_dict(config)
|
|
@@ -859,7 +860,6 @@ def infer_transport(
|
|
| 859 |
transport = infer_transport(config)
|
| 860 |
```
|
| 861 |
"""
|
| 862 |
-
from fastmcp.utilities.mcp_config import MCPConfig
|
| 863 |
|
| 864 |
# the transport is already a ClientTransport
|
| 865 |
if isinstance(transport, ClientTransport):
|
|
|
|
| 37 |
from fastmcp.server.dependencies import get_http_headers
|
| 38 |
from fastmcp.server.server import FastMCP
|
| 39 |
from fastmcp.utilities.logging import get_logger
|
| 40 |
+
from fastmcp.utilities.mcp_config import infer_transport_type_from_url
|
| 41 |
|
| 42 |
if TYPE_CHECKING:
|
| 43 |
from fastmcp.utilities.mcp_config import MCPConfig
|
|
|
|
| 735 |
|
| 736 |
def __init__(self, config: MCPConfig | dict):
|
| 737 |
from fastmcp.client.client import Client
|
| 738 |
+
from fastmcp.utilities.mcp_config import MCPConfig
|
| 739 |
|
| 740 |
if isinstance(config, dict):
|
| 741 |
config = MCPConfig.from_dict(config)
|
|
|
|
| 860 |
transport = infer_transport(config)
|
| 861 |
```
|
| 862 |
"""
|
|
|
|
| 863 |
|
| 864 |
# the transport is already a ClientTransport
|
| 865 |
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(
|