Update examples for the 2026-07-28 era - #537
Open
koic wants to merge 1 commit into
Open
Conversation
## Motivation and Context The runnable examples drifted from the SDK they ship with: - POST requests whose `Accept` header does not cover both `application/json` and `text/event-stream` are answered 406, so the cURL walkthroughs no longer worked as printed. - `MCP::Client#connect` now defaults to `mode: :auto`, which adopts the sessionless modern lifecycle (2026-07-28) against a dual-era server; the Streamable HTTP client example requires a session and broke against its own server. - POST responses on an established session arrive as an SSE stream, which the hand-rolled HTTP client did not parse. - `notification_tool` claimed to send SSE notifications but only returned a `Tool::Response`. - `http_client.rb` read a resource URI the server never registered and skipped `notifications/initialized`. Handshake examples now offer the latest handshake protocol version (`2025-11-25`) instead of `2024-11-05`, the Streamable HTTP client pins `mode: :legacy` for its session-based demo, `notification_tool` reports real `notifications/progress` events requested through `_meta.progressToken`, and the interactive client streams those events from the POST response so they are visible on screen. The modern lifecycle itself had no runnable example, so a new server and client pair (`modern_http_server.rb`, `modern_http_client.rb`) shows the sessionless flow end to end: `server/discover` capability discovery, the per-request `_meta` envelope with the `Mcp-Method` and `Mcp-Name` headers (stamped by the SDK client automatically), `resultType` stamping, SEP-2549 cache hints, a SEP-2322 multi round-trip `deploy` tool resumed automatically by the client's elicitation handler, and the removal of legacy-only methods such as `ping`. The same server keeps serving the legacy `initialize` flow, routed per request by the `MCP-Protocol-Version` header. `examples/README.md` documents the pair and adds a cURL walkthrough covering the modern headers, the envelope, and the multi round-trip exchange. ## How Has This Been Tested? - `ruby examples/stdio_client.rb` against `stdio_server.rb` - `ruby examples/http_client.rb` against `http_server.rb` - `ruby examples/streamable_http_client.rb` against `streamable_http_server.rb`, including the progress stream - `ruby examples/modern_http_client.rb` against `modern_http_server.rb` (discover, modern adoption, cache hints, `resultType`, the multi round-trip resume, `ping` rejection) - The cURL walkthroughs in the banners and `examples/README.md`, including the `requestState` echo and a legacy `initialize` against the modern example server ## Breaking Changes None.
atesgoral
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
The runnable examples drifted from the SDK they ship with:
Acceptheader does not cover bothapplication/jsonandtext/event-streamare answered 406, so the cURL walkthroughs no longer worked as printed.MCP::Client#connectnow defaults tomode: :auto, which adopts the sessionless modern lifecycle (2026-07-28) against a dual-era server; the Streamable HTTP client example requires a session and broke against its own server.notification_toolclaimed to send SSE notifications but only returned aTool::Response.http_client.rbread a resource URI the server never registered and skippednotifications/initialized.Handshake examples now offer the latest handshake protocol version (
2025-11-25) instead of2024-11-05, the Streamable HTTP client pinsmode: :legacyfor its session-based demo,notification_toolreports realnotifications/progressevents requested through_meta.progressToken, and the interactive client streams those events from the POST response so they are visible on screen.The modern lifecycle itself had no runnable example, so a new server and client pair (
modern_http_server.rb,modern_http_client.rb) shows the sessionless flow end to end:server/discovercapability discovery, the per-request_metaenvelope with theMcp-MethodandMcp-Nameheaders (stamped by the SDK client automatically),resultTypestamping, SEP-2549 cache hints, a SEP-2322 multi round-tripdeploytool resumed automatically by the client's elicitation handler, and the removal of legacy-only methods such asping. The same server keeps serving the legacyinitializeflow, routed per request by theMCP-Protocol-Versionheader.examples/README.mddocuments the pair and adds a cURL walkthrough covering the modern headers, the envelope, and the multi round-trip exchange.How Has This Been Tested?
ruby examples/stdio_client.rbagainststdio_server.rbruby examples/http_client.rbagainsthttp_server.rbruby examples/streamable_http_client.rbagainststreamable_http_server.rb, including the progress streamruby examples/modern_http_client.rbagainstmodern_http_server.rb(discover, modern adoption, cache hints,resultType, the multi round-trip resume,pingrejection)examples/README.md, including therequestStateecho and a legacyinitializeagainst the modern example serverBreaking Changes
None.
Types of changes
Checklist