mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 02:10:38 +02:00
Pass host/port as kwargs to v1 server transport runners (v2 Settings drops host/port)
This commit is contained in:
parent
e38aa641d0
commit
7c4667a1c9
1 changed files with 7 additions and 4 deletions
|
|
@ -322,18 +322,21 @@ async def run_v1_server_async(
|
|||
port: Port to bind to
|
||||
transport: Transport protocol to use
|
||||
"""
|
||||
# In v1 (MCPServer), host/port are no longer stored on `settings`; they are
|
||||
# passed directly to the transport runners as keyword arguments.
|
||||
bind_kwargs: dict[str, Any] = {}
|
||||
if host is not None:
|
||||
server.settings.host = host
|
||||
bind_kwargs["host"] = host
|
||||
if port is not None:
|
||||
server.settings.port = port
|
||||
bind_kwargs["port"] = port
|
||||
|
||||
match transport:
|
||||
case "stdio":
|
||||
await server.run_stdio_async()
|
||||
case "http" | "streamable-http" | None:
|
||||
await server.run_streamable_http_async()
|
||||
await server.run_streamable_http_async(**bind_kwargs)
|
||||
case "sse":
|
||||
await server.run_sse_async()
|
||||
await server.run_sse_async(**bind_kwargs)
|
||||
|
||||
|
||||
def _watch_filter(_change: Change, path: str) -> bool:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue