You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Let the client HTTP transports use a caller-supplied HTTP client, so a connection can be pinned to a checked IP #1359
Problem: we call MCP servers at user-configured URLs. To block SSRF we resolve the host, reject private or internal IPs, and then must connect to that same IP. Otherwise a DNS change between the check and the connect gets around it. The transports take only a JDK HttpClient.Builder, and JDK HttpClient has no per-client DNS hook; only the JVM-wide resolver SPI exists (https://openjdk.org/jeps/418).
Ask: let HttpClientStreamableHttpTransport and the modern HttpClientMcpTransport take a pluggable HTTP layer, e.g. a small interface that sends a request and streams the response, so callers can plug in OkHttp, Apache or Netty with their own DNS. The Python SDK already accepts an httpx client and the Kotlin SDK a ktor HttpClient, which is how we pin the IP there.
changed the title [-]Client HTTP transports can't pin a connection to a checked IP address[/-][+]Let the client HTTP transports use a caller-supplied HTTP client, so a connection can be pinned to a checked IP[/+]on Nov 30, 2026
Activity
[-]Client HTTP transports can't pin a connection to a checked IP address[/-][+]Let the client HTTP transports use a caller-supplied HTTP client, so a connection can be pinned to a checked IP[/+]yuT7-blue commentedon Dec 1, 2026
I'm interested in investigating this issue and potentially contributing a solution.
My initial understanding is that both HTTP transports are tied to the JDK HttpClient, which limits the ability to use custom DNS resolution.
Would introducing a small, pluggable HTTP abstraction that supports asynchronous requests and streaming responses be an acceptable direction?
I'd appreciate the maintainers' feedback before proceeding with the implementation.