Skip to content

Rename (Async)HttpRequestCustomizer to Mcp(Async)HttpRequestCustomizer, add delegating implementation #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Kehrlann
Copy link
Contributor

@Kehrlann Kehrlann commented Aug 5, 2025

Motivation and Context

The name (Async)HttpRequestCustomizer is too broad when used in a broader project. We prefix it with Mcp to make it clearer in what context this should exist. Originally raised in: #388 (comment)

Additionally, users may want to apply mutliple customizers. We provide a convenient "delegating" implementation, that goes through a list of customizers in order. Originally raised in: spring-projects/spring-ai#3994 (comment)

How Has This Been Tested?

n/a

Breaking Changes

Yes, renaming:

  • HttpRequestCustomizer -> McpHttpRequestCustomizer
  • AsyncHttpRequestCustomizer -> McpAsyncHttpRequestCustomizer

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@Kehrlann
Copy link
Contributor Author

Kehrlann commented Aug 5, 2025

Tagging @chemicL , to review DelegatingMcpAsyncHttpRequestCustomizer. It works but there may be more efficient implementations.

@Kehrlann Kehrlann marked this pull request as ready for review August 5, 2025 15:04
public Publisher<HttpRequest.Builder> customize(HttpRequest.Builder builder, String method, URI endpoint,
String body) {
var result = Mono.just(builder);
for (var customizer : this.customizers) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a more efficient way to apply async folding of this. Using reduceWith operator would still have to accumulate using flatMap and would add another operator to the mix, so the loop is fine IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants