From f7fb795da2a1559842949d2a8c69d574e7ecb10d Mon Sep 17 00:00:00 2001 From: Anton Dzyatkovsky Date: Tue, 4 Aug 2026 05:22:05 -0700 Subject: [PATCH] docs: fix the streamable client snippet to use (*Client).Connect 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) --- docs/protocol.md | 3 ++- internal/docs/protocol.src.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/protocol.md b/docs/protocol.md index 35bf93bf..edc1c11e 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -256,7 +256,8 @@ connect to the server: transport := &mcp.StreamableClientTransport{ Endpoint: "http://localhost:8080/mcp", } -client, err := mcp.Connect(ctx, transport, &mcp.ClientOptions{...}) +client := mcp.NewClient(&mcp.Implementation{Name: "client", Version: "v1.0.0"}, nil) +session, err := client.Connect(ctx, transport, nil) ``` The `StreamableClientTransport` handles the HTTP requests and communicates with diff --git a/internal/docs/protocol.src.md b/internal/docs/protocol.src.md index dee819b8..e26fcd77 100644 --- a/internal/docs/protocol.src.md +++ b/internal/docs/protocol.src.md @@ -181,7 +181,8 @@ connect to the server: transport := &mcp.StreamableClientTransport{ Endpoint: "http://localhost:8080/mcp", } -client, err := mcp.Connect(ctx, transport, &mcp.ClientOptions{...}) +client := mcp.NewClient(&mcp.Implementation{Name: "client", Version: "v1.0.0"}, nil) +session, err := client.Connect(ctx, transport, nil) ``` The `StreamableClientTransport` handles the HTTP requests and communicates with