diff --git a/src/fastmcp/utilities/http.py b/src/fastmcp/utilities/http.py index 22c165735..c1237d62e 100644 --- a/src/fastmcp/utilities/http.py +++ b/src/fastmcp/utilities/http.py @@ -3,6 +3,6 @@ import socket def find_available_port() -> int: """Find an available port by letting the OS assign one.""" - with socket.socket() as s: + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind(("127.0.0.1", 0)) return s.getsockname()[1]