INNER CODE UNIT · Python
_build_transport_security
RekklesNA/ProxmoxMCP-Plus · src/proxmox_mcp/server.py:256
def _build_transport_security(self) -> Any | None:
mcp_config = self.config.mcp
configured = (
mcp_config.dns_rebinding_protection is not None
or bool(mcp_config.allowed_hosts)
or bool(mcp_config.allowed_origins)
)
if not configured:
return None
if TransportSecuritySettings is None:
raise RuntimeError(
"MCP transport security settings require mcp>=1.24.0. "
"Upgrade the mcp package or remove mcp.dns_rebinding_protection, "
"mcp.allowed_hosts, and mcp.allowed_origins from the config."
)
enable_protection = mcp_config.dns_rebinding_protection
if enable_protection is None: