mcp: add 2026-07-28 to the supported protocol versions (#1020)
This PR adds the protocol version `2026-07-28` to the list of supported protocol versions and fixes legacy tests hardcoding the legacy protocol version for those use cases.
This commit is contained in:
parent
b9e6fc5a66
commit
7f4aa4a0ce
1 changed files with 355 additions and 218 deletions
|
|
@ -19,19 +19,13 @@ import (
|
|||
func Example_lifecycle() {
|
||||
ctx := context.Background()
|
||||
|
||||
// Create a client and server.
|
||||
// Wait for the client to initialize the session.
|
||||
// Create a client and server. Under protocol version 2026-07-28, there
|
||||
// is no dedicated initialize/initialized handshake: the session is
|
||||
// implicitly live the moment the client issues its first request.
|
||||
client := mcp.NewClient(&mcp.Implementation{Name: "client", Version: "v0.0.1"}, nil)
|
||||
server := mcp.NewServer(&mcp.Implementation{Name: "server", Version: "v0.0.1"}, &mcp.ServerOptions{
|
||||
InitializedHandler: func(context.Context, *mcp.InitializedRequest) {
|
||||
fmt.Println("initialized!")
|
||||
},
|
||||
})
|
||||
server := mcp.NewServer(&mcp.Implementation{Name: "server", Version: "v0.0.1"}, nil)
|
||||
|
||||
// Connect the server and client using in-memory transports.
|
||||
//
|
||||
// Connect the server first so that it's ready to receive initialization
|
||||
// messages from the client.
|
||||
t1, t2 := mcp.NewInMemoryTransports()
|
||||
serverSession, err := server.Connect(ctx, t1, nil)
|
||||
if err != nil {
|
||||
|
|
@ -50,7 +44,7 @@ func Example_lifecycle() {
|
|||
if err := serverSession.Wait(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// Output: initialized!
|
||||
// Output:
|
||||
}
|
||||
|
||||
// !-lifecycle
|
||||
|
|
|
|||
Loading…
Reference in a new issue