Deprecate Builder.customizeRequest() in favor of httpRequestCustomizer() by gyeo009 · Pull Request #791 · modelcontextprotocol/java-sdk

@gyeo009 mentioned this pull request

Feb 13, 2026

Kehrlann

@Kehrlann Kehrlann changed the base branch from main to 1.1.x

April 2, 2026 09:00

@Kehrlann Kehrlann changed the base branch from 1.1.x to main

April 2, 2026 09:00
…and HttpClientStreamableHttpTransport

customizeRequest() executes its consumer once at build time, freezing
headers into the shared requestBuilder. This silently breaks OAuth
token refresh scenarios where the Authorization header needs to be
updated after the transport is built.

Add @deprecated and update Javadoc to clarify the build-time-only
semantics and guide users toward httpRequestCustomizer() or
asyncHttpRequestCustomizer() which run on every request.

Closes modelcontextprotocol#788

@gyeo009 @Kehrlann

@gyeo009 @Kehrlann

Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>

@Kehrlann

Kehrlann

Kehrlann pushed a commit that referenced this pull request

Apr 2, 2026
…r() (#791)

Deprecate Builder.customizeRequest() in HttpClientSseClientTransport and HttpClientStreamableHttpTransport

customizeRequest() executes its consumer once at build time, freezing
headers into the shared requestBuilder. This silently breaks OAuth
token refresh scenarios where the Authorization header needs to be
updated after the transport is built.

Add @deprecated and update Javadoc to clarify the build-time-only
semantics and guide users toward httpRequestCustomizer() or
asyncHttpRequestCustomizer() which run on every request.

Closes #788

Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>