mcp: update latestProtocolVersion to 2025-11-25 (#724)
Update the SDK to use protocol version 2025-11-25 as the latest supported version. Fix tests and examples that had hardcoded expectations for the previous version (2025-06-18). --------- Co-authored-by: Maciej Kisiel <mkisiel@google.com>
This commit is contained in:
parent
41ac43d2ed
commit
4e1c3a34b5
9 changed files with 12 additions and 18 deletions
|
|
@ -165,7 +165,7 @@ func ExampleStreamableHTTPHandler() {
|
||||||
resp := mustPostMessage(`{"jsonrpc": "2.0", "id": 1, "method":"initialize", "params": {}}`, httpServer.URL)
|
resp := mustPostMessage(`{"jsonrpc": "2.0", "id": 1, "method":"initialize", "params": {}}`, httpServer.URL)
|
||||||
fmt.Println(resp)
|
fmt.Println(resp)
|
||||||
// Output:
|
// Output:
|
||||||
// {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-06-18","serverInfo":{"name":"server","version":"v0.1.0"}}}
|
// {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-11-25","serverInfo":{"name":"server","version":"v0.1.0"}}}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ func ExampleLoggingTransport() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// read: {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-06-18","serverInfo":{"name":"server","version":"v0.0.1"}}}
|
// read: {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-11-25","serverInfo":{"name":"server","version":"v0.0.1"}}}
|
||||||
// write: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"client","version":"v0.0.1"},"protocolVersion":"2025-06-18","capabilities":{"roots":{"listChanged":true}}}}
|
// write: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"client","version":"v0.0.1"},"protocolVersion":"2025-11-25","capabilities":{"roots":{"listChanged":true}}}}
|
||||||
// write: {"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
|
// write: {"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,6 @@
|
||||||
|
|
||||||
package mcp
|
package mcp
|
||||||
|
|
||||||
// Protocol types for version 2025-06-18.
|
|
||||||
// To see the schema changes from the previous version, run:
|
|
||||||
//
|
|
||||||
// prefix=https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/refs/heads/main/schema
|
|
||||||
// sdiff -l <(curl $prefix/2025-03-26/schema.ts) <(curl $prefix/2025/06-18/schema.ts)
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
||||||
|
|
@ -763,13 +763,13 @@ func TestClientRootCapabilities(t *testing.T) {
|
||||||
var initParams json.RawMessage
|
var initParams json.RawMessage
|
||||||
if tc.capabilities != nil {
|
if tc.capabilities != nil {
|
||||||
initParams = json.RawMessage(`{
|
initParams = json.RawMessage(`{
|
||||||
"protocolVersion": "2025-06-18",
|
"protocolVersion": "2025-11-25",
|
||||||
"capabilities": ` + *tc.capabilities + `,
|
"capabilities": ` + *tc.capabilities + `,
|
||||||
"clientInfo": {"name": "TestClient", "version": "1.0.0"}
|
"clientInfo": {"name": "TestClient", "version": "1.0.0"}
|
||||||
}`)
|
}`)
|
||||||
} else {
|
} else {
|
||||||
initParams = json.RawMessage(`{
|
initParams = json.RawMessage(`{
|
||||||
"protocolVersion": "2025-06-18",
|
"protocolVersion": "2025-11-25",
|
||||||
"clientInfo": {"name": "TestClient", "version": "1.0.0"}
|
"clientInfo": {"name": "TestClient", "version": "1.0.0"}
|
||||||
}`)
|
}`)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ const (
|
||||||
//
|
//
|
||||||
// It is the version that the client sends in the initialization request, and
|
// It is the version that the client sends in the initialization request, and
|
||||||
// the default version used by the server.
|
// the default version used by the server.
|
||||||
latestProtocolVersion = protocolVersion20250618
|
latestProtocolVersion = protocolVersion20251125
|
||||||
protocolVersion20251125 = "2025-11-25" // not yet released
|
protocolVersion20251125 = "2025-11-25"
|
||||||
protocolVersion20250618 = "2025-06-18"
|
protocolVersion20250618 = "2025-06-18"
|
||||||
protocolVersion20250326 = "2025-03-26"
|
protocolVersion20250326 = "2025-03-26"
|
||||||
protocolVersion20241105 = "2024-11-05"
|
protocolVersion20241105 = "2024-11-05"
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ func ExampleStreamableHTTPHandler() {
|
||||||
resp := mustPostMessage(`{"jsonrpc": "2.0", "id": 1, "method":"initialize", "params": {}}`, httpServer.URL)
|
resp := mustPostMessage(`{"jsonrpc": "2.0", "id": 1, "method":"initialize", "params": {}}`, httpServer.URL)
|
||||||
fmt.Println(resp)
|
fmt.Println(resp)
|
||||||
// Output:
|
// Output:
|
||||||
// {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-06-18","serverInfo":{"name":"server","version":"v0.1.0"}}}
|
// {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-11-25","serverInfo":{"name":"server","version":"v0.1.0"}}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// !-streamablehandler
|
// !-streamablehandler
|
||||||
|
|
|
||||||
|
|
@ -758,7 +758,7 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
Logging: &LoggingCapabilities{},
|
Logging: &LoggingCapabilities{},
|
||||||
Tools: &ToolCapabilities{ListChanged: true},
|
Tools: &ToolCapabilities{ListChanged: true},
|
||||||
},
|
},
|
||||||
ProtocolVersion: latestProtocolVersion,
|
ProtocolVersion: protocolVersion20250618,
|
||||||
ServerInfo: &Implementation{Name: "testServer", Version: "v1.0.0"},
|
ServerInfo: &Implementation{Name: "testServer", Version: "v1.0.0"},
|
||||||
}, nil)
|
}, nil)
|
||||||
initializedMsg := req(0, notificationInitialized, &InitializedParams{})
|
initializedMsg := req(0, notificationInitialized, &InitializedParams{})
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ response with its latest supported version.
|
||||||
"capabilities": {
|
"capabilities": {
|
||||||
"logging": {}
|
"logging": {}
|
||||||
},
|
},
|
||||||
"protocolVersion": "2025-06-18",
|
"protocolVersion": "2025-11-25",
|
||||||
"serverInfo": {
|
"serverInfo": {
|
||||||
"name": "testServer",
|
"name": "testServer",
|
||||||
"version": "v1.0.0"
|
"version": "v1.0.0"
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ func ExampleLoggingTransport() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// read: {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-06-18","serverInfo":{"name":"server","version":"v0.0.1"}}}
|
// read: {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{}},"protocolVersion":"2025-11-25","serverInfo":{"name":"server","version":"v0.0.1"}}}
|
||||||
// write: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"client","version":"v0.0.1"},"protocolVersion":"2025-06-18","capabilities":{"roots":{"listChanged":true}}}}
|
// write: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"client","version":"v0.0.1"},"protocolVersion":"2025-11-25","capabilities":{"roots":{"listChanged":true}}}}
|
||||||
// write: {"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
|
// write: {"jsonrpc":"2.0","method":"notifications/initialized","params":{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue