Repository navigation
feat(binding-mcp): MCP elicitation across server, proxy, and client kinds (#1739) - #1752
Merged
Merged
Conversation
Define typed extension flyweights for the MCP elicitation flow on the
originating tools/call stream.
mcp.idl:
- McpChallengeEx union with elicitCreate case carrying
McpElicitCreateChallengeEx { id, url }. CHALLENGE matches MCP's
"no unsolicited elicitation" requirement structurally -- target ->
initiator on INITIAL stream, only valid on an active request.
- McpFlushEx union with elicitCallback (FLUSH carrying OAuth callback
url) and elicitComplete (FLUSH carrying id + status).
- McpElicitStatus enum (COMPLETED, DECLINED, CANCELLED).
McpFunctions:
- challengeEx() / matchChallengeEx() builder + matcher with nested
elicitCreate sub-builder.
- flushEx() / matchFlushEx() builder + matcher with nested
elicitCallback and elicitComplete sub-builders.
McpFunctionsTest: 35 tests covering each builder/matcher pair plus
empty-matcher, case-mismatch and field-mismatch failure paths.
…1739) Application-level scripts and IT method for the elicitation happy path on a tools/call mcp app stream: - read tools/call BEGIN+DATA on initial - write CHALLENGE elicitCreate on initial reverse (target -> initiator) - read FLUSH elicitCallback on initial forward (initial held open until callback arrives, deferred-END convention) - read closed (initial END after callback) - write reply BEGIN - write FLUSH elicitComplete on reply forward - write tool result DATA, close reply Verified peer-to-peer self-consistent via ApplicationIT#shouldCallToolElicitCompleted.
…1739) Application-level scripts and IT method for the elicitation declined path: - read tools/call BEGIN+DATA on initial - write CHALLENGE elicitCreate - read FLUSH elicitCallback (callback URL carries error=access_denied) - read closed - write reply BEGIN - write FLUSH elicitComplete{DECLINED} - write abort (original tools/call cannot proceed without credentials) Verified peer-to-peer self-consistent via ApplicationIT#shouldCallToolElicitDeclined.
) Application-level scripts and IT method for the elicitation timeout path: - read tools/call BEGIN+DATA on initial - write CHALLENGE elicitCreate - (no elicitCallback within timeout window — user did not complete OAuth) - write reply BEGIN - write FLUSH elicitComplete{CANCELLED} - write abort Verified peer-to-peer self-consistent via ApplicationIT#shouldCallToolElicitTimeout.
…1739) Application-level scripts and IT method exercising the elicitation happy path on the lifecycle (initialize) stream: - read lifecycle BEGIN - write lifecycle BEGIN reply - write CHALLENGE elicitCreate - read FLUSH elicitCallback - write FLUSH elicitComplete{COMPLETED} - (lifecycle stays open — no END) Verified peer-to-peer self-consistent via ApplicationIT#shouldInitializeElicitCompleted.
…1739) Application-level scripts and IT method for the elicitation declined path on the lifecycle (initialize) stream: - read lifecycle BEGIN, write lifecycle BEGIN reply - write CHALLENGE elicitCreate - read FLUSH elicitCallback (callback URL carries error=access_denied) - write FLUSH elicitComplete{DECLINED} - write abort Verified peer-to-peer self-consistent via ApplicationIT#shouldInitializeElicitDeclined.
) Application-level scripts and IT method for the elicitation timeout path on the lifecycle (initialize) stream: - read lifecycle BEGIN, write lifecycle BEGIN reply - write CHALLENGE elicitCreate - (no elicitCallback within timeout window) - write FLUSH elicitComplete{CANCELLED} - write abort Verified peer-to-peer self-consistent via ApplicationIT#shouldInitializeElicitTimeout.
) Application-level scripts for the elicitation flow through an mcp proxy with a single bluesky-tagged toolkit route. Pattern (mirrors tools.call.toolkit): - client (upstream of proxy) sends tools/call name="bluesky__get_weather" with json data carrying same prefixed name - server (downstream of proxy) accepts tools/call name="get_weather" (toolkit prefix stripped from BEGIN extension) - elicitCreate URL state on client side carries "bluesky__7f3a9b1c" (proxy prepended toolkit prefix going upstream) - server side sees state="7f3a9b1c" (no toolkit prefix yet) - elicitCallback: client sends URL state="bluesky__7f3a9b1c"; server reads state="7f3a9b1c" (proxy stripped toolkit prefix going downstream and routed to bluesky-tagged backend) - elicitComplete and tool result flow back upstream No ApplicationIT method — toolkit scenarios require the proxy in the pipeline, exercised by McpProxyIT in the runtime project once implementation lands. Script syntax validated via k3po:validate.
Network-side scripts and IT method exercising the wire emission of
elicitation/create as an SSE event on a tools/call response.
- standard initialize + notifications/initialized handshake
- POST /mcp tools/call (Accept includes text/event-stream)
- 200 response with content-type text/event-stream
- SSE event id: 2:1 carrying
data: {"jsonrpc":"2.0","method":"elicitation/create",
"params":{"mode":"url","elicitationId":"elicit-1",
"url":"https://provider.example/authorize?
state=session-1.7f3a9b1c&
redirect_uri=https://localhost:8080/mcp/auth/callback"}}
State carries only sessionId prefix (no toolkit__) — server-self-contained
case where the proxy is not in the pipeline. Callback URL substituted by
mcp-server in place of CALLBACK_PLACEHOLDER.
Verified peer-to-peer self-consistent via
NetworkIT#shouldCallToolElicitCreate.
Network-side scripts and IT method exercising the OAuth callback endpoint that the browser is redirected to: - GET /mcp/auth/callback?code=xyz&state=session-1.7f3a9b1c - 200 text/plain "Authorization complete, you may close this tab." The state query parameter carries the sessionId prefix added by the mcp-server binding when emitting elicitation/create upstream. The http-server affinity routing extracts the first [^.]+ segment to hash-route the callback to the correct worker thread. Verified peer-to-peer self-consistent via NetworkIT#shouldReceiveAuthCallback.
Network-side scripts and IT method exercising the full happy-path wire
trace of the elicitation flow on a tools/call response SSE stream:
- standard initialize + notifications/initialized handshake
- POST /mcp tools/call
- 200 text/event-stream response carrying three SSE events:
id: 2:1 data: elicitation/create (mode=url, elicitationId, url)
id: 2:2 data: elicitation/complete (elicitationId, status=completed)
id: 2:3 data: tool result (jsonrpc id=2)
- response stream closes
Verified peer-to-peer self-consistent via
NetworkIT#shouldCallToolElicitComplete.
…cenario (#1739) Network-side scripts and IT method exercising the OAuth callback endpoint when the state's elicitationId portion does not map to any in-flight elicitation (e.g., timed out and evicted, or never existed): - GET /mcp/auth/callback?code=xyz&state=session-1.unknown - 410 Gone "Authorization session expired or unknown." Verified peer-to-peer self-consistent via NetworkIT#shouldRejectAuthCallbackUnknownElicitation.
#1739) Align network scenario name with its application-level counterpart (tools.call.elicit.completed). Both layers now share the consistent ".completed" suffix denoting the COMPLETED elicitation outcome. The focused tools.call.elicit.create network scenario stays distinct because it tests just the elicitCreate emission rather than the full happy path.
Network counterpart of the application-level declined scenario. Wire
trace shows:
- standard initialize + notifications/initialized handshake
- POST /mcp tools/call
- 200 text/event-stream response carrying:
id: 2:1 data: elicitation/create
id: 2:2 data: elicitation/complete (status=declined)
id: 2:3 data: jsonrpc error -32000 "Authorization declined"
- response stream closes
Verified peer-to-peer self-consistent via
NetworkIT#shouldCallToolElicitDeclined.
Network counterpart of the application-level timeout scenario. Wire
trace shows:
- standard initialize + notifications/initialized handshake
- POST /mcp tools/call
- 200 text/event-stream response carrying:
id: 2:1 data: elicitation/create
id: 2:2 data: elicitation/complete (status=cancelled)
id: 2:3 data: jsonrpc error -32000 "Authorization timed out"
- response stream closes
Verified peer-to-peer self-consistent via
NetworkIT#shouldCallToolElicitTimeout.
Network counterpart of the application-level initialize.elicit.completed
scenario. Wire trace shows:
- POST /mcp initialize (Accept: application/json, text/event-stream)
- 200 text/event-stream with mcp-session-id header
(server upgrades response to SSE because elicitation is required mid-flow)
- SSE events:
id: 1:1 data: elicitation/create
id: 1:2 data: elicitation/complete (status=completed)
id: 1:3 data: jsonrpc id=1 result (initialize result)
- response stream closes
Verified peer-to-peer self-consistent via
NetworkIT#shouldInitializeElicitCompleted.
…rios (#1739) Network counterparts of the application-level declined/timeout initialize scenarios. Wire trace shows: - POST /mcp initialize (Accept: application/json, text/event-stream) - 200 text/event-stream with mcp-session-id header - SSE events: id: 1:1 data: elicitation/create id: 1:2 data: elicitation/complete (status=declined or cancelled) id: 1:3 data: jsonrpc id=1 error -32000 ("Authorization declined" or "Authorization timed out") - response stream closes Verified peer-to-peer self-consistent via NetworkIT#shouldInitializeElicitDeclined and NetworkIT#shouldInitializeElicitTimeout.
Network counterpart of the application-level toolkit scenario. Wire
trace shows the toolkit prefix visible end-to-end:
- POST /mcp tools/call with name="bluesky__get_weather"
- 200 text/event-stream response carrying:
id: 2:1 data: elicitation/create
url state="session-1.bluesky__7f3a9b1c"
(server prefixed sessionId; proxy prefixed toolkit)
id: 2:2 data: elicitation/complete (status=completed)
id: 2:3 data: jsonrpc id=2 tool result
No NetworkIT method — toolkit scenarios require the proxy in the
pipeline, exercised by runtime ITs once implementation lands. Script
syntax validated via k3po:validate.
Per the MCP spec, server-initiated requests including elicitation/create are not permitted before notifications/initialized. Sending elicitation/create on the initialize response would be a protocol violation that an MCP-compliant client would reject. The mcp-client binding instead defers backend communication until after init success: the Zilla-facing initialize completes without backend contact; the first post-init request (typically tools/call) is what triggers elicitation, which is exactly what the tools.call.elicit.* scenarios cover. A focused lifecycle.initialize.elicit.deferred scenario will be added separately to illustrate the deferred behavior.
…licit (#1739) Match the existing convention where toolkit-bearing scenarios place ".toolkit" immediately after the operation (e.g., tools.call.toolkit, tools.call.toolkit.with.progress). The elicitation suffix follows last: tools.call.toolkit.elicit at both application and network layers. No content change — directory rename only.
…#1739) The focused tools.call.elicit.create network scenario is fully covered by tools.call.elicit.{completed,declined,timeout} -- they all start with the same handshake, POST /mcp tools/call, 200 text/event-stream, and emit the elicitation/create event before continuing. The standalone .create scenario only stopped early and added no test coverage beyond what the three full-flow scenarios already exercise.
Apply the existing multi-line single-quote concatenation pattern to
the elicitation JSON structures inside SSE data: events for the
tools.call.elicit.{completed,declined,timeout} network scenarios.
Each JSON object is now broken across multiple single-quoted lines
that k3po concatenates without newlines, so the observed wire bytes
are unchanged while the scripts are easier to read.
Equivalence verified by temporarily reverting one side of a pair
to its single-line form and confirming the test still passes.
Also drop the tools.call.toolkit.elicit network scenario entirely:
toolkit prefix manipulation is purely a proxy binding (app-to-app)
concern and never appears on the wire, so the network-level scenario
was misleading. The application-level tools.call.toolkit.elicit
scenario remains and continues to cover the proxy behaviour.
…1739) - Rename authorization URL host from provider.example to server.example.com to align with the standard reserved example domain (RFC 2606) used elsewhere in the project. - URL-escape the redirect_uri parameter value in elicitation URLs as required when embedding a URL inside another URL's query string. The CALLBACK_PLACEHOLDER (https://replace.me/callback) and the substituted callback URI (https://localhost:8080/mcp/auth/callback) are both now encoded as percent-escaped values. Wire bytes change is intentional and observable: scripts and McpFunctions test fixtures updated together. Verified with full reactor build: runtime/binding-mcp ITs all green (McpClientIT, McpServerIT, McpProxyIT, ApplicationIT, NetworkIT).
Add config plumbing for the upcoming elicitation flow in the mcp server kind: - Schema patch: new options.elicitation block with callback path property (default: auth/callback). - McpElicitationConfig + builder pojos. - McpOptionsConfig and builder updated to carry elicitation. - McpOptionsConfigAdapter reads/writes the new block. No behavior change yet — McpServerFactory does not consume the config. Subsequent commits will wire the callback path recognition, CHALLENGE elicitCreate interception, and FLUSH elicitComplete forwarding. Verified: full reactor build clean; 50 ApplicationIT, 54 NetworkIT, 128 runtime/binding-mcp tests all pass.
Add path-based dispatch so the mcp server kind responds to inbound GET requests at the configured elicitation callback path with a 200 text/plain "Authorization complete..." body, suitable for the browser that completed the OAuth dance. Implementation: - New :path header lookup in newStream dispatch. - isAuthCallbackPath helper that matches when the request path (excluding query) ends with "/" + options.elicitation.callback, defaulting to "auth/callback". - New McpAuthCallbackHandler stream handler that emits a 200 reply with the success body once the inbound request closes. - New STATUS_410 and CONTENT_TYPE_TEXT_PLAIN constants for upcoming reject/unknown-elicitation handling. This step unconditionally returns 200; full elicitationId tracking and 410 Gone for unknown elicitations land in the next commit alongside CHALLENGE elicitCreate handling. Verified: McpServerIT#shouldReceiveAuthCallback passes; 50 McpServerIT total (+1), 129 runtime/binding-mcp tests all pass.
…1739) Resolve the auth callback's `state` query param against the per-session `elicitations` map; respond 200 OK with the configured success body when a suspended request stream is found, otherwise 410 Gone with an "expired or unknown" body. Replace the placeholder `auth.callback` scenario with the explicit `reject.auth.callback.unknown.elicitation` IT (the placeholder's success path now requires the full elicit-create flow, which lands in a follow-up commit). Also adds the per-session `elicitations` map and the request-stream `doAppFlushElicitCallback` writer, used by the success branch once the CHALLENGE elicitCreate flow lands. https://claude.ai/code/session_0172bbrihatvupUXDAn5ddvC
…te (#1739) On the request stream's reply path, parse a `McpChallengeEx` extension on inbound CHALLENGE; if `elicitCreate`, prepend `<sessionId>.` to the URL's `state` parameter, substitute `redirect_uri` with a synthesized `https://<authority><path>/<callback>` derived from the inbound POST headers and the binding's elicitation config, register the request stream under the original `state` token in the per-session `elicitations` map, upgrade the response to `text/event-stream`, and emit two SSE events (an empty `id: <reqId>:0` init marker, then `id: <reqId>:1` carrying the `elicitation/create` JSON-RPC envelope). On the request stream's reply FLUSH path, recognize `elicitComplete` extension and emit a matching `id: <reqId>:N` SSE event with the `elicitation/complete` envelope, then deregister the state token. Pre-existing flush kinds (resumable / progress / suspend) and the non-elicit CHALLENGE fast-path remain on their original code paths. Per-instance state on `McpServer`: `elicitMode` flag, `elicitSeq` counter for SSE event ids, plus `redirectUri` set at construction. `McpRequestStream` carries a `stateToken` back-pointer so `elicitComplete` can deregister deterministically. The end-to-end success scenario (`shouldCallToolElicitCompleted`) is not yet exercisable from `McpServerIT` because the flow needs zilla to defer forwarding the network END to the app stream until after the elicitation completes (the deferred-END convention noted in the issue plan but not yet implemented). The peer-to-peer ApplicationIT covers the same scenario and continues to pass. https://claude.ai/code/session_0172bbrihatvupUXDAn5ddvC
#1739) Add `resolveRedirectUri(HttpBeginExFW)` to `McpBindingConfig`. It extracts `:authority` and `:path` from the inbound BEGIN extension and combines them with the binding's own `options.elicitation.callback` to form `https://<authority><path>/<callback>`. `newStream` no longer performs header lookup or URL synthesis for the redirect URI — it just calls `binding.resolveRedirectUri(httpBeginEx)` and passes the result to the McpServer constructor. https://claude.ai/code/session_0172bbrihatvupUXDAn5ddvC
…cpServerIT (#1739) Add `shouldCallToolElicitCompleted` to McpServerIT and the parallel auth-callback connect/accept block to the network elicit-completed scripts so the scenario drives a second connection that resolves the elicitation. Annotated `@Ignore` on the IT method: peer-to-peer ApplicationIT and NetworkIT pass with the existing CHALLENGE elicitCreate handler, but through the zilla k3po driver `write advised zilla:challenge` does not emit a wire CHALLENGE today, so the app-side script cannot trigger SSE upgrade for elicit-create from a Zilla-mediated test. The same limitation already exists for `tools.call.with.progress.suspended`; that test passes only because it independently triggers SSE upgrade via a `progressToken` field on the request. Re-enabling this IT requires either a k3po-driver-zilla fix to emit CHALLENGE frames on write-advised, or moving elicitCreate from CHALLENGE onto a FLUSH extension (which does flow through the driver). Either approach is bigger than Phase 1 close-out; tracking as a follow-up. https://claude.ai/code/session_0172bbrihatvupUXDAn5ddvC
#1739) CHALLENGE flows target -> initiator on the initial direction, like WINDOW and RESET, so the k3po script verbs are inverted from FLUSH: - target side (accepted server) uses `read advise zilla:challenge` with a `challengeEx()` builder to SEND the CHALLENGE on the read direction's reverse - initiator side (connect client) uses `write advised zilla:challenge` with a `matchChallengeEx()` matcher to CONFIRM RECEIPT on the write direction's context The four elicit scenarios were authored with the inverted form; flip them so the script semantics match the wire-level direction. All peer-to-peer ApplicationIT (50/50) and NetworkIT (53/53) remain green. Update the `shouldCallToolElicitCompleted` ignore reason to point at the actual blocker: zilla forwards the network END to the app stream eagerly (in `McpServer.onNetEnd`), closing initial-forward before the app's `read advise zilla:challenge` can fire to send CHALLENGE back. A targeted deferred-END change in zilla is needed to unblock this; a naive blanket deferral broke other request-stream tests that read END before writing reply. https://claude.ai/code/session_0172bbrihatvupUXDAn5ddvC
Apply review comments from #1752: - McpBindingConfig.resolveRedirectUri: collapse the matchFirst + null guards into Optional.ofNullable().map().orElse(null) chains; static import McpElicitationConfig.DEFAULT_CALLBACK_PATH and pull the callback through the same Optional chain via options.elicitation.callback. - McpServerFactory.newStream: same Optional.ofNullable pattern for every HTTP header lookup (session/method/accept/path on POST; scheme/authority on GET auth-callback). Drop resolvedSession (just use session) and the redundant `binding != null` guard before resolveRedirectUri (already implied by route != null). Rename redirectUri/callbackUrl to redirectURI/callbackURL (URI/URL acronyms uppercased). - HttpFunctions: add @function String encodeQuery(String) that returns URLEncoder.encode(value, UTF_8).replace("+", "%20"). Use it in the four application elicit scripts so the redirect_uri value reads as "https://replace.me/callback" instead of the URL-encoded literal. - McpServer encoder cleanup: drop the elicitSeq field and the `id:` line from doEncodeResponsePreamble and doEncodeElicitErrorEvent — the final response and error events are terminal and don't need a Last-Event-ID for resumption. The remaining init/create/complete events use fixed ELICIT_INIT_SEQ/ELICIT_CREATE_SEQ/ELICIT_COMPLETE_SEQ constants. Update the network elicit.{completed,declined,timeout} scripts to drop the matching `id: 2:3` reads/writes. - Drop the elicitMode boolean: the END-deferral gate is now `stream != null && stream.stateToken == null`, which captures the same state (CHALLENGE elicitCreate received and elicitation pending) without an additional one-way flag. McpServerIT 53/53, McpClientIT 42/42, McpProxyIT 37/37, ApplicationIT 50/50, NetworkIT 53/53.
jfallows
commented
May 7, 2026
| public String resolveRedirectUri( | ||
| HttpBeginExFW httpBeginEx) | ||
| { | ||
| String redirectUri = null; |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| String redirectUri = null; | |
| String redirectURI = null; |
| return result; | ||
| } | ||
|
|
||
| public String resolveRedirectUri( |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| public String resolveRedirectUri( | |
| public String resolveRedirectURI( |
Comment on lines
+4724
to
+4728
| private static String manipulateElicitUrl( | ||
| String originalUrl, | ||
| String sessionId, | ||
| String redirectURI) | ||
| { |
Contributor
Author
There was a problem hiding this comment.
Can we use Pattern, Matcher and replace via regex here instead of verbose parsing?
Comment on lines
+118
to
+120
| private static final int ELICIT_INIT_SEQ = 0; | ||
| private static final int ELICIT_CREATE_SEQ = 1; | ||
| private static final int ELICIT_COMPLETE_SEQ = 2; |
Contributor
Author
There was a problem hiding this comment.
These should not be needed.
The id field from the initial challenge ex and reply flush ex frames is the SSE event id for elicitation, same approach as other similar frames unrelated to elicitation.
- McpBindingConfig: rename `resolveRedirectUri` -> `resolveRedirectURI` (method + local variable) for URI acronym consistency. - McpServerFactory.manipulateElicitUrl: replace the verbose query parser with two Pattern.replaceFirst calls — STATE_PARAM_PATTERN prefixes the state value with `<sessionId>.` and REDIRECT_URI_PARAM_PATTERN replaces the redirect_uri value with the URL-encoded effective callback URL. McpServerIT 53/53, McpClientIT 42/42, McpProxyIT 37/37, ApplicationIT 50/50, NetworkIT 53/53. Note: a second batch of review feedback (drop ELICIT_*_SEQ constants and use the elicit frame extension `id` field as the SSE event id) is being investigated alongside a binding-http CI failure caused by 484fb4e's deferred-WINDOW-via-task-queue change; will follow in a separate commit.
…1739) Add `read "This is some data"` before `read abort` in the backend script. Without it, the backend's read-abort fires immediately after `connected`, racing the proxy's data write — under faster RESET timing the proxy's WriteTask runs after the channel is write-aborted and its write-handler future never completes, hanging the script. Adding the explicit `read` makes the backend wait for the proxy's data to arrive before aborting, forcing the deterministic ordering WINDOW -> data -> RESET. The change has no effect on the test's intent (verifying the proxy doesn't retry non-idempotent requests). Found while exercising the engine k3po driver's deferred-WINDOW path (484fb4e): with WINDOW emitted via the task queue the original script race surfaced; this script update removes the race and the engine path needs no further change.
Address review feedback: drop the hardcoded ELICIT_INIT_SEQ /
ELICIT_CREATE_SEQ / ELICIT_COMPLETE_SEQ constants and use the `id` field
from the elicitCreate (CHALLENGE ext) and elicitComplete (FLUSH ext)
frames as the SSE event id, mirroring the existing pattern in
encodeSseNotifyEvent / encodeSseProgressEvent (where the SSE id is the
notification / progress id from the corresponding frame ext).
- Drop doEncodeElicitInitEvent and the empty `id: <reqId>:0\n\n`
preamble it emitted on the network response. The init event served no
purpose: it was an SSE event with no `data:` field (so clients did not
dispatch it) and the binding has no logic that resumes from a
Last-Event-ID anchor pointed at it.
- doEncodeElicitCreateDataEvent now emits `id: <reqId>:<elicitationId>`
using the elicitCreate ext's `id` field.
- doEncodeElicitCompleteDataEvent emits the same SSE id using the
elicitComplete ext's `id` field (same elicitation id, since both
frames refer to the same elicitation cycle).
- Replace encodeSseIdLine(int seq) helper with encodeSseElicitIdLine
(String elicitationId).
- Update the network elicit.{completed,declined,timeout} scripts to
match: drop the `id: 2:0\n` + empty-event reads/writes, change the
create / complete events from `id: 2:1\n` / `id: 2:2\n` to
`id: 2:elicit-1\n`.
McpServerIT 53/53, McpClientIT 42/42, McpProxyIT 37/37,
ApplicationIT 50/50, NetworkIT 53/53.
…vent id - Add ElicitationIdSupplier to McpConfiguration (UUID by default), mirroring SessionIdSupplier so ITs can override deterministically - Synthesise opaque elicitationId on CHALLENGE arrival; use challenge.id() as the SSE event-id sequence component (consistent with progress/resumable form) - Replace state=<sessionId>.<orig> URL prefix with state=<elicitationId>.<orig> - Move per-session elicitations map to factory-wide map keyed by elicitationId - Override supplier to return 'elicit-1' in McpServerIT for deterministic scripts - Add shouldGenerateElicitCreateChallengeEx unit test for builder coverage
…e prefix - Restore per-session elicitations map; drop factory-wide map - State format becomes <sessionId>.<elicitationId>.<originalState> so HTTP affinity (#1744) can extract sessionId via prefix-match to route the callback to the worker that owns the session, then look up the per-session elicitations map by elicitationId - resolveElicitation parses both segments and looks up sessions[sessionId] then session.elicitations[elicitationId] - Default ElicitationIdSupplier returns 8 random hex chars (32 bits, plenty for session-scoped uniqueness) instead of full UUID
… app scripts Variants of the existing elicit scenarios with the FLUSH elicitCallback step removed, modelling the upstream-driven elicit flow where the auth callback is resolved by the upstream MCP server and never traverses the application stream between mcp-client and the application. These pair with the existing network elicit scripts as the upstream behavior when verifying mcp-client elicitation passthrough.
Stub out shouldCallToolElicit{Completed,Declined}Proxied + shouldCallToolElicitTimeout
on McpClientIT, marked @ignore until elicit decode is implemented in McpClientFactory.
The proxied variants pair existing network elicit scripts (upstream behaviour)
with the new .proxied application scripts (app side, no FLUSH elicitCallback);
the timeout case reuses the existing application script as-is since it already
omits the elicitCallback step.
…s on client kind
Adds the decode-side scaffolding so an mcp-client binding observing
elicitation/create and elicitation/complete on an upstream SSE stream
can translate them into MCP CHALLENGE elicitCreate and FLUSH
elicitComplete frames on the application stream. New JSON path
includes (/params/elicitationId, /params/url, /params/mode,
/params/status) feed dedicated decode states; finalizeSseEvent
dispatches to new onDecodeElicit{Create,Complete} hooks on McpStream;
McpRequestStream overrides emit the corresponding extension frames.
This is decoder-only — no upstream POST currently triggers these
paths in the existing tests. The McpClientIT proxied stubs remain
@ignore'd; they will be exercised by guard-driven flows in a
follow-up commit.
… option Adds an optional `preauthorize` URL field to the TestGuard config. When set, the guard returns NEEDS_PREAUTHORIZE from reauthorize(null) and returns the configured URL from preauthorize(...). reauthorize(<url>) treats credentials containing `code=` as a successful OAuth callback and returns a positive session id; anything else continues to fall through to NOT_AUTHORIZED. The default (no preauthorize) preserves the existing static-credentials behaviour. Required by binding-mcp's client-kind elicitation flow, where the binding intercepts a tools/call BEGIN, detects NEEDS_PREAUTHORIZE, emits a CHALLENGE elicitCreate frame to the app, and resumes once the app supplies the OAuth callback URL.
…esolution Adds McpAuthorizationConfig (single field: name) plus its builder and JSON adapter wiring on top of the existing McpOptionsConfig. The schema patch surfaces the authorization block on every kind so the binding-mcp client can name a guard for outbound credentials. McpBindingConfig grows a second constructor that accepts a guard supplier and resolves the named guard once at attach time, making the GuardHandler available on the binding for runtime use. McpClientFactory captures supplyGuard from the EngineContext and threads it through attach. No tools/call wiring yet - this is purely config/resolution scaffolding so the next commit can branch on guard.reauthorize without further config plumbing.
…-net guards
Opens the door for a per-request-stream guard-driven flow on the
mcp-client kind by promoting the McpStream onAppBegin / onAppData /
onAppEnd / onAppFlush hooks from private to package-private and
factoring out three subclass override points:
proceedWithRequest(traceId, authorization, beginEx) — defaults to
true; a subclass that needs to defer the upstream POST (for
example, a tools/call stream awaiting an OAuth pre-authorization
callback) returns false to skip http.doEncodeRequestBegin /
onAppBeginImpl in onAppBegin while still letting the parent emit
the WINDOW.
bufferAppData(traceId, authorization, payload) — defaults to false;
subclasses that need to hold app DATA until later (after a guard
pre-authorization completes) return true to suppress
http.doEncodeRequestData and absorb the bytes locally.
deferAppEnd(traceId, authorization) — defaults to false; subclasses
return true to suppress http.doEncodeRequestEnd from the parent
onAppEnd, replaying the END themselves once the deferred upstream
request finally opens.
McpRequestStream.onNetBegin now skips its automatic doAppBegin when
the reply state is already opening, so a subclass that has emitted
its own reply BEGIN early (during pre-authorization) won't get a
duplicate when the upstream HTTP stream finally connects.
HttpStream.doNetEnd / doNetReset / doNetAbort and flushNetWindow now
short-circuit on net == null, so a stream whose upstream POST never
opened (e.g. an aborted pre-authorization) can be torn down without a
NullPointerException on outbound throttle frames.
McpStream gains a `credentials` field (assigned by a subclass after
guard authorization completes) which HttpToolsCallStream reads to
emit an `authorization: Bearer <credentials>` header on the upstream
POST when present.
These are scaffolding-only changes; no production stream subclass
overrides the new hooks yet, so existing behaviour is unchanged. All
42 previously-passing McpClientIT tests still pass; McpServerIT and
McpProxyIT also unchanged.
When the binding's configured guard returns NEEDS_PREAUTHORIZE on a tools/call BEGIN, defer the upstream POST and surface the authorization URL to the app via a CHALLENGE elicitCreate. Once the app sends back the elicitCallback FLUSH, re-authorize against the guard with the callback URL. On COMPLETED, open the upstream POST with the bearer credentials returned by the guard and replay the buffered request body. On DECLINED or CANCELLED (inactivity timeout), emit elicitComplete with the corresponding status and abort the app reply. Override doAppChallenge on the McpClientFactory McpStream to write on initialId. The K3po extension registers the channel throttle handler at initialId for client-side connect channels (ZillaTarget.connectClient), so a CHALLENGE on replyId is silently dropped before reaching fireOutputAdvised. McpServerFactory continues to write challenges on replyId since its app-side scripts use accept channels. Add 3 ITs: shouldCallToolElicitCompletedGuarded, shouldCallToolElicitDeclinedGuarded, shouldCallToolElicitTimeoutGuarded. Each binds a test guard whose preauthorize URL is a known string the app script matches byte-exact. https://claude.ai/code/session_01Sm5BSDDaRNueem3xUeM2Li
…flight
Per the unified contract for elicit-aware MCP request streams, the app
must not send initial END until the elicit dance has completed
(COMPLETED / DECLINED / CANCELLED). An END arriving while pendingAuth
is true is a protocol error — mcp-client now resets the initial
direction and aborts the reply instead of buffering and replaying.
State machine simplification: drop endBuffered + aborted in
McpToolsCallStream and replace with a single requestSent flag set on
any terminal elicit transition. deferAppEnd returns requestSent for
the post-elicit END (suppresses redundant http.doEncodeRequestEnd) and
on the protocol-error path resets/aborts and returns true.
In the COMPLETED path, doEncodeRequestEnd is now always emitted right
after the buffered body — the elicitCallback FLUSH timing under the
unified contract is the cue that the buffered body is complete, so the
upstream POST can be closed immediately. (Previously gated on
endBuffered, which was only true under the now-obsolete write-close-
in-middle script ordering.)
Add dedicated tools.call.elicit.{completed,declined,timeout}.guarded
scripts shaped for the new contract (write close at end of script,
after read closed of the reply). The McpClientIT 2b ITs and the
ApplicationIT peer-to-peer ITs use these new scenarios. Phase 1's
non-guarded scripts are unchanged in this commit and will be reshaped
together with the mcp-server JSON-parse-driven END deferral in a
follow-up commit.
Tests: McpClientIT 48/48, McpServerIT 53/53, McpProxyIT 37/37,
ApplicationIT 14/14, NetworkIT 17/17 — no regressions.
https://claude.ai/code/session_01Sm5BSDDaRNueem3xUeM2Li
Add doClientFlush on McpProxyFactory.McpClient and wire McpServer's
onServerFlush to call it. Previously onServerFlush was a no-op
("pass-through flush — no action required"), which would silently drop
any initial-direction FLUSH (e.g. an elicitCallback FLUSH from app
to upstream) when an mcp-server → mcp-proxy → mcp-client pipeline
needs to forward it. Symmetric with the existing
McpClient.onClientFlush → server.doServerFlush relay on the reply
direction.
No script or test additions in this commit — the relay is dormant
until an upstream binding emits an initial-direction FLUSH on the
proxy's app stream. McpProxyIT 37/37, McpServerIT 53/53, McpClientIT
48/48 (3 skipped @ignore'd stubs) — no regressions.
Prep for the stage-4 pipeline IT that exercises an elicit dance
through the mcp-server → mcp-proxy → mcp-client chain.
https://claude.ai/code/session_01Sm5BSDDaRNueem3xUeM2Li
…tion
Add a streaming brace-depth tracker to McpToolsCallStream that observes
app DATA bytes as they flow to net and proactively calls
http.doEncodeRequestEnd once the params JSON object closes (top-level
'}' at depth 1). This is the cycle-breaker for the 2a (upstream-driven
elicitation) flow: under the unified contract the app cannot send
initial END until the elicit dance completes, but the upstream HTTP
server cannot respond until the request is fully ended — so the
binding has to drive net END from JSON payload completion, not from
the app's END.
The tracker handles JSON strings (skip braces inside "..."), escaped
characters ('\\X'), and is multibyte-UTF-8-safe (continuation bytes
'>= 0x80' don't collide with the structural ASCII characters).
Also benign for the 2b path (gated on '!pendingAuth' so it doesn't
fire while DATA is being buffered for guard auth) and for the
no-elicit path (doEncodeRequestEnd would have been called by the
parent's onAppEnd anyway; with requestSent set the parent skips it,
so the END just comes a frame earlier).
Tests: McpClientIT 48/48 (3 skipped @ignore'd stubs), McpServerIT
53/53, McpProxyIT 37/37 — no regressions. The 2a stubs still need
their scripts reshaped (stage 4) before they can be unignored.
https://claude.ai/code/session_01Sm5BSDDaRNueem3xUeM2Li
Realize the 2a (proxied) elicitation flow on the mcp-client kind: when
a guard is not configured, the upstream MCP server itself emits the
elicit dance over its SSE response (elicitation/create →
elicitation/complete) and mcp-client decodes those events and relays
them to the app channel as CHALLENGE elicitCreate / FLUSH
elicitComplete. The brace-depth tracker added in stage 3 already drives
proactive net END so the upstream HTTP request completes regardless of
when the app sends its initial END.
Move doAppBegin to the top of McpToolsCallStream.proceedWithRequest so
the app's reply BEGIN is emitted regardless of guard outcome. Lets K3po
'connected' fire predictably for both 2a (no guard) and 2b (guard +
NEEDS_PREAUTHORIZE) paths — onNetBegin still skips its own doAppBegin
via the existing replyOpening guard.
Reshape tools.call.elicit.{completed,declined}.proxied app scripts to
the realistic 2a wire ordering (CHALLENGE arrives after the request
body has flowed and upstream has responded), update the URL in
matchers to match what upstream emits, and add a new
tools.call.elicit.timeout.proxied scenario for the upstream-driven
timeout case.
Add proxied network scripts (tools.call.elicit.{completed,declined}.proxied
under streams/network/) — same as existing elicit network scripts but
without the Phase 1 server-kind auth-callback connection (mcp-client
does not make a callback HTTP request; the upstream MCP server owns
the OAuth callback path in 2a).
Unignore shouldCallToolElicit{Completed,Declined}Proxied and rename
shouldCallToolElicitTimeout to shouldCallToolElicitTimeoutProxied (now
paired with the new app scenario). Add ApplicationIT
shouldCallToolElicitTimeoutProxied and NetworkIT
shouldCallToolElicit{Completed,Declined}Proxied peer-to-peer tests.
Tests: McpClientIT 48/48 (was 45/48 with 3 ignored), McpServerIT 53/53,
McpProxyIT 37/37. Spec ApplicationIT and NetworkIT cover all new
scenarios peer-to-peer.
https://claude.ai/code/session_01Sm5BSDDaRNueem3xUeM2Li
Phase 1's unconditional task-queue defer of the accepted-side WINDOW (commits cc83e5e / 484fb4e) was needed for scripts that place a `read advise` ahead of `connected` — to ensure the AdviseInputTask queues its frame before the WINDOW write reaches the binding. But the same defer regresses other accept-side scripts that don't use the wire-order trick (e.g. binding-http's AdvisoryIT) because it changes the relative ordering of WINDOW and the script's post-`connected` listener registrations. Make the defer conditional via a per-channel `windowNeedsTask` flag set by `ZillaEngine.adviseInput` (the entry point for `read advise` statements). When the flag is set, take the existing deferred path: queue WINDOW as a task before invoking `fireChannelConnected`. When the flag is clear, take the pre-Phase-1 path: invoke `fireChannelConnected` synchronously and emit WINDOW direct, so the script's post-`connected` listeners are registered before WINDOW hits the wire. The flag is one-shot relevant to the windowFuture listener; if a `read advise` runs after `connected`, the flag-set is harmless because the listener has already chosen the direct path on its single invocation. Tests: engine DuplexIT 72/72, HalfDuplexIT 64/64, SimplexIT 35/35 (wire-order trick still works); binding-mcp 138/138 (no regression); binding-http server.AdvisoryIT.shouldSendRequestAndFlush restored. binding-http client.AdvisoryIT.shouldSendRequestAndFlush remains failing — a separate Phase 1 regression in the client-kind flush relay path that does not use the wire-order trick and needs further investigation. https://claude.ai/code/session_01Sm5BSDDaRNueem3xUeM2Li
Replace the conditional task-queue-defer approach (commit bcf7b03 + Phase 1 cc83e5e/484fb4eb) with a simpler in-line task drain. The accepted-side WINDOW is once again emitted eagerly inside ZillaStreamFactory.Stream.onBegin (pre-Phase-1 behaviour). For accept-side child channels, ZillaEngine.drainTasks() is called between beginInputFuture.setSuccess() and the eager doWindow so any tasks queued during fireChannelBound's ACCEPTED-event chain (e.g., an AdviseInputTask from a `read advise` placed before `connected`) run synchronously and write their frames to streamsBuffer ahead of the WINDOW. Wire order for trick scripts: ACCEPTED → script statements (queue AdviseInputTask) → drainTasks (CHALLENGE written) → eager WINDOW written. Same ordering as Phase 1's intended CHALLENGE→WINDOW; no flag, no submitTask gymnastics. Wire order for non-trick scripts (e.g., binding-http AdvisoryIT): same as pre-Phase-1 — no tasks queued before drain runs (drain is a no-op), eager WINDOW written immediately. Removes: - ZillaChannel.windowNeedsTask field + setWindowNeedsTask/windowNeedsTask methods - ZillaEngine.adviseInput's flag-set call - ZillaPartition windowFuture listener's doWindow + submitTask logic (reverts listener to pre-Phase-1: just fireChannelConnected) Adds: - ZillaEngine.drainTasks() — package-private, delegates to executeTasks Tests: engine driver ITs (DuplexIT 72/72, HalfDuplexIT 64/64, SimplexIT 35/35, EngineIT 14/14); binding-http 374/374 (both client.AdvisoryIT.shouldSendRequestAndFlush and server.AdvisoryIT.shouldSendRequestAndFlush restored); binding-mcp 138/138; binding-mcp.spec ApplicationIT/NetworkIT all green. https://claude.ai/code/session_01Sm5BSDDaRNueem3xUeM2Li
… order Engine commits bcf7b03 and 42e2ae9 changed the relative order of the accepted-side eager WINDOW versus subsequent task-queued frames in the k3po-zilla transport. The fetch and produce dump fixtures captured the older WINDOW-then-END order; refresh them to the new END-then-WINDOW order. Determinism re-verified across 4 consecutive runs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Forward upstream→app CHALLENGE on the tools.call stream so the proxy passes through elicit_create challenges (and any future target-driven challenge kinds) verbatim. FLUSH forwarding for elicit_callback (app→ upstream) and elicit_complete (upstream→app) already works via the existing extension-passthrough wiring. Adds the three McpProxyIT scenarios that exercise the .proxied application scripts pair end-to-end: completed, declined, timeout.
jfallows
pushed a commit
that referenced
this pull request
Jun 3, 2026
…#1752 Audited the binding-mcp source against the Phase 5-9 sketch. The guard NEEDS_PREAUTHORIZE -> preauthorize -> elicit -> callback -> reauthorize flow and its IT coverage already exist in develop (#1739/#1752), so Phases 5 and 9 are core-done, not "not started". Phase 6 is the first genuinely-unbuilt phase. Recorded per-phase EXISTS/MISSING evidence and the two residual Phase-5 gaps (binding-level not per-route guard/credentials; reauthorize(null) not inbound bearer). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ
jfallows
added a commit
that referenced
this pull request
Jun 4, 2026
…1834) * feat(binding-mcp): capture and re-render RFC 9728 resource_metadata on bearer challenge Phase 1 of #1810. The upstream MCP bearer challenge (HTTP 401/403 + WWW-Authenticate: Bearer) may carry an RFC 9728 resource_metadata parameter pointing at the protected-resource metadata document. Capture it on the McpClientFactory parse path, carry it on McpBearerResetEx, and re-render it into the WWW-Authenticate header back to the connecting client on both McpServerFactory reject paths. Adds a dedicated lifecycle.initialize.reject.bearer.resource.metadata scenario (network + application) with peer-to-peer NetworkIT/ApplicationIT coverage and end-to-end McpClientIT (capture) and McpServerIT (re-render) coverage. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): cover resource_metadata on the SSE events-resume bearer reject path Phase 1 of #1810 (follow-up). The resource_metadata capture/carry/re-render added previously flows through both McpServerFactory reject paths, but only the POST reject path had resource_metadata coverage. Add a lifecycle.events.resume.reject.bearer.resource.metadata scenario (network + application) exercising the GET/SSE reconnect reject path (McpEventStream), with peer-to-peer NetworkIT/ApplicationIT coverage and end-to-end McpServerIT coverage of the second re-render path. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs: add HANDOFF.md for #1810 (Phase 1 done; Phase 2+ plan and file/line map) Cross-session handoff note: status table, Phase 1 summary, build/test gotchas, verified architecture map of the proxy loopback, and a concrete Phase 2 plan with the exact file/line targets to refactor. To be deleted before the PR. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(binding-mcp): record Phase 2 async constraint + verified relocation plan (#1810) Investigated Phase 2 (split hydrater from live entry; remove originId==routedId loopback). Prototyped and reverted a "direct-call decoupling" shortcut after proving it is infeasible: the hydrater<->proxy-entry path relies on the engine bus delivering frames asynchronously, but a direct in-process call is synchronous/re-entrant and NPEs (reply BEGIN delivered before the hydrater's receiver field is assigned), with broader flow-control re-entrancy hazards. Updated HANDOFF.md with the verified finding, the confirmed current architecture (loopback is internal plumbing; route-exit streams are already direct), the required full-relocation approach, and the working/fast build+IT loop plus the FileSystemAlreadyExists stale-target gotcha. No production code change; baseline remains green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(binding-mcp): make HANDOFF fresh-start ready for Phase 2 (#1810) Add a "start here" pointer to the Phase 2 plan, fix stale line counts in the architecture map (1489/2032/915), and collapse the duplicate loopback description into a pointer to the authoritative, re-verified Phase 2 section. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(binding-mcp): confirm Phase 2 per-route + per-slice design (#1810) Record maintainer decisions (per-route hydration; per-(kind,prefix) slice keys), the atomic-change coupling, the single-route aggregateRoutes finding, the re-entrancy-safe pure-sink relocation design, and verified file/line targets. Fresh-container build loop confirmed (baseline 27 cache ITs green). * docs(binding-mcp): reuse decoder states + streams in place, no new abstractions (#1810) Per maintainer constraint: the relocated hydrater reuses the existing decode* states and McpListServer/McpListClient/McpLifecycleClient stream classes driven per route into a pure-sink accumulator. Remove the vetoed sink-interface / decoder-extraction recommendation. * docs(binding-mcp): fold execution decisions + kickoff into handoff (#1810) Maintainer decisions: land Phase 2 as one atomic green commit; defer the 2d live-path baseline test to Phase 7/8. Add a self-contained next-session kickoff (constraints + build bootstrap). * docs(handoff): revise Phase 2 to single-blob cache storage Record the maintainer reversal of decisions #1 (per-route hydration) and #2 (per-(kind,prefix) slice keys): keep single aggregated cache storage per kind. Storage format is orthogonal to the loopback removal, which is the only required Phase 2 change. Keeps McpListCache, the serve path, seeded YAMLs, and all .rpt scripts unchanged; demotes the per-slice plan to history. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): finalize Phase 2 model — unified blob + per-route fragments, keep-stale Per maintainer decision: keep single unified blob storage per kind, but the relocated hydrater holds an in-memory per-route fragment map and assembles the blob, enabling per-(route,kind) refresh and keep-stale-on-failure (a failing route retains last-known-good; successful-empty replaces with empty). Store layout, serve path, seeded YAMLs, and .rpt scripts stay unchanged. Sequenced as commit 1 (behavior-preserving relocation) + commit 2 (keep-stale test). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * refactor(binding-mcp): relocate cache hydrater, remove originId==routedId loopback Split the background cache hydrater from the live proxy entry point. The hydrater moves into the stream package and drives McpLifecycleServer / McpListServer / McpListClient in place (no new abstractions) via package-private newHydration* methods, with a pure-sink MessageConsumer reply target and a pre-granted/self-advancing reply window; the only async bus streams are the route-exit client streams (unchanged wire ids originId=bindingId, routedId=route.id), preserving the async decoupling the loopback provided. The hydrater drives the merge per route into per-route fragments and assembles the unified blob per kind (byte-identical to the prior all-routes merge), then puts the single per-kind blob — store layout, serve path, seeded YAMLs, and all .rpt scripts are unchanged. Replace the originId==routedId loopback proxy with an explicit hydration flag on McpLifecycleServer and remove the loopback discriminators (hydrating(), the originId term in aggregating(), the onServerBegin loopback branch, and the McpProxyListFactory.newStream originId term); flush deferral and the abort/reset guards now key on the hydration flag. Behavior-preserving: McpProxyCacheIT (27), McpProxyLifecycleIT (7), unit (20) green; checkstyle, license, jacoco pass. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): Commit 1 done; add Commit 2 keep-stale spec https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): keep stale per-route cache fragments on hydrate failure The per-route list fragments now live on McpProxyCache's per-kind McpListCache (persisting for the binding lifetime, across hydrater stop/start and lock handovers) rather than on a per-cycle hydrater map. On hydrate/refresh: successful routes update their fragment (empty result replaces with empty); a route that fails — abort, reset, timeout, or bearer challenge — keeps its last-known-good fragment instead of being dropped. The unified blob per kind is reassembled from the persisted fragments in configured-prefix order. A bearer-challenge/no-session route during hydration is now surfaced as a route failure (McpListServer aborts its sink) rather than an empty list, so its tools are kept stale rather than cleared; initial-populate skip still contributes nothing, so cache.hydrate.toolkit.multi.skip.unauthorized is unaffected. Adds the cache.refresh.toolkit.keep.stale.on.failure scenario and McpProxyCacheIT#shouldRefreshToolkitKeepingStaleOnFailure proving a failed toolkit route retains its prior tools while another refreshes. McpProxyCacheIT (28), McpProxyLifecycleIT (7), unit (20) green; checkstyle, license, jacoco pass. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): Phase 2 Commit 2 (keep-stale) done; note pre-existing spec jacoco gap https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): cover McpFunctions resource_metadata/lifecycle builders+matchers Raise specs/binding-mcp.spec instruction coverage from 0.95 to 0.98 (above the 0.96 gate) by extending McpFunctionsTest. Phase 1's McpFunctions additions for RFC 9728 resource_metadata, the lifecycle begin builder/matcher capabilities, and the empty-buffer null branches of the BeginEx/FlushEx/ChallengeEx/ResetEx/ AbortEx matchers were never exercised. Adds build, positive-match, mismatch, and empty-buffer tests (50->69 methods). Test-only; no production code, pom threshold, or excludes changed. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): spec jacoco gate closed (0.98) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): per-route with.cache.credentials over options.cache.authorization Add a per-route static `with.cache.credentials` to the mcp proxy `with` config. During cache hydration each route's list stream is reauthorized through the cache guard using the route's credential when present, falling back to `options.cache.authorization` otherwise, so `with` takes precedence. Usage is list-only; the shared hydration lifecycle continues to use the binding cache authorization. - McpWithConfig gains a `cache` (McpWithCacheConfig{credentials}) + builder - McpWithConfigAdapter and the route `with` schema block adapt cache.credentials - McpRoutePrefix carries the per-route credential (null-default 2-arg ctor kept for the live list path); populated in McpBindingConfig.resolveAll(kind,auth) - McpProxyCacheHydrater.startRoutes reauthorizes per-route credential precedence - McpWithConfigAdapterTest + cache.hydrate.credentials.toolkit scenario (McpProxyCacheIT + peer-to-peer ProxyCacheIT) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * refactor(binding-mcp): apply per-route cache credential to lifecycle and list streams Resolve a route's with.cache.credentials once in McpLifecycleClient (hydration only) into a per-route authorization, falling back to the binding cache authorization (options.cache.authorization) when absent. The route's lifecycle and list hydration streams now share that single authorization — McpListClient's upstream frames use lifecycle.authorization rather than the list server's. This replaces the earlier list-only wiring that left the lifecycle stream on the binding credential. The live path is unchanged (lifecycle client authorization defaults to server.authorization). The hydrate scenario simplifies to a single route-exit accept since the lifecycle and list streams now carry the same authorization. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): correct roadmap — Phases 5 & 9 already landed via #1739/#1752 Audited the binding-mcp source against the Phase 5-9 sketch. The guard NEEDS_PREAUTHORIZE -> preauthorize -> elicit -> callback -> reauthorize flow and its IT coverage already exist in develop (#1739/#1752), so Phases 5 and 9 are core-done, not "not started". Phase 6 is the first genuinely-unbuilt phase. Recorded per-phase EXISTS/MISSING evidence and the two residual Phase-5 gaps (binding-level not per-route guard/credentials; reauthorize(null) not inbound bearer). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): lock Phase-5 Gap A+B design (authorization-long reuse + proxy schema) Records the maintainer-confirmed design: carry only the inbound authorization long (no bearer string, no IDL change); on the client-kind path reuse an already-authorized inbound authorization via guard.credentials(authorization) and skip elicit, else fall through to the existing reauthorize/elicit flow; push elicit machinery into the shared McpRequestStream so prompts/get and resources/read elicit too (Gap B); disallow options.authorization for kind: proxy via schema while keeping the field for server/client kinds. Includes verified facts, edit points, and the test plan. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): forward inbound client identity to upstream tools/call bearer On the client-kind path, reuse an already-authorized inbound authorization to derive the upstream Authorization bearer via guard.credentials(authorization), instead of ignoring it and falling back to a static credential. The inbound identity is consumed at the binding: upstream net streams are opened unguarded (authorization 0) so the external MCP server sees only the bearer, matching the existing guarded-elicit behavior and avoiding propagation of the internal authorization long onto the external connection. Test-first: tools.call app scripts parameterized with an authorization property (default 0, overridden to 1 via @ScriptProperty for the identity case, reusing the existing scripts); new tools.call.identity network scenario asserts the upstream Authorization: Bearer header; client.identity.yaml fixtures the test guard. NetworkIT + McpClientIT cover it; full spec and runtime builds green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record Gap A (tools/call identity) done + remaining Gap B/schema Notes the shipped tools/call identity forwarding and the maintainer decision to consume inbound identity at the binding (upstream authorization 0), the discovered lifecycle stall it avoids, and the precise remaining work: extend inbound-reuse + elicit to prompts/get & resources/read via McpRequestStream, and the proxy authorization schema constraint (incl. the proxy.options.yaml fixture cleanup it requires). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): disallow options.authorization for kind: proxy A proxy-kind binding routes and aggregates; it never reads its own request guard (only the cache guard via options.cache.authorization), so a top-level options.authorization on a proxy is meaningless. Disallow it in the schema's proxy branch, mirroring how the server/client branch disallows cache. Removes the unused options.authorization from the proxy.options.yaml fixture (cache.authorization is unaffected), adds proxy.authorization.invalid.yaml and SchemaTest.shouldRejectProxyWithAuthorization. server/client keep options.authorization. Full spec and runtime builds green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): forward inbound client identity for prompts/get and resources/read Add the inbound-authorization reuse to the shared McpRequestStream so every request kind (prompts/get, resources/read, tools/list) derives the upstream bearer from an already-authorized inbound authorization via guard.credentials(authorization), consistent with tools/call. The lifecycle (McpStream) is intentionally left unchanged so its upstream stays unguarded. Test-first: prompts.get and resources.read app scripts parameterized with the authorization property (default 0, overridden to 1 via @ScriptProperty); new prompts.get.identity and resources.read.identity network scenarios assert the upstream Authorization: Bearer header; NetworkIT + McpClientIT cover both. Full spec and runtime builds green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * refactor(binding-mcp): share elicit flow across request streams (prompts/get, resources/read) Move the preauthorize/elicitation machinery (pendingAuth buffering, elicit challenge, callback reauthorize, timeout signal, completion/decline/cancel handling) from McpToolsCallStream up into the shared McpRequestStream base, so prompts/get and resources/read support the same inbound elicitation flow as tools/call. tools/call, prompts/get and resources/read now inherit a single implementation; the lifecycle (McpStream) is unaffected. The moved code stays covered by the existing tools.call.elicit.{completed, declined,timeout} tests (tools/call now inherits it); new prompts.get.elicit.completed.guarded and resources.read.elicit.completed.guarded scenarios prove the capability end-to-end for the two new request kinds. Full spec and runtime builds green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): mark Phase-5 Gap A+B work unit complete Schema proxy-authorization constraint, Gap A inbound identity for prompts/get and resources/read, and Gap B shared elicit flow all shipped and green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): add server timeout option and per-request McpXxxBeginEx timeout carriage Phase 6 (sub-step 6a, plumbing). Adds an `int64 timeout = 0` field to the six operation BeginEx variants (toolsList/toolsCall/promptsList/promptsGet/ resourcesList/resourcesRead) so the effective elicitation hold budget can be carried per request, and a `timeout` Duration option on the mcp binding (McpOptionsConfig + builder + adapter + schema, default unset → 0). McpFunctions gains timeout builders/matchers for all six variants. No behavior change yet: nothing stamps or consumes the field (the server effective-timeout stamping and the -32042 hold-vs-reject behavior follow in the next sub-steps). Covered by McpFunctionsTest (timeout per variant) and a new McpOptionsConfigAdapterTest (timeout round-trip). Full spec and runtime builds green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record Phase 6 progress (6a plumbing done; stamping + 6b remaining) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): stamp effective elicitation timeout on request BeginEx at the server Completes Phase 6 sub-step 6a. McpServerFactory resolves the effective timeout = options.timeout, gated to 0 when the client did not negotiate CLIENT_ELICITATION_URL (persisted per session at initialize), and stamps it on each request BeginEx it emits (toolsList/toolsCall/promptsList/promptsGet/ resourcesList/resourcesRead). The McpServer carries the configured timeout; the session holds the resolved per-request value. Still behavior-neutral downstream (nothing consumes the stamped value yet — the -32042 hold-vs-reject behavior is 6b). New tools.call.timeout scenario (initialize negotiates elicitation.url; app toolsCall BeginEx asserts timeout=30000) wired into McpServerIT (server.timeout.yaml) and peer NetworkIT/ApplicationIT. Full spec and runtime builds green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): mark Phase 6 sub-step 6a (server timeout stamping) done https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): lock Phase 6b design (-32042 hold-vs-reject) for fresh execution Maintainer decisions: expiry/no-hold -> -32042 URLElicitationRequiredError, explicit decline stays -32000; timeout==0 emits -32042 directly (no elicitation/create). Records the audited current flow, the client per-request timer + server hold-vs-reject + -32042 data-array encoder, the required re-touch of the existing guarded elicit scenarios, and the test plan. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): emit -32042 URLElicitationRequiredError on elicitation expiry On elicitation timeout (CANCELLED), the server now responds with JSON-RPC error -32042 "URL elicitation required" carrying the authorization url in a data array, instead of the prior -32000 "Authorization timed out". The elicitation url is remembered from the elicitCreate challenge so it can be re-rendered in the error payload. * feat(binding-mcp): honor per-request elicitation timeout on the client The client now reads the per-request timeout stamped on each McpXxxBeginEx and arms the elicitation hold timer with it instead of the engine-wide inactivity timeout. When the timeout is zero the request is not held: the binding sends the elicitation challenge then rejects the request, leaving the server to emit -32042 to the connecting client out of band. Existing guarded elicit scenarios now carry a stamped timeout; adds a tools.call.elicit.reject.guarded scenario covering the zero-timeout path. * feat(binding-mcp): reject tools/call with -32042 when elicitation hold disabled When the resolved per-request timeout is zero (the client did not negotiate url elicitation, or no server timeout is configured), the server no longer emits elicitation/create and holds the request. Instead it responds immediately with JSON-RPC error -32042 "URL elicitation required" carrying the authorization url, then tears down the request stream. Server-side hold scenarios (completed/declined/timeout) now negotiate elicitation.url and run under server.timeout.yaml so they continue to hold; adds tools.call.elicit.reject covering the zero-timeout reject path and gives the proxied timeout test its own upstream script. * docs(handoff): mark Phase 6 (6b behavior) done; next is Phase 7 * docs(handoff): correct stale Phase 5 status — Gap A+B done on this branch The Status table row and the start-here note still described the Phase 5 live-identity gaps as unaddressed, contradicting the later Gap A+B section and the actual code/commits on this branch. Corrected to reflect: inbound authorization-long reuse (Gap A), shared elicit flow (Gap B), and the proxy authorization schema constraint are all implemented and tested here; the older per-route-guard / inbound-bearer framing was superseded by the maintainer, not pending. * docs(handoff): write Phase 7 plan (defer-to-upstream relay; toolkit__nonce elicitationId) Capture the two locked Phase 7 design decisions and implementation shape: (A) the proxy relays per-route elicitation decisions from the route-exit mcp client bindings rather than originating them; (B) the elicitationId carries the toolkit (<toolkit>__<nonce>, reusing the existing __ delimiter) so the OAuth callback self-routes to the right toolkit independent of the non-blocking list stream. Guard owns nonce validation + identity-binding; binding does routing + list_changed on the lifecycle SSE. * docs(handoff): confirm Phase 7 mechanism (proxy injects toolkit__ into elicit state; single-exit callback; no IDL change) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): Phase 7 symmetric per-hop state strip; reauthorize at route-exit client, not proxy https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): consolidate Phase 7 settled design + OSS example walkthrough (URL-only elicit, OSS-vs-plus, hybrid-serve dependency) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): note redirect_uri rewrite routes OAuth callback back through Zilla (manipulateElicitUrl) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): clarify token-home by model (guard stashes vs remote holds in OSS relay) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): per-remote token memory requires Zilla-as-OAuth-client (per-route guard + Store vault); upstream-auth vs elicitation mechanisms https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): OSS Path B mechanism (origin-conditional passthrough, persistent per-route lifecycle + session-id replay, client-driven replay, no Zilla timeout) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): Path B scales to N remotes requiring elicitation (per-route isolation, direct self-correlating callbacks) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): #1810 phasing implications of OSS Path B (Track A relay vs Track B guard; 5/6/7-strip/8 are Track B) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): broaden #1810 + done-vs-needed audit; dual-ready binding (both tracks in OSS PR, only OAuth guard is zilla-plus) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): keep P6 hold-and-resume by design (additive UX); record #1810 broadened-scope comment posted https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): origin-conditional passthrough for remote MCP elicitation Gate manipulateElicitUrl state/redirect_uri rewrites on the redirect_uri placeholder (replace.me): present means Zilla is the OAuth client (rewrite); absent means the remote is the OAuth client, so pass the elicitation URL through verbatim and stay out of the callback path. No IDL change; existing placeholder-based elicit scenarios are unaffected. Adds tools.call.elicit.passthrough scenario (network + application) with McpServerIT/NetworkIT/ApplicationIT coverage. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): lock in upstream session-id/protocol-version affinity The route-exit client already captures the upstream Mcp-Session-Id and MCP-Protocol-Version on the persistent lifecycle and replays them on every subsequent request, kept warm by keepalive. Existing tests masked this by reusing session-1 on both app and transport sides. Add lifecycle.initialize.session.affinity with distinct ids (app-facing session-1 vs transport transport-1) to prove the client replays the transport id toward the upstream while keeping the app-facing id separate. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): client resume ITs verify transport vs app session id The lifecycle.events.resume and tools.call.with.progress.resume network scripts (transport face, used only by McpClientIT and the network peer IT) now use transport-1, distinct from the client binding's app-facing session-1, so resume verifies the client replays the upstream transport id on the resume GET rather than leaking the app-facing id. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): distinct transport vs app session ids across server + client ITs Adopt a face-based session-id convention so the specs verify the per-layer remap instead of reusing one value everywhere: - network/HTTP face (mcp-session-id header, and the OAuth callback-correlation state prefix) = transport-N, the binding's generated/captured transport id - application/mcp face (.sessionId) = session-N, the app/unified id Server generates the HTTP-facing transport id (sessions map key, used by manipulateElicitUrl for callback correlation); the app side carries the downstream unifiedId. Client generates its app id and captures the upstream transport id. McpServerIT generated id is now transport-1; McpClientIT stays session-1. The OAuth state prefix becomes transport-1 (the sessions-map key); .sessionId app fields and the placeholder challenge state are unchanged. Server 68 / Client 62 / Network 75 / Application 104 all green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): remove redundant lifecycle.initialize.session.affinity After the face-based convention sweep, lifecycle.initialize already carries net=transport-1/app=session-1, making the dedicated affinity scenario an exact duplicate. Remove it and its McpClientIT/NetworkIT/ApplicationIT methods. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): verify per-toolkit session affinity in proxy multi-toolkit list tools.list.toolkit.multi now gives each toolkit exit a distinct session id (app1=session-2, app2=session-3) while the proxy's minted north id stays session-1, proving the proxy replays each captured per-route exit id on the fan-out rather than reusing one value. McpProxyIT green (44). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): per-toolkit session ids across remaining proxy multi specs Extend the per-toolkit convention (north session-1 minted by the proxy; toolkit exits app1=session-2, app2=session-3, captured and replayed per route) to the remaining multi-toolkit/aggregate proxy scenarios: prompts.list, resources.list, lifecycle.notify.tools.list.changed, lifecycle.events.resume aggregate + partial, and reject.bearer.toolkit.multi. The .prefixed (north/ aggregated) variants stay session-1. Also fixes tools.list.toolkit.multi/client.rpt, which the prior commit left at session-1 while the server moved to session-2/3 — that broke the ApplicationIT peer run (shouldListToolsWithToolkitMulti); now self-consistent. ApplicationIT 103 / NetworkIT 74 / McpProxyIT 44 all green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): name proxy per-toolkit exit sessions session-1a/1b Rename the app-south per-toolkit exit ids from session-2/session-3 to session-1a/session-1b so the naming conveys they are the per-route children of the proxy's aggregate north id (session-1), rather than reading as unrelated independent sessions. Value-preserving label change across all 13 toolkit.multi /aggregate/resume/hydrate scripts; .prefixed north view stays session-1. ApplicationIT 103 / NetworkIT 74 / McpProxyIT 44 all green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record session-id convention + N2 completion Mark N2 (persistent per-route lifecycle / Mcp-Session-Id+protocol-version replay / resume) DONE: face-based session-id convention swept corpus-wide (net=transport-N, app=session-N; proxy per-toolkit exits session-1a/1b under aggregate session-1), N2c resume covered, N2d deferred. Update the start-here pointer to flag N3 (examples/mcp.proxy) as the next Track-A deliverable. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): split N3 example out of #1810; Phase 7 is the remaining binding work Record maintainer decision that the OSS mcp.proxy e2e example (N3) ships as a separate effort and does not gate the binding PR. The only remaining #1810 binding work is Phase 7 (P7a OSS relay list + native list_changed; P7b Track B state inject/strip + callback routing + list_changed origination). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record #1810 tracking decision — status deltas go in PR description Decided: leave the #1810 body and the 2026-06-04 broadening comment as-is; fold the status deltas (N1+N2 done, N3 split out, Phase 7 remaining) into the PR description when the PR opens, rather than editing the issue or adding a comment. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record grounded Phase 7a findings + corrected implementation shape Verified against code: the live list already non-blocks; an unauthorized route surfaces at the per-route lifecycle (sessionId==null skip), and the real blocker is McpLifecycleServer.onClientBearerReset doing an all-or-nothing reset of the whole unified lifecycle. Core 7a work is restructuring the lifecycle aggregation to allow partial auth + relay per-toolkit elicitation up the north SSE. Includes the test-first plan and the one open kickoff decision. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): lock Phase 7a design — open partial, elicit sourced at client binding Maintainer decision: unified lifecycle always opens (empty baseline if all routes fail, never whole-session bearer-reset); the elicitation is sourced at the route-exit mcp client binding and only RELAYED up by the proxy (proxy never mints elicitations, per Decision A). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): pin Phase 7a contract — non-blocking partial-auth proxy list Author the spec scenarios that define Phase 7a (Track A / OSS relay, #1810) before the runtime change: - lifecycle.initialize.partial.toolkit.multi: app1 settles (session-1a, NOT aborted), app2 relays an elicitCreate challenge, unified session OPENS (session-1) with the relayed elicitation — replaces today's all-or-nothing bearer-reset. - tools.list.partial.toolkit.multi{,.prefixed}: live tools/list returns only the authorized route's tools; unauthorized route skipped (peer-tested). - lifecycle.notify.tools.list.changed.after.authorize.toolkit.multi{,.prefixed}: route authorizes out-of-band, native list_changed relayed up the lifecycle SSE, re-list returns the full set. Peer ApplicationIT methods added (shouldListToolsWithPartialToolkitMulti{,Prefixed}); full spec module green (ApplicationIT 105, module 199). No runtime Java yet — the proxy-IT methods are RED until the lifecycle aggregation restructure lands and are listed in HANDOFF as the implementation targets. No McpFunctions changes. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): open proxy lifecycle on partial auth, relay elicit + list_changed Phase 7a (Track A / OSS relay, #1810). The unified proxy lifecycle no longer fails when one route needs authorization: a route-exit that is unauthorized advises an elicitCreate challenge (no sessionId) instead of bearer-resetting, and the proxy now - counts that route as settled (one-shot settled flag via settleLifecycle) so the unified north lifecycle opens on whatever authorized subset exists, and - relays the elicitation up the north lifecycle SSE (McpLifecycleServer.doServerChallenge, mirroring McpProxyItemFactory). McpLifecycleClient.register now keys off settled rather than replyOpened && sessionId != null, so a challenged-but-unauthorized route settles immediately as a skip in the list fan-out instead of blocking the aggregation on a reply that never comes. The already-non-blocking list serves the authorized subset; when the route later authorizes, its native tools/list_changed rides up the existing aggregate-event-id relay and a re-list returns the full set. The genuine bearer-reset path (onClientBearerReset) is unchanged. Spec corrections (consistent with the N2 persistence invariant + relay design; peer ApplicationIT stays green): - tools.list.partial.toolkit.multi.prefixed: assert/emit the relayed elicit - tools.list.partial.toolkit.multi: drop the premature unauthorized-route close (the route lifecycle stays open for the whole session) - lifecycle.notify.tools.list.changed.after.authorize.toolkit.multi: add barriers so the route authorizes only after the first list completes; fix the aggregate id to 2=200 McpProxyIT 44->47. Full no-skip green: runtime binding-mcp 212 IT + 26 UT + jacoco/checkstyle/license; spec binding-mcp.spec 199 IT (ApplicationIT 105) + UT. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record Phase 7a shipped — partial-auth list + relay elicit/list_changed https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): skip bearer-rejected proxy routes and open the lifecycle eagerly A bare upstream bearer challenge is not actionable for a client connecting to the 1-to-many proxy aggregate: auth lives on the route-exit (the many) side and the connecting client must not present per-remote credentials to the aggregate. So the proxy no longer relays a route's bearer reset to the client or fails the whole session on it. McpLifecycleClient.onClientReset now treats a bearer reset as "route unauthorized" — it settles that route and skips it, opening the unified lifecycle on whatever authorized subset exists (onClientBearerReset's all-or-nothing reset is removed). A route-exit guard still converts a 401 into an elicitCreate challenge before it reaches the proxy (onClientChallenge), so only a bare, unconvertible reset degrades a route to skipped. Faithful bearer relay to the connecting client remains in the non-proxy mcp server -> mcp client topology only. The proxy also now opens the unified reply eagerly when the routes are established, rather than blocking on every route settling. The sessionId is minted and serverCapabilities is derived from the configured routes, so initialize is answered immediately; routes settle independently and their tools fill in via tools/list. This is what makes partial-open correct for a request/response client: it finishes its initialize request (request-side END) and awaits the response, so a slow or unauthorized route can neither delay the session nor tear it down before the reply is served. Reframes the proxy-only reject.bearer scenarios accordingly: - lifecycle.initialize.skip.bearer.toolkit.multi (was reject.bearer.toolkit.multi): authorized route settles, bearer-rejected route is skipped, unified session opens. - lifecycle.initialize.skip.bearer: single-route proxy opens an empty session when its only route bearer-rejects. McpProxyIT / McpProxyLifecycleIT repointed. Full no-skip green: runtime binding-mcp 212 IT + 26 UT + jacoco/checkstyle/license; spec binding-mcp.spec 199 IT + 76 UT. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * refactor(binding-mcp): server strips its own elicitation state prefix on the callback The mcp server injects <sessionId>.<elicitationId>. into the elicit URL state on the way up (manipulateElicitUrl); on the OAuth callback it now strips exactly that prefix before forwarding the elicitCallback down the application pipeline. Each hop reverses its own injection, so the route-exit guard sees the bare nonce it minted rather than Zilla's internal framing — a cleaner guard contract and the foundation for per-toolkit proxy elicitation, where the proxy will likewise strip the <toolkit>__ it injects. Updates the committed elicit scenarios so the route-exit elicitCallback state is the stripped 7f3a9b1c rather than transport-1.elicit-1.7f3a9b1c. Inbound OAuth callback paths (network scripts) keep the full state, as the authorization server returns it. Full no-skip green: runtime binding-mcp McpServerIT 68 + McpClientIT 61 + UT; spec binding-mcp.spec 199 IT + 76 UT. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): add context field to elicitation extension types Add an optional `string8 context = null` to McpElicitCreateChallengeEx (the challenge relayed up: proxy → server) and McpElicitCallbackFlushEx (the callback forwarded down: server → proxy). This is the in-band carrier for per-toolkit elicitation-callback routing through the mcp proxy: - on the way up the proxy pushes the route's (opaque) prefix into `context`; - the server records it in its open-elicitation tracking keyed by elicitationId (it is NOT encoded into the OAuth state, so nothing route-related leaves the binding); and - on the callback the server echoes `context` on the forwarded elicitCallback so the proxy can route to the right route-exit and strip its own segment. Optional with a null default, so the non-proxy server <-> client elicit flow is byte-identical and existing behavior is unchanged. Wire carrier only in this commit; server/proxy use lands next. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record converged 7b context-field design + session state for fresh handoff Capture the design that converged this session so a fresh context can resume cleanly: - #1810 reframed to "per-toolkit elicitation"; Phase 8 split to #1831. - 7a + bearer handling + server-side strip + context IDL field are landed/pushed (commits noted in the start-here block). - New authoritative "Phase 7b — CONVERGED DESIGN (context field)" section: in-band context routing (never in the OAuth state), elicitation completion decoupled from the originating request, 410 only on unrecognized elicitation ids, ordered remaining steps, and the gotchas (peer shape scripts don't compose through the proxy; blocking-through-proxy elicit never verified e2e; capabilities ignored binding-wide). - Marked the older <toolkit>__ state-injection mechanism SUPERSEDED. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * test(binding-mcp): add context builder and matcher to McpFunctions elicit helpers Extend the McpElicitCreateChallengeEx and McpElicitCallbackFlushEx builder and matcher helpers in McpFunctions with the optional in-band `context` field (string8, landed on the IDL in bb3f74d). The proxy pushes the route prefix into `context` on the relayed elicitCreate (UP) and the server echoes it on the forwarded elicitCallback (BACK) so per-toolkit elicitation callbacks self-route. Builder threads `context` into the flyweight; matcher ignores it when unset (partial-match convention). Adds six McpFunctionsTest cases (generate + match + mismatch for each of elicitCreate and elicitCallback); McpFunctionsTest 69 -> 75. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): echo elicitation context on the forwarded callback The mcp server now records the in-band `context` carried on an inbound elicitCreate challenge (string8, set by a downstream proxy to identify the route) and echoes it on the elicitCallback flush it forwards back down on the held request stream. This lets a proxy route the callback to the right route-exit by the echoed context and strip its own segment, without keeping any per-elicitation map. context defaults to null, so the non-proxy server <-> client elicit flow is byte-identical. New `tools.call.elicit.completed.context` application scenario; ApplicationIT peer + McpServerIT (server echoes context) coverage. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record 7b step-1 + step-2a done; ground remaining 2b/2c/3/4 https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): route non-blocking elicitation callbacks via the lifecycle Add server-side handling for a per-toolkit elicitation that has no held request stream (the non-blocking tools/list case relayed up by a proxy): - the lifecycle stream now handles an inbound elicitCreate CHALLENGE: it mints the elicitationId, manipulates the URL, records an open elicitation keyed by elicitationId, and renders elicitation/create on the lifecycle events SSE; - open elicitations are tracked as a McpElicitation record (held request stream may be null) instead of a bare McpRequestStream, carrying the in-band context; - the auth callback handler resolves the record and routes the callback three ways: held stream present -> flush on the request stream (blocking, as before); no held stream -> flush elicitCallback up the lifecycle so a proxy can route it to the right route-exit; unknown -> 410 Gone. context is echoed on both paths. New lifecycle.elicit.toolkit scenario: McpServerIT drives net client + app server (server renders the elicit on the lifecycle SSE and forwards the callback up the lifecycle with context echoed); ApplicationIT peer covers the app pair. Full no-skip green: runtime 214 IT/26 UT (jacoco/checkstyle/license); spec 201 IT/82 UT. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): route per-toolkit elicitation callbacks through the proxy The proxy now carries the in-band elicitation context end to end: - UP: when relaying a route-exit's elicitCreate challenge up the north lifecycle, the proxy injects context = that route's aggregate prefix (injectChallengeContext on McpLifecycleClient); single-route bindings have no prefix so context stays null and the relay is byte-identical; - BACK: the north-facing lifecycle now handles an inbound elicitCallback FLUSH (onServerFlush) — it reads context, resolves the route via routeByPrefix, pops its segment, and forwards the callback down to that route-exit (doClientFlushElicitCallback). A single-route binding (no context) forwards to its sole route. The proxy stays stateless for elicit routing: push the prefix on UP, route by the echoed context on BACK, no per-elicitation map. New proxy-only lifecycle.elicit.toolkit.multi scenario (route A authorized, route B elicits; relayed challenge carries context, callback routes back to route B) + McpProxyIT#shouldRouteElicitCallbackToToolkit. Full no-skip green: runtime 215 IT/26 UT (jacoco/checkstyle/license). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record 7b steps 2b + 3a done; ground remaining 3b/2c https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): decode remote elicitation on the client session SSE Restores client/server symmetry for session-stream elicitation. The mcp client opens a standalone GET (session/events) SSE to the remote and already relayed native notifications (list_changed) from it, but McpLifecycleStream did not override onDecodeElicitCreate/onDecodeElicitComplete, so a remote-originated elicitation/create arriving on the session SSE fell through to the base no-op and was silently dropped (only a request-response SSE handled it). McpLifecycleStream now overrides both, mirroring McpRequestStream: a session-SSE elicitation/create is relayed up as an elicitCreate CHALLENGE (so a downstream proxy's onClientChallenge injects context and the north server renders it), and elicitation/complete is relayed up as an elicitComplete flush. This is spec-legitimate: in Streamable HTTP, elicitation/create is a server->client request and the standalone SSE stream may carry server-initiated requests. New lifecycle.events.elicit scenario: McpClientIT drives app client + net server (remote emits elicitation/create then /complete on the session SSE; the client relays both up the lifecycle); ApplicationIT peer covers the app pair. Full no-skip green: runtime 216 IT/26 UT; spec 202 IT/82 UT (jacoco/checkstyle/license). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): reauthorize forwarded elicit callback on the route-exit lifecycle Completes guard-driven per-toolkit auth. When the proxy forwards an elicitCallback down to a route-exit (3a), the route-exit mcp client lifecycle now drives the guard and originates the listing-changed notification itself: - McpLifecycleStream.onAppFlush detects an elicitCallback flush and calls guard.reauthorize(callbackUrl, completion) (no held request stream needed); - on async completion, if the session is authorized (MASK_AUTHORIZED), it emits notifications/tools/list_changed up its lifecycle (doAppFlush toolsListChanged with a minted event id) so the proxy aggregates/relays it up and the client re-lists. Per the converged design, reauthorize + list_changed ORIGINATE at the route-exit client; the proxy only routes the callback and relays the notification. New lifecycle.elicit.reauthorize scenario: McpClientIT (client.guarded.yaml) drives app client + net server (forwarded callback -> guard reauthorize -> list_changed); ApplicationIT peer covers the app pair. Full no-skip green: runtime 217 IT/26 UT; spec 203 IT/82 UT (jacoco/checkstyle/license). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * fix(binding-mcp): omit event id on synthetic list_changed from reauthorize A guard-driven notifications/tools/list_changed minted by the route-exit on reauthorize is injected on behalf of the remote and has no counterpart in the remote's SSE event stream. Emitting a Zilla-minted id would pollute the remote's Last-Event-Id resumption space and could be replayed as an unknown id on recovery. Emit it with no id (transient re-list nudge, not a resumable position); the proxy skips id-less events in aggregation and relays them verbatim, and the north server renders a data-only SSE event with no id line. Drops the per-lifecycle notify counter; lifecycle.elicit.reauthorize scripts updated to expect a toolsListChanged with no id. Full no-skip green: runtime 217 IT/26 UT; spec ApplicationIT peer green. https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * feat(binding-mcp): make elicitation callback resolution single-use (2c) Open-elicitation records are now consumed on resolve: resolveElicitation removes the record from the session map instead of getting it, so a replayed or duplicate auth callback for the same elicitation resolves to 410 Gone and a resolved record never lingers past its one callback. Combined with the existing session-inactivity eviction (which already clears a session's records when it goes idle), open-elicitation records now have a complete bounded lifecycle: a record lives only until its single callback or until its session is evicted. This deliberately uses the session lifetime as the temporal bound rather than an aggressive independent timer, which would prematurely abort legitimate multi-minute URL/OAuth elicitation flows (and could not be tested deterministically without a clock hook). New lifecycle.elicit.toolkit.replay scenario in McpServerIT: an authorized callback (200) followed by a duplicate for the same state -> 410, with the session kept alive so the rejection proves record consumption (not session eviction). Full no-skip green: runtime 218 IT/26 UT; spec 203 IT/82 UT (jacoco/checkstyle/license). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * docs(handoff): record 7b complete (steps 1, 2a, 2b, 2c, 3a, 3b + client symmetry) https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * chore: remove HANDOFF.md working doc before merge https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * style(binding-mcp): drop verbose explanatory comments https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ * refactor(binding-mcp): key options.authorization by guard name Align options.authorization with options.cache.authorization (same binding) and the http/mqtt bindings: instead of a flat { name, credentials }, an authorization entry is now keyed by the guard name with an optional credentials inside: authorization: <guard>: credentials: <value> McpAuthorizationConfig (name + credentials) and all factory behavior are unchanged; only the JSON/YAML shape and its adapter + schema change. The schema block now mirrors cache.authorization (patternProperties on the guard name, maxProperties 1). The guardless static bootstrap credential (client.credentials.yaml) now names a test guard; with no preauthorize the guard returns NOT_AUTHORIZED on the live reauthorize(null), so the static credential still falls back and is attached, preserving shouldInitializeLifecycleWithBootstrapCredential. Updated config yamls (client.guarded/identity/options, server.options, proxy.authorization.invalid, client.credentials). Full no-skip green: runtime 218 IT/26 UT; spec 203 IT/82 UT (jacoco/checkstyle/license). https://claude.ai/code/session_01QM4QVu6tnoHS7X4GpxfXmJ --------- Co-authored-by: Claude <[email protected]>
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.
Summary
MCP elicitation support across all three
mcpbinding kinds (server,proxy,client). Lets an upstream tool implementation suspend atools/callrequest to ask the human user to authorize via OAuth, then resume the request once the user completes (or declines, or the auth times out). On theclientkind, the binding can also act as the OAuth initiator itself — pre-authorising the upstreamtools/callvia a configured guard before any request leaves the gateway.Closes #1739.
Protocol shape
The same app-side wire shape applies to all three binding kinds: every elicitation is
CHALLENGE mcp:elicitCreate(id, url)from the upstream →FLUSH mcp:elicitCallback(url)from the binding once the human has navigated the OAuth flow →FLUSH mcp:elicitComplete(COMPLETED | DECLINED | CANCELLED)from the upstream, all carried on the same app-stream initial direction.ENDis never forwarded while an elicitation is in flight. An app stream that emitsENDmid-elicit is treated as a protocol error and the reply isABORTed. This invariant holds inserver,proxy, andclientkinds.serverkind: the MCP SSE response stream that delivered thetools/callis upgraded to surface JSON-RPC elicitation events —id: :1 + data: { method: "elicitation/create", params: { url, elicitationId } }, then…:2 + elicitation/complete, then either…:3 + result(completed) or…:3 + error(declined / cancelled). The configurable auth-callback endpoint (options.elicitation.callback, defaultauth/callback) looks up the elicitation by session and emits the binding-sidemcp:elicitCallbackflush.proxykind: initial-direction FLUSHes are relayed unchanged between server and client sides so amcp:elicitCallbackfrom a downstream server traverses the proxy to the upstream.clientkind: two upstream-elicitation modes.mcpserver emits SSEelicitation/create/elicitation/completeevents on the response stream; the client decodes them on the network side and surfacesCHALLENGE mcp:elicitCreate/FLUSH mcp:elicitCompleteon the app side. To avoid the cycle "app holds initial END until elicit completes, but upstream needs the request body END to respond", the client also proactively ENDs the network HTTP request as soon as the JSON-RPC params body is complete (driven by a brace-depth tracker on the request body).NEEDS_PREAUTHORIZEontools/call, the binding holds the upstream POST, emitsCHALLENGE mcp:elicitCreate(id="1", url=preauthorizeURL)to the app, and defers the POST until the app replies withFLUSH mcp:elicitCallback(callbackURL). On COMPLETED it opens the POST withAuthorization: Bearer <credentials>and emitsFLUSH mcp:elicitComplete(COMPLETED); on DECLINED or timeout it emitsFLUSH mcp:elicitComplete(DECLINED | CANCELLED).What's in this branch
binding-mcpruntimemcp:elicitCreate,mcp:elicitCallback,mcp:elicitComplete) on CHALLENGE / FLUSH frames in the binding IDL;McpFunctionsbuilders/matchers for each, exercised byMcpFunctionsTest.McpElicitationConfigunderoptions(callbackpath, defaultauth/callback); newbinding.options.authorizationblock onclientkind, resolved against an engine guard.McpServerFactory): callback path recognition onGET, per-sessionelicitationsmap keyed by sessionId-prefixed state token,McpRequestStream.onAppChallenge/onAppFlush(elicitComplete)to drive the SSE event encoder; JSON-RPC error event on declined/cancelled;McpBindingConfig.resolveRedirectUrisynthesises the binding-side redirect URI from request headers (with a flyweight-reuse fix inArray32FW.matchFirst); deferred network END forwarding while inelicitMode.McpProxyFactory):doClientFlushon the client side and anonServerFlush → client.doClientFlushrelay so initial-direction FLUSHes (elicitCallback) traverse the proxy.McpClientFactory):McpToolsCallStreamrequest state machine: trackspendingAuth,requestSent,bufferedBody, elicit-timeout; gatesdoEncodeRequestEndonrequestSentto prevent encoder buffer leaks on the decline/timeout paths.onAppChallengeoverridesdoAppChallengeto useinitialId(client-kind throttle direction), distinct from the server-kind default.elicitation/createandelicitation/complete(withelicitationId,url,mode,statusextracted byJsonReader) →mcp.onDecodeElicitCreate/onDecodeElicitComplete.McpStream):proceedWithRequest,bufferAppData, anddeferAppEndhooks made overridable so the three kinds can compose the elicit state machine without duplicating the BEGIN/DATA/END plumbing; null-net guards added so handlers don't NPE on streams torn down mid-elicit.engineNEEDS_PREAUTHORIZEvia apreauthorizeURLoption on the test guard (drives the client-kind binding-driven path in ITs).channel.engine.drainTasks()) before sending the eagerWINDOWon accept-side child streams. This preserves the wire ordering trick scripts rely on (read advise zilla:challengeplaced beforeconnectedrequires the CHALLENGE frame to land on the streams buffer ahead of the eager WINDOW) without the regressions seen with the original "defer WINDOW via task" approach.onStartordering NPE fix), feat(engine): add REDIRECT control frame primitive #1755/feat(binding-http): handle REDIRECT and removewith.affinitysyntax #1758/feat(command-dump): add REDIRECT control frame support #1759 (REDIRECT control frame, binding-http REDIRECT, command-dump REDIRECT support) viadevelopmerge.binding-mcp.specscripts and ITstools.call.elicit.{completed,declined,timeout}scenarios for all three kinds:…/serverflow (already on develop, retained)…/.proxied/{client,server}formcp-proxyand themcp-clientupstream-driven path…/.guarded/{client,server}formcp-clientbinding-driven path (newclient.guarded.yamlconfig)reject.auth.callback.unknown.elicitationscenario.toolkit.elicitscenario adapted to the unified contract.incubator/command-dumpKafkaProduce_shouldSendMessageValueWithProducerId.txt,KafkaFetch_shouldRequestPartitionOffset.txt) refreshed for the new accept-side WINDOW order from thedrainTaskschange.Test plan
./mvnw install -pl runtime/binding-mcp --also-make -Djacoco.skip=trueMcpServerIT—shouldCallToolElicit{Completed,Declined,Timeout}+shouldCallToolToolkitElicitMcpClientIT—shouldCallToolElicit{Completed,Declined,Timeout}{Proxied,Guarded}(6 new scenarios, no@Ignore)McpProxyIT— FLUSH relay exercised by the proxied elicit ITsbinding-mcp.specpeer-to-peer:ApplicationIT+NetworkITcovering all elicit scenariosenginedriver tests with the wire-order-trick scripts:DuplexIT,HalfDuplexIT,SimplexIT,EngineIT,AdvisoryIT(binding-http)command-dumpKafkaProduceApplicationIT+KafkaFetchApplicationITafter fixture refreshhttps://claude.ai/code/session_0172bbrihatvupUXDAn5ddvC
Generated by Claude Code