Repository navigation
MCP client: let a call pass per-call state to the request customizer (#1770) - #1771
Merged
Merged
Conversation
jlouvel
commented
Nov 30, 2026
jlouvel
left a comment
Collaborator
Author
There was a problem hiding this comment.
The change is correct: sink.contextView() is the subscriber's context at the time the Flux.create callback runs, it is an immutable snapshot handed to the worker, the customizer order keeps the protocol headers last so a call customizer cannot override them, and the setter follows the configure-once and null rules of the other setters. One small point inline.
Review assisted by Claude Code.
Collaborator
Author
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
jlouvel
force-pushed
the
feature/mcp-client-call-context
branch
from
November 30, 2026 03:53
c987458 to
b0119d1
Compare
|
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #1770.
Adds
McpClientAdapter.setCallCustomizer(BiConsumer<Request, ContextView>). For a 2026-07-28 call over HTTP it runs after the request customizer and gets the Reactor context the call was subscribed with (FluxSink.contextView()), so a caller passes per-call state withcontextWriteon the call. The request customizer runs on a worker thread of the transport, where the calling thread's state is not visible.Test:
McpModernClientTestCase.aCallCustomizerGetsTheReactorContextOfItsCall(a call with a context, one without, another with a different one)../mvnw verify -P default,test -pl org.restlet.ext.mcp: 253 tests, JaCoCo, SpotBugs, Spotless. The 2025-11-25 transport has no per-call hook yet.🤖 Generated with Claude Code