mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 13:34:17 +02:00
fix: don't pass HTTP kwargs to run_async when transport is unspecified (#3838)
When transport is None (the default), run_async resolves it to settings.transport which defaults to "stdio". The previous guard `transport != "stdio"` passed HTTP kwargs through for None transport, causing TypeError in run_stdio_async. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9e2e602038
commit
74797c8cac
1 changed files with 8 additions and 2 deletions
|
|
@ -15,6 +15,7 @@ from typing import Any, Literal
|
|||
from mcp.server.fastmcp import FastMCP as FastMCP1x
|
||||
from watchfiles import Change, awatch
|
||||
|
||||
import fastmcp
|
||||
from fastmcp.server.server import FastMCP, create_proxy
|
||||
from fastmcp.utilities.logging import get_logger
|
||||
from fastmcp.utilities.mcp_server_config import (
|
||||
|
|
@ -240,8 +241,13 @@ async def run_command(
|
|||
kwargs = {}
|
||||
if transport is not None:
|
||||
kwargs["transport"] = transport
|
||||
# Only pass HTTP-specific options for non-stdio transports
|
||||
if transport != "stdio":
|
||||
# Resolve effective transport for the HTTP kwargs guard — transport
|
||||
# may be None here if the user didn't pass --transport, in which case
|
||||
# run_async will resolve it from settings.transport.
|
||||
effective_transport = (
|
||||
transport if transport is not None else fastmcp.settings.transport
|
||||
)
|
||||
if effective_transport != "stdio":
|
||||
if host is not None:
|
||||
kwargs["host"] = host
|
||||
if port is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue