Repository navigation
Description
Summary
examples/clients/src/streamable_http.rs — the example linked from the README's Streamable HTTP section — still connects using the legacy lifecycle only (client_info.serve(transport), i.e. ClientLifecycleMode::Initialize). Now that ClientLifecycleMode::Auto reliably falls back against real deployed legacy servers (#1040, fixed by #1133), would it make sense to update this example to use Auto so it demonstrates the currently-recommended pattern (prefer server/discover, fall back to legacy initialize automatically) instead of only the legacy path?
Context
rmcpalready fully implementsClientLifecycleMode::Discover/Auto, documented in the README's "Client lifecycle modes" section.- There's existing precedent for a
Discover-based example (examples/clients/src/subscriptions_streamhttp.rs), but that one's primary purpose is demonstrating subscriptions, not the lifecycle itself, and it usesDiscover(no fallback) rather thanAuto. - The base
streamable_http.rsexample is the one most likely to be copy-pasted by newcomers as a starting point, so it seems like the highest-value place to show the recommended lifecycle mode now thatAuto's fallback behavior is stable. - The server-side example (
examples/servers/src/counter_hyper_streamable_http.rs) needs no change — the Streamable HTTP server already dispatches bothinitializeandserver/discovergenerically.
Question for maintainers
Before opening a PR, wanted to check preferred direction:
- Update
streamable_http.rsin place to useClientLifecycleMode::Auto? - Leave
streamable_http.rsas the legacy/simple baseline and add a new example demonstratingAutoinstead? - Something else (e.g. not a priority right now)?
Happy to send a PR once there's agreement on the approach.
Other examples in the same situation
streamable_http.rs isn't the only one still on the legacy-only lifecycle — the client examples in general haven't caught up with Discover/Auto yet. At least examples/clients/src/progress_client.rs (HTTP branch) and the OAuth examples (examples/clients/src/auth/oauth_client.rs, examples/clients/src/auth/client_credentials.rs) still call .serve() too. I'd rather start with just streamable_http.rs here since it's the one most people copy first, but happy to follow up on the others if that's useful.
AI assistance: drafted with Claude Code (research + writeup); analysis and questions above are my own.
Activity