Ensure the CLI accepts "streamable-http" as a valid transport (#1099)

* Ensure the CLI accepts "streamable-http" as a valid transport

* Add test for transport aliases
This commit is contained in:
Jeremiah Lowin 2025-07-09 09:35:26 -04:00 committed by GitHub
commit 4f4d06ffdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 2 deletions

View file

@ -246,7 +246,7 @@ def run(
server_spec: str,
*,
transport: Annotated[
Literal["stdio", "http", "sse"] | None,
run_module.TransportType | None,
cyclopts.Parameter(
name=["--transport", "-t"],
help="Transport protocol to use",

View file

@ -11,7 +11,7 @@ from fastmcp.utilities.logging import get_logger
logger = get_logger("cli.run")
# Type aliases for better type safety
TransportType = Literal["stdio", "http", "sse"]
TransportType = Literal["stdio", "http", "sse", "streamable-http"]
LogLevelType = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]

View file

@ -236,6 +236,32 @@ class TestRunCommand:
assert "log_level" not in bound.arguments
assert "path" not in bound.arguments
def test_run_command_transport_aliases(self):
"""Test that both 'http' and 'streamable-http' are accepted as valid transport options."""
# Test with 'http' transport
command, bound, _ = app.parse_args(
[
"run",
"server.py",
"--transport",
"http",
]
)
assert command is not None
assert bound.arguments["transport"] == "http"
# Test with 'streamable-http' transport
command, bound, _ = app.parse_args(
[
"run",
"server.py",
"--transport",
"streamable-http",
]
)
assert command is not None
assert bound.arguments["transport"] == "streamable-http"
class TestWindowsSpecific:
"""Test Windows-specific functionality."""