fix: explain transport host rejections
Closed
HE
2mo ago+53+53+01234567890123456789-7-7-0123456789
Summary
- keep the existing fail-closed Host validation behavior
- return a structured HTTP 421 body that names
host_not_allowed, the received Host value, and theTransportSecuritySettings.allowed_hostssetting - document reverse-proxy
allowed_hostsconfiguration with host and host:port examples
Fixes #2688.
To verify
uv run pytest tests/server/test_transport_security.py tests/server/test_streamable_http_security.py tests/server/test_sse_security.py tests/interaction/transports/test_hosting_http.py -quv run ruff check src/mcp/server/transport_security.py tests/server/test_transport_security.py tests/server/test_streamable_http_security.py tests/server/test_sse_security.py tests/interaction/transports/test_hosting_http.pyuv run pyright src/mcp/server/transport_security.py tests/server/test_transport_security.py tests/server/test_streamable_http_security.py tests/server/test_sse_security.py tests/interaction/transports/test_hosting_http.pygit diff --check