@@ -77,19 +77,13 @@ it is the client's responsibility to end the session.
7777func Example_lifecycle () {
7878 ctx := context.Background ()
7979
80- // Create a client and server.
81- // Wait for the client to initialize the session.
80+ // Create a client and server. Under protocol version 2026-07-28, there
81+ // is no dedicated initialize/initialized handshake: the session is
82+ // implicitly live the moment the client issues its first request.
8283 client := mcp.NewClient (&mcp.Implementation {Name: " client" , Version: " v0.0.1" }, nil )
83- server := mcp.NewServer (&mcp.Implementation {Name: " server" , Version: " v0.0.1" }, &mcp.ServerOptions {
84- InitializedHandler: func (context.Context , *mcp.InitializedRequest ) {
85- fmt.Println (" initialized!" )
86- },
87- })
84+ server := mcp.NewServer (&mcp.Implementation {Name: " server" , Version: " v0.0.1" }, nil )
8885
8986 // Connect the server and client using in-memory transports.
90- //
91- // Connect the server first so that it's ready to receive initialization
92- // messages from the client.
9387 t1 , t2 := mcp.NewInMemoryTransports ()
9488 serverSession , err := server.Connect (ctx, t1, nil )
9589 if err != nil {
@@ -108,7 +102,7 @@ func Example_lifecycle() {
108102 if err := serverSession.Wait (); err != nil {
109103 log.Fatal (err)
110104 }
111- // Output: initialized!
105+ // Output:
112106}
113107```
114108
@@ -213,7 +207,7 @@ func ExampleStreamableHTTPHandler() {
213207 defer httpServer.Close ()
214208
215209 // The SDK is currently permissive of some missing keys in "params".
216- resp := mustPostMessage (` {"jsonrpc": "2.0", "id": 1, "method":"initialize", "params": {}}` , httpServer.URL )
210+ resp := mustPostMessage (` {"jsonrpc": "2.0", "id": 1, "method":"initialize", "params": {"protocolVersion":"2025-11-25" }}` , httpServer.URL )
217211 fmt.Println (resp)
218212 // Output:
219213 // {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-11-25","serverInfo":{"name":"server","version":"v0.1.0"}}}
0 commit comments