Skip to content

binding-mcp: single session-id contract, negotiated protocol-version, partial-success hydration #1815

Description

@jfallows

Summary

Fix the mcp.proxy 400 "No valid session ID" retry-storm and establish a single
session-id contract
across the mcp server/proxy/client, with negotiated
MCP-Protocol-Version
and per-toolkit partial-success hydration.

Root cause: the cache hydrater originated a locally-generated session id on its lifecycle
request and the proxy passed it through, so south requests carried an id the remote never
issued.

Single session-id contract (WS1)

  • A lifecycle (initialize) request carries no sessionId; the reply carries the
    minted id; non-lifecycle requests carry it. One id per stream everywhere — the client's
    responseSessionId dual is removed in favor of an app-id (Xc) vs transport-id (X)
    split (transportSessionId()).
  • The proxy mints a worker-aligned unified id and is the sole minter/mapper; the
    lifecycle owns its deferred per-route request streams (McpRouteRequest
    register/settle) and walks them once the route lifecycle settles, hash-routing each
    south request by its session id.
  • The server learns U from the app lifecycle reply, maps S↔U, hash-routes request
    streams by U, and still returns S on the HTTP mcp-session-id header.
  • The client mints aligned Xc inbound, returns it on the app reply, adopts the
    remote-minted X from the initialize response, and uses X only as the outbound HTTP
    header.
  • The cache hydrater sends its lifecycle with no id and adopts the proxy-minted id.
  • New engine util LongIntToLongFunction for hash-routed supplyInitialId.

Negotiated MCP-Protocol-Version (WS3)

  • Default 2025-06-18 (was a non-standard 2025-11-25); capture
    result.protocolVersion from the initialize response and send the negotiated version
    on subsequent request headers.

Per-toolkit partial success (WS2)

  • New hydrate.attempts.max bounds per-kind hydrate retries; on exhaustion the kind is
    marked degraded, so cache readiness no longer requires every kind populated
    (settled = populated || degraded); a degraded kind serves an empty list envelope
    instead of aborting.

Notes

Extracted from the examples/mcp.proxy branch (#1793); general binding-mcp behavior,
independent of the example. Second of three sequential binding-mcp extractions (cache
refresh #1813 → this → proxy fixes + per-upstream bootstrap credential). Includes new
lifecycle.initialize.version and cache.serve.tools.list.degraded spec scenarios.

Activity

  1. added theissue type on Jun 2, 2026
  2. self-assigned this
    on Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions