Skip to content

Commit 1702948

Browse files
mcp: bump protocol version from 2026-06-30 to 2026-07-28 (#1015)
The new official date for the protocol version has been moved to '2026-07-28'. Update all the references in the code of the old version.
1 parent b85574f commit 1702948

13 files changed

Lines changed: 137 additions & 137 deletions

mcp/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ type ClientOptions struct {
165165
// If non-zero, defines an interval for regular "ping" requests.
166166
// If the peer fails to respond to pings originating from the keepalive check,
167167
// the session is automatically closed.
168-
// NOTE: The keepalive feature is only available for protocol versions < 2026-06-30
168+
// NOTE: The keepalive feature is only available for protocol versions < 2026-07-28
169169
KeepAlive time.Duration
170170
// KeepAliveFailureThreshold is the number of consecutive keepalive ping
171171
// failures tolerated before the session is closed. A value of 0 or 1
@@ -285,7 +285,7 @@ func (c *Client) Connect(ctx context.Context, t Transport, opts *ClientSessionOp
285285
protocolVersion = opts.protocolVersion
286286
}
287287

288-
if protocolVersion >= protocolVersion20260630 {
288+
if protocolVersion >= protocolVersion20260728 {
289289
// Per SEP-2575, try the stateless server/discover RPC first. If the server
290290
// signals it doesn't support it, fall back to the legacy initialize
291291
// handshake.
@@ -309,7 +309,7 @@ func (c *Client) Connect(ctx context.Context, t Transport, opts *ClientSessionOp
309309
if errors.As(err, &werr) && werr.Code == CodeUnsupportedProtocolVersion && werr.Data != nil {
310310
var data UnsupportedProtocolVersionData
311311
if err := json.Unmarshal(werr.Data, &data); err == nil {
312-
if negotiatedVersion := negotiateMutuallySupportedVersion(data.Supported); negotiatedVersion != "" && negotiatedVersion >= protocolVersion20260630 {
312+
if negotiatedVersion := negotiateMutuallySupportedVersion(data.Supported); negotiatedVersion != "" && negotiatedVersion >= protocolVersion20260728 {
313313
discoverCtx = context.WithValue(ctx, protocolVersionContextKey{}, negotiatedVersion)
314314
continue
315315
}
@@ -381,7 +381,7 @@ func (c *Client) discover(ctx context.Context, cs *ClientSession) (*InitializeRe
381381
} else {
382382
negotiated = negotiateMutuallySupportedVersion(res.SupportedVersions)
383383
}
384-
if negotiated == "" || negotiated < protocolVersion20260630 {
384+
if negotiated == "" || negotiated < protocolVersion20260728 {
385385
// If there is no overlap, fall back to initialize so version
386386
// negotiation can happen via the legacy path.
387387
return nil, jsonrpc2.ErrUnsupportedProtocolVersion
@@ -436,11 +436,11 @@ type clientSessionState struct {
436436
func (cs *ClientSession) InitializeResult() *InitializeResult { return cs.state.InitializeResult }
437437

438438
// usesNewProtocol reports whether this session has negotiated a protocol
439-
// version >= 2026-06-30, which requires the SEP-2575 per-request `_meta`
439+
// version >= 2026-07-28, which requires the SEP-2575 per-request `_meta`
440440
// triple on every outgoing request.
441441
func (cs *ClientSession) usesNewProtocol() bool {
442442
res := cs.state.InitializeResult
443-
return res != nil && res.ProtocolVersion >= protocolVersion20260630
443+
return res != nil && res.ProtocolVersion >= protocolVersion20260728
444444
}
445445

446446
// injectRequestMeta populates the SEP-2575 per-request `_meta` triple

mcp/client_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,9 @@ func TestClientCapabilitiesOverWire(t *testing.T) {
642642
// don't overlap with the SDK. The test then asserts the resulting session
643643
// state and whether the legacy initialize handshake ran.
644644
func TestClientConnectDiscover(t *testing.T) {
645-
// Temporarily enable 2026-06-30 support in the SDK for this test
645+
// Temporarily enable 2026-07-28 support in the SDK for this test
646646
oldSupported := supportedProtocolVersions
647-
supportedProtocolVersions = append([]string{protocolVersion20260630}, supportedProtocolVersions...)
647+
supportedProtocolVersions = append([]string{protocolVersion20260728}, supportedProtocolVersions...)
648648
t.Cleanup(func() {
649649
supportedProtocolVersions = oldSupported
650650
})
@@ -668,15 +668,15 @@ func TestClientConnectDiscover(t *testing.T) {
668668
name: "discover success skips initialize",
669669
discoverHandler: func() (Result, error) {
670670
return &DiscoverResult{
671-
SupportedVersions: []string{protocolVersion20260630},
671+
SupportedVersions: []string{protocolVersion20260728},
672672
Capabilities: &ServerCapabilities{
673673
Tools: &ToolCapabilities{ListChanged: true},
674674
},
675675
ServerInfo: &Implementation{Name: "discoverServer", Version: "v1.0.0"},
676676
}, nil
677677
},
678678
wantInitialize: false,
679-
wantVersion: protocolVersion20260630,
679+
wantVersion: protocolVersion20260728,
680680
},
681681
{
682682
name: "method not found falls back to initialize",
@@ -742,7 +742,7 @@ func TestClientConnectDiscover(t *testing.T) {
742742
defer ss.Close()
743743

744744
c := NewClient(testImpl, nil)
745-
cs, err := c.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260630})
745+
cs, err := c.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260728})
746746
if err != nil {
747747
t.Fatalf("Connect: %v", err)
748748
}
@@ -770,7 +770,7 @@ func TestClientConnectDiscover(t *testing.T) {
770770
// protocolVersion, clientInfo, and clientCapabilities.
771771
func TestClientConnectDiscover_RequestContents(t *testing.T) {
772772
orig := supportedProtocolVersions
773-
supportedProtocolVersions = append([]string{protocolVersion20260630}, slices.Clone(orig)...)
773+
supportedProtocolVersions = append([]string{protocolVersion20260728}, slices.Clone(orig)...)
774774
t.Cleanup(func() { supportedProtocolVersions = orig })
775775

776776
ctx := context.Background()
@@ -811,7 +811,7 @@ func TestClientConnectDiscover_RequestContents(t *testing.T) {
811811
return nil, nil
812812
},
813813
})
814-
cs, err := c.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260630})
814+
cs, err := c.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260728})
815815
if err != nil {
816816
t.Fatalf("Connect: %v", err)
817817
}
@@ -822,8 +822,8 @@ func TestClientConnectDiscover_RequestContents(t *testing.T) {
822822
}
823823

824824
meta := got.params.GetMeta()
825-
if v, _ := meta[MetaKeyProtocolVersion].(string); v != protocolVersion20260630 {
826-
t.Errorf("_meta[%s] = %q, want %q", MetaKeyProtocolVersion, v, protocolVersion20260630)
825+
if v, _ := meta[MetaKeyProtocolVersion].(string); v != protocolVersion20260728 {
826+
t.Errorf("_meta[%s] = %q, want %q", MetaKeyProtocolVersion, v, protocolVersion20260728)
827827
}
828828
// _meta values round-trip through JSON, so on the server side they
829829
// arrive as map[string]any rather than the typed Go pointers we sent.
@@ -849,7 +849,7 @@ func TestInMemory_E2E_DiscoverSuccess(t *testing.T) {
849849
ctx := context.Background()
850850

851851
orig := supportedProtocolVersions
852-
supportedProtocolVersions = append([]string{protocolVersion20260630}, slices.Clone(orig)...)
852+
supportedProtocolVersions = append([]string{protocolVersion20260728}, slices.Clone(orig)...)
853853
t.Cleanup(func() { supportedProtocolVersions = orig })
854854

855855
server := NewServer(&Implementation{Name: "stdio-like-server", Version: "v1"}, nil)
@@ -861,7 +861,7 @@ func TestInMemory_E2E_DiscoverSuccess(t *testing.T) {
861861
defer ss.Close()
862862

863863
client := NewClient(&Implementation{Name: "stdio-like-client", Version: "v1"}, nil)
864-
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260630})
864+
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260728})
865865
if err != nil {
866866
t.Fatalf("client.Connect: %v", err)
867867
}
@@ -871,9 +871,9 @@ func TestInMemory_E2E_DiscoverSuccess(t *testing.T) {
871871
if ir == nil {
872872
t.Fatal("InitializeResult is nil; discover should have populated it")
873873
}
874-
if ir.ProtocolVersion != protocolVersion20260630 {
874+
if ir.ProtocolVersion != protocolVersion20260728 {
875875
t.Errorf("InitializeResult.ProtocolVersion = %q, want %q (negotiated via discover, no initialize)",
876-
ir.ProtocolVersion, protocolVersion20260630)
876+
ir.ProtocolVersion, protocolVersion20260728)
877877
}
878878
if ir.ServerInfo == nil || ir.ServerInfo.Name != "stdio-like-server" {
879879
t.Errorf("InitializeResult.ServerInfo = %+v, want name=stdio-like-server", ir.ServerInfo)
@@ -887,13 +887,13 @@ func TestInMemory_E2E_DiscoverSuccess(t *testing.T) {
887887

888888
// TestInMemory_E2E_DiscoverFallback_NoOverlap verifies the fallback path
889889
// over an InMemory (STDIO-equivalent) transport: the client probes with
890-
// _meta.protocolVersion = 2026-06-30, but the server's supported list does
890+
// _meta.protocolVersion = 2026-07-28, but the server's supported list does
891891
// NOT include that version (the default for an SDK server that hasn't
892892
// shimmed supportedProtocolVersions).
893893
func TestInMemory_E2E_DiscoverFallback_NoOverlap(t *testing.T) {
894894
ctx := context.Background()
895895
orig := supportedProtocolVersions
896-
supportedProtocolVersions = append([]string{protocolVersion20260630}, slices.Clone(orig)...)
896+
supportedProtocolVersions = append([]string{protocolVersion20260728}, slices.Clone(orig)...)
897897
t.Cleanup(func() { supportedProtocolVersions = orig })
898898

899899
server := NewServer(&Implementation{Name: "vpre-like-server", Version: "v1"}, nil)
@@ -920,7 +920,7 @@ func TestInMemory_E2E_DiscoverFallback_NoOverlap(t *testing.T) {
920920
defer ss.Close()
921921

922922
client := NewClient(&Implementation{Name: "new-client", Version: "v1"}, nil)
923-
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260630})
923+
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260728})
924924
if err != nil {
925925
t.Fatalf("client.Connect: %v", err)
926926
}
@@ -948,7 +948,7 @@ func TestInMemory_E2E_DiscoverFallback_MethodNotFound(t *testing.T) {
948948
ctx := context.Background()
949949

950950
orig := supportedProtocolVersions
951-
supportedProtocolVersions = append([]string{protocolVersion20260630}, slices.Clone(orig)...)
951+
supportedProtocolVersions = append([]string{protocolVersion20260728}, slices.Clone(orig)...)
952952
t.Cleanup(func() { supportedProtocolVersions = orig })
953953

954954
server := NewServer(&Implementation{Name: "vpre-server", Version: "v1"}, nil)
@@ -969,7 +969,7 @@ func TestInMemory_E2E_DiscoverFallback_MethodNotFound(t *testing.T) {
969969
defer ss.Close()
970970

971971
client := NewClient(&Implementation{Name: "new-client", Version: "v1"}, nil)
972-
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260630})
972+
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260728})
973973
if err != nil {
974974
t.Fatalf("client.Connect: %v", err)
975975
}
@@ -997,7 +997,7 @@ func TestInMemory_E2E_DiscoverFallback_UnsupportedProtocolVersion(t *testing.T)
997997
ctx := context.Background()
998998

999999
orig := supportedProtocolVersions
1000-
supportedProtocolVersions = append([]string{protocolVersion20260630}, slices.Clone(orig)...)
1000+
supportedProtocolVersions = append([]string{protocolVersion20260728}, slices.Clone(orig)...)
10011001
t.Cleanup(func() { supportedProtocolVersions = orig })
10021002

10031003
server := NewServer(&Implementation{Name: "strict-server", Version: "v1"}, nil)
@@ -1021,7 +1021,7 @@ func TestInMemory_E2E_DiscoverFallback_UnsupportedProtocolVersion(t *testing.T)
10211021
defer ss.Close()
10221022

10231023
client := NewClient(&Implementation{Name: "new-client", Version: "v1"}, nil)
1024-
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260630})
1024+
cs, err := client.Connect(ctx, ct, &ClientSessionOptions{protocolVersion: protocolVersion20260728})
10251025
if err != nil {
10261026
t.Fatalf("client.Connect: %v", err)
10271027
}
@@ -1044,7 +1044,7 @@ func TestInMemory_E2E_DiscoverFallback_UnsupportedProtocolVersion(t *testing.T)
10441044
// selects a mutually supported version from that list and retries.
10451045
func TestClientConnectDiscover_UnsupportedVersionNegotiation(t *testing.T) {
10461046
oldSupported := supportedProtocolVersions
1047-
supportedProtocolVersions = append([]string{protocolVersion20260630}, slices.Clone(oldSupported)...)
1047+
supportedProtocolVersions = append([]string{protocolVersion20260728}, slices.Clone(oldSupported)...)
10481048
t.Cleanup(func() { supportedProtocolVersions = oldSupported })
10491049

10501050
ctx := context.Background()
@@ -1095,8 +1095,8 @@ func TestClientConnectDiscover_UnsupportedVersionNegotiation(t *testing.T) {
10951095
if got, want := discoverCalls.Load(), int32(1); got != want {
10961096
t.Errorf("server/discover handler call count = %d, want %d (first probe is rejected by the dispatcher; only the retry reaches the handler)", got, want)
10971097
}
1098-
if got, _ := observedDiscoverVersion.Load().(string); got != protocolVersion20260630 {
1099-
t.Errorf("retry discover requested version = %q, want %q (highest mutually supported version)", got, protocolVersion20260630)
1098+
if got, _ := observedDiscoverVersion.Load().(string); got != protocolVersion20260728 {
1099+
t.Errorf("retry discover requested version = %q, want %q (highest mutually supported version)", got, protocolVersion20260728)
11001100
}
11011101
if gotInitialize.Load() {
11021102
t.Error("legacy initialize handshake ran, but negotiated discover should have succeeded")
@@ -1106,7 +1106,7 @@ func TestClientConnectDiscover_UnsupportedVersionNegotiation(t *testing.T) {
11061106
if ir == nil {
11071107
t.Fatal("InitializeResult is nil after Connect")
11081108
}
1109-
if got, want := ir.ProtocolVersion, protocolVersion20260630; got != want {
1109+
if got, want := ir.ProtocolVersion, protocolVersion20260728; got != want {
11101110
t.Errorf("InitializeResult.ProtocolVersion = %q, want %q", got, want)
11111111
}
11121112
}

mcp/mrtr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func clientSupportsMultiRoundTrip(ss *ServerSession) bool {
6767
if iparams := ss.InitializeParams(); iparams != nil {
6868
protocolVersion = iparams.ProtocolVersion
6969
}
70-
return protocolVersion >= protocolVersion20260630
70+
return protocolVersion >= protocolVersion20260728
7171
}
7272

7373
func clientMultiRoundTripMiddleware() Middleware {

mcp/mrtr_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestMultiRoundTrip_ManualRetry(t *testing.T) {
2222
}
2323

2424
orig := supportedProtocolVersions
25-
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260630)
25+
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260728)
2626
t.Cleanup(func() { supportedProtocolVersions = orig })
2727

2828
ctx := context.Background()
@@ -94,7 +94,7 @@ func TestMultiRoundTrip_ManualRetry(t *testing.T) {
9494

9595
func TestMultiRoundTrip_AutoRetry(t *testing.T) {
9696
orig := supportedProtocolVersions
97-
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260630)
97+
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260728)
9898
t.Cleanup(func() { supportedProtocolVersions = orig })
9999

100100
tests := []struct {
@@ -219,7 +219,7 @@ func TestMultiRoundTrip_MaxRetries(t *testing.T) {
219219
},
220220
}
221221
orig := supportedProtocolVersions
222-
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260630)
222+
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260728)
223223
t.Cleanup(func() { supportedProtocolVersions = orig })
224224

225225
for _, tc := range testCases {
@@ -339,7 +339,7 @@ func TestMultiRoundTrip_ServerMiddleware(t *testing.T) {
339339

340340
func TestMultiRoundTrip_GetPrompt_AutoRetry(t *testing.T) {
341341
orig := supportedProtocolVersions
342-
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260630)
342+
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260728)
343343
t.Cleanup(func() { supportedProtocolVersions = orig })
344344

345345
ctx := context.Background()
@@ -381,7 +381,7 @@ func TestMultiRoundTrip_GetPrompt_AutoRetry(t *testing.T) {
381381

382382
func TestMultiRoundTrip_GetPrompt_ManualRetry(t *testing.T) {
383383
orig := supportedProtocolVersions
384-
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260630)
384+
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260728)
385385
t.Cleanup(func() { supportedProtocolVersions = orig })
386386

387387
ctx := context.Background()
@@ -433,7 +433,7 @@ func TestMultiRoundTrip_GetPrompt_ManualRetry(t *testing.T) {
433433

434434
func TestMultiRoundTrip_ReadResource_AutoRetry(t *testing.T) {
435435
orig := supportedProtocolVersions
436-
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260630)
436+
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260728)
437437
t.Cleanup(func() { supportedProtocolVersions = orig })
438438

439439
ctx := context.Background()
@@ -474,7 +474,7 @@ func TestMultiRoundTrip_ReadResource_AutoRetry(t *testing.T) {
474474

475475
func TestMultiRoundTrip_ReadResource_ManualRetry(t *testing.T) {
476476
orig := supportedProtocolVersions
477-
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260630)
477+
supportedProtocolVersions = append(slices.Clone(orig), protocolVersion20260728)
478478
t.Cleanup(func() { supportedProtocolVersions = orig })
479479

480480
ctx := context.Background()
@@ -536,7 +536,7 @@ func mustConnect(t *testing.T, s *Server, clientOpts *ClientOptions) *ClientSess
536536
})
537537

538538
c := NewClient(testImpl, clientOpts)
539-
cs, err := c.Connect(t.Context(), ct, &ClientSessionOptions{protocolVersion: protocolVersion20260630})
539+
cs, err := c.Connect(t.Context(), ct, &ClientSessionOptions{protocolVersion: protocolVersion20260728})
540540
if err != nil {
541541
t.Fatalf("client.Connect() error = %v", err)
542542
}

mcp/protocol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ const (
21382138
methodUnsubscribe = "resources/unsubscribe"
21392139
)
21402140

2141-
// Per-request _meta field names for the >= 2026-06-30 protocol version.
2141+
// Per-request _meta field names for the >= 2026-07-28 protocol version.
21422142
//
21432143
// These keys appear inside a Params._meta map and carry information that
21442144
// previously came from the initialization handshake (SEP-2575).

mcp/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ func (ss *ServerSession) Elicit(ctx context.Context, params *ElicitParams) (*Eli
14411441

14421442
// logLevelContextKey carries the per-request log level from
14431443
// [ServerSession.handle] to [ServerSession.Log] for new-protocol
1444-
// (>= 2026-06-30) requests. The level is scoped to a single in-flight request
1444+
// (>= 2026-07-28) requests. The level is scoped to a single in-flight request
14451445
// — including handler goroutines that call [ServerSession.Log] concurrently —
14461446
// rather than to the session, which avoids races between concurrent requests
14471447
// and aligns with SEP-2575's per-request opt-in model. The value type is
@@ -1450,7 +1450,7 @@ type logLevelContextKey struct{}
14501450

14511451
// Log sends a log message to the client.
14521452
//
1453-
// For new-protocol (>= 2026-06-30) requests, the level is taken from the
1453+
// For new-protocol (>= 2026-07-28) requests, the level is taken from the
14541454
// originating request's `_meta` field (SEP-2575); an absent or empty value
14551455
// suppresses the message per spec. For old-protocol requests, the level is
14561456
// taken from the session state set via `logging/setLevel`.
@@ -1609,7 +1609,7 @@ func (ss *ServerSession) handle(ctx context.Context, req *jsonrpc.Request) (any,
16091609
case methodDiscover:
16101610
// In case of methodDiscover call the state.initializeParams is populated
16111611
// within the discover handle function to make sure the method is supported
1612-
// when the user is probing a pre-2026-06-30 server.
1612+
// when the user is probing a pre-2026-07-28 server.
16131613
default:
16141614
if !initialized && !validatedMeta.usesNewProtocol {
16151615
ss.server.opts.Logger.Error("method invalid during initialization", "method", req.Method)

0 commit comments

Comments
 (0)