Several places use x or default to merge user-provided values with defaults. This silently drops falsy-but-valid values like port=0 (OS-assigned port), host="" (all interfaces), and description="" (explicitly cleared).
run_http() — port=0 and host="" ignored
# src/fastmcp/server/mixins/transport.py:266-267
host = host or fastmcp.settings.host # host="" becomes "127.0.0.1"
port = port or fastmcp.settings.port # port=0 becomes 8000
port=0 is the standard way to request an OS-assigned port. host="" binds to all interfaces. Both are silently replaced.
CLI run command — same pattern
# src/fastmcp/cli/cli.py:604-609
final_host = host or config.deployment.host
final_port = port or config.deployment.port
final_path = path or config.deployment.path
fastmcp run server.py --port 0 silently uses the config port instead.
Tool/resource/prompt description — empty string falls through to docstring
# src/fastmcp/tools/function_tool.py:225
description=metadata.description or parsed_fn.description
# src/fastmcp/resources/function_resource.py:199
description=metadata.description or inspect.getdoc(fn)
# src/fastmcp/prompts/function_prompt.py:155
description = metadata.description or inspect.getdoc(fn)
@mcp.tool(description="")
def my_tool() -> str:
"""This docstring should NOT be used as description"""
return "hello"
# description is "This docstring should NOT be used as description"
Fix
Replace x or default with x if x is not None else default in all affected locations.
🤖 Generated with Claude Code
Several places use
x or defaultto merge user-provided values with defaults. This silently drops falsy-but-valid values likeport=0(OS-assigned port),host=""(all interfaces), anddescription=""(explicitly cleared).run_http()— port=0 and host="" ignoredport=0is the standard way to request an OS-assigned port.host=""binds to all interfaces. Both are silently replaced.CLI
runcommand — same patternfastmcp run server.py --port 0silently uses the config port instead.Tool/resource/prompt description — empty string falls through to docstring
Fix
Replace
x or defaultwithx if x is not None else defaultin all affected locations.🤖 Generated with Claude Code