docs: fix the streamable client snippet to use (*Client).Connect - #1142
Merged
guglielmo-san merged 1 commit intoAug 4, 2026
Merged
Conversation
The client-side snippet in the "Streamable Transport" section calls mcp.Connect, which does not exist: the package has no top-level Connect function, only (*Client).Connect. Copying the snippet fails to build with "undefined: mcp.Connect" (checked against v1.7.0), and the third argument was *ClientOptions where Connect takes *ClientSessionOptions. Use the same shape as every other client snippet in the docs: construct the client with NewClient, then call client.Connect and keep the returned session. Edited internal/docs/protocol.src.md and regenerated docs/protocol.md with go generate ./internal/docs. Assisted-by: Claude Opus 5 (Anthropic)
guglielmo-san
approved these changes
Aug 4, 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.
What was broken
docs/protocol.md→ Streamable Transport → client side shows:There is no top-level
mcp.Connect. The package has(*Client).Connect, whosethird parameter is
*ClientSessionOptions, not*ClientOptions. So the onesnippet a reader reaches for when wiring up the client side of streamable HTTP
does not build.
It is also the only outlier in the docs:
quick_start.md,client.md,server.md,troubleshooting.mdandprotocol.mditself (lines 470, 538) allalready use
client.Connect(ctx, transport, nil).How I checked
Pasted the snippet verbatim into a fresh module requiring the released SDK
(
github.com/modelcontextprotocol/go-sdk v1.7.0):Then ran the proposed replacement end to end against a real streamable server
(
mcp.NewStreamableHTTPHandlerbehindhttptest.NewServer), connecting andcalling a tool over the session:
What it is now
Change is in
internal/docs/protocol.src.md;docs/protocol.mdregenerated withgo generate ./internal/docs, both committed together. Docs-only, no code pathstouched.
Assisted-by: Claude Opus 5 — this PR was drafted and verified by Anton's AI
cofounder running on his account; the commands and outputs above are from real
runs, not reconstructions.