mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 05:24:18 +02:00
Hotfix: restore --transport streamable http at CLI (#1743)
This commit is contained in:
parent
da9cd52c79
commit
8ffed6a3d9
5 changed files with 33 additions and 10 deletions
|
|
@ -159,7 +159,7 @@
|
|||
"integrations/azure",
|
||||
"integrations/github",
|
||||
"integrations/google",
|
||||
"integrations/workos-oauth"
|
||||
"integrations/workos"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ EnvironmentType: TypeAlias = UVEnvironment
|
|||
class Deployment(BaseModel):
|
||||
"""Configuration for server deployment and runtime settings."""
|
||||
|
||||
transport: Literal["stdio", "http", "sse"] | None = Field(
|
||||
transport: Literal["stdio", "http", "sse", "streamable-http"] | None = Field(
|
||||
default=None,
|
||||
description="Transport protocol to use",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -248,13 +248,13 @@ class TestConfigValidation:
|
|||
deployment={"transport": "invalid_transport"}, # type: ignore[arg-type]
|
||||
)
|
||||
|
||||
def test_streamable_http_transport_rejected(self):
|
||||
"""Test that streamable-http transport is rejected in fastmcp.json config."""
|
||||
with pytest.raises(ValueError):
|
||||
MCPServerConfig(
|
||||
source={"path": "server.py"},
|
||||
deployment={"transport": "streamable-http"}, # type: ignore[arg-type]
|
||||
)
|
||||
def test_streamable_http_transport_accepted(self):
|
||||
"""Test that streamable-http transport is accepted as a valid value."""
|
||||
config = MCPServerConfig(
|
||||
source={"path": "server.py"},
|
||||
deployment={"transport": "streamable-http"}, # type: ignore[arg-type]
|
||||
)
|
||||
assert config.deployment.transport == "streamable-http"
|
||||
|
||||
def test_invalid_log_level_rejected(self):
|
||||
"""Test that invalid log level values are rejected."""
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
"""Test that the generated JSON schema has the correct structure."""
|
||||
|
||||
from fastmcp.utilities.mcp_server_config.v1.mcp_server_config import generate_schema
|
||||
import pytest
|
||||
|
||||
from fastmcp.utilities.mcp_server_config.v1.mcp_server_config import (
|
||||
Deployment,
|
||||
generate_schema,
|
||||
)
|
||||
|
||||
|
||||
def test_schema_has_correct_id():
|
||||
|
|
@ -97,6 +102,7 @@ def test_schema_transport_enum():
|
|||
assert "stdio" in valid_transports
|
||||
assert "http" in valid_transports
|
||||
assert "sse" in valid_transports
|
||||
assert "streamable-http" in valid_transports
|
||||
break
|
||||
elif "properties" in deploy_schema:
|
||||
transport_schema = deploy_schema["properties"].get("transport", {})
|
||||
|
|
@ -107,6 +113,7 @@ def test_schema_transport_enum():
|
|||
assert "stdio" in valid_transports
|
||||
assert "http" in valid_transports
|
||||
assert "sse" in valid_transports
|
||||
assert "streamable-http" in valid_transports
|
||||
break
|
||||
|
||||
|
||||
|
|
@ -147,3 +154,19 @@ def test_schema_log_level_enum():
|
|||
assert "ERROR" in valid_levels
|
||||
assert "CRITICAL" in valid_levels
|
||||
break
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"transport",
|
||||
[
|
||||
"streamable-http",
|
||||
"http",
|
||||
"stdio",
|
||||
"sse",
|
||||
None,
|
||||
],
|
||||
)
|
||||
def test_transport_values_accepted(transport):
|
||||
"""Test that all valid transport values are accepted."""
|
||||
deployment = Deployment(transport=transport)
|
||||
assert deployment.transport == transport
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue