From 74797c8cac40805f19d082cc7e1ab047f20d161f Mon Sep 17 00:00:00 2001 From: Bill Easton Date: Sun, 12 Apr 2026 11:51:34 -0500 Subject: [PATCH] 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) --- src/fastmcp/cli/run.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/fastmcp/cli/run.py b/src/fastmcp/cli/run.py index 9adedf657..9c39a5dbd 100644 --- a/src/fastmcp/cli/run.py +++ b/src/fastmcp/cli/run.py @@ -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: