Skip to content

binding-mcp: proxy hydration/forwarding fixes + per-upstream bootstrap credential #1817

Description

@jfallows

Summary

The remaining MCP proxy hydration/forwarding fixes plus the per-upstream bootstrap
credential
— the third and final binding-mcp extraction from the examples/mcp.proxy
branch (#1793), after cache refresh (#1813) and the single session-id contract (#1815).

Changes

  • Content-length framing for request bodiesfix: frame client HTTP request bodies
    with Content-Length; feat: frame streamed tools/call / prompts/get /
    resources/read request bodies — the server stamps a guesstimate contentLength on
    McpBeginEx and the client declares a south Content-Length and whitespace-pads (no
    buffering / chunked).
  • Grant the proxy reply window when the request reply begins (fixes a north
    tools/list hang from a reply-window race).
  • Strip the toolkit prefix from the forwarded tool name in the proxy request body.
  • Degrade gracefully when a south route fails cache hydration — skip a never-established
    route (sessionId == null) from hydration and isolate its per-route lifecycle failure
    from the shared hydrater lifecycle, so the healthy routes still aggregate.
  • Per-upstream bootstrap credential on the mcp client binding
    (options.authorization.credentials) — used when there is no inbound client token, so the
    cache hydrater and token-less calls can authorize a route that requires it.
  • Widen the redirect hash unsignedRedirectFW carried sessionId.hashCode()
    sign-extended; binding-http folds it via Long.hashCode, so a negative hash routed the
    cross-worker redirect to the wrong worker → re-redirect → HTTP 500 for ~half of sessions
    under multiple workers. Widen with Integer.toUnsignedLong so the fold round-trips.

Notes

General binding-mcp behavior, independent of the example (the example-config edits in two of
these commits are excluded and stay on the example branch). Final binding-mcp extraction;
after this, only the example remains on #1793.

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