INNER CODE UNIT · Python

_serve

hi-godot/godot-ai · src/godot_ai/__init__.py:337

def _serve(
    args: argparse.Namespace,
    capabilities: Any,
    exclude_domains: Any,
    allow_host_networks: Any,
) -> None:
    from godot_ai.transport.origin_guard import bind_host_for_networks

    ## Widen the HTTP bind off loopback only when an allowlist is named. The
    ## DNS-rebinding guard still gates every request by the CIDR(s); binding
    ## off loopback without the guard would be the footgun this flag avoids.
    if allow_host_networks and args.transport in ("sse", "streamable-http"):
        import fastmcp

        fastmcp.settings.host = bind_host_for_networks(allow_host_networks)

    ## #647: fail fast — with a recognizable message and exit code — when a
    ## foreign process holds a port we need, instead of uvicorn's opaque bind

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…