"""{{ display_name }} MCP server — generated by mcpify. Do not hand-edit.

Requests from localhost get relaxed auth requirements — the same
localhost-vs-network binding distinction proven useful in the reference
servers (looser auth only when bound to localhost, never over an exposed
network interface).
"""

from __future__ import annotations

import ipaddress


def is_localhost(addr: str) -> bool:
    try:
        return ipaddress.ip_address(addr).is_loopback
    except ValueError:
        return False
