mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-26 07:24:18 +02:00
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:
parent
09fae7541e
commit
4f4d06ffdb
3 changed files with 28 additions and 2 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue