This FastMCP server binds to 0.0.0.0 and serves a network transport (streamable-http / SSE) without DNS-rebinding protection (CWE-346).
Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
When the host is not loopback, the SDK does NOT auto-enable protection, so a web page the user visits can rebind a DNS name to this server and drive its tools cross-origin. (Binding to 127.0.0.1 auto-protects since 1.23.0.)
Pass explicit transport security with a Host allow-list: from mcp.server.transport_security import TransportSecuritySettings mcp = FastMCP( "name", host="0.0.0.0", transport_security=TransportSecuritySettings( enable_dns_rebinding_protection=True, allowed_hosts=["mcp.example.com"], allowed_origins=["https://app.example.com"], ), )
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.
# oauthlint-disable-next-line auth.py.mcp.dns-rebinding-unprotected -- <reason>