Skip to content

Conversation

@quaff
Copy link
Contributor

@quaff quaff commented Jul 31, 2025

Closes GH-3948

@quaff quaff force-pushed the patch-23 branch 3 times, most recently from 5a533f2 to ee7e273 Compare August 15, 2025 01:44
@quaff quaff changed the title Support custom HTTP headers for MCP SSE transport Support custom HTTP headers for MCP transport Aug 19, 2025
@quaff quaff force-pushed the patch-23 branch 4 times, most recently from 150031d to 18308d5 Compare September 5, 2025 00:43
@tzolov
Copy link
Contributor

tzolov commented Sep 5, 2025

@quaff hopefully this case is addressed by #2506 (comment) ?

@quaff
Copy link
Contributor Author

quaff commented Sep 8, 2025

@quaff hopefully this case is addressed by #2506 (comment) ?

@tzolov I don't think so, it's a different issue, this PR aims to pass long-live access token, and other custom headers.

@ilayaperumalg
Copy link
Member

@Kehrlann Please share your review on this. Thanks!

Closes spring-projectsGH-3948

Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
@Kehrlann
Copy link
Contributor

After discussion with the team, we have decided not to expand the configuration surface.

If you would like to add headers for which you know the value in advance, please use the following java configuration:

  1. For web-client based support, provide your own WebClient.Builder:
@Bean
WebClient.Builder mcpClient() {
    return WebClient.builder().defaultHeader("x-custom-header", "<HEADER-VALUE>");
}
  1. For HTTP-client based, provide McpSyncRequestCustomizer or McpAsyncRequestCustomizer:
@Bean
McpSyncHttpClientRequestCustomizer requestCustomizer() {
    return (builder, method, endpoint, body, context) -> builder.header("x-custom-header", "<HEADER-VALUE>");
}

@Kehrlann Kehrlann closed this Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support custom HTTP headers for MCP transport

5 participants