internal/mcp: update protocol versions
Update protocol versions to reflect that 2025-03-26 is supported, and add server logic to negotiate the supported version with the client. Update the client to set the protocol version, fixing what was probably a spec violation. +tests Change-Id: I564b591b3daf018dd54f5c7e5d8f2d2b1e4ff502 Reviewed-on: https://go-review.googlesource.com/c/tools/+/682516 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
This commit is contained in:
parent
1fead0ba64
commit
5ae2a9f222
2 changed files with 130 additions and 7 deletions
40
mcp/testdata/conformance/server/version-latest.txtar
vendored
Normal file
40
mcp/testdata/conformance/server/version-latest.txtar
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
Check that when the client sends an arbitrary later version, the server
|
||||
response with its latest supported version.
|
||||
|
||||
-- client --
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"method": "initialize",
|
||||
"params": {
|
||||
"protocolVersion": "2029-01-01",
|
||||
"capabilities": {},
|
||||
"clientInfo": { "name": "ExampleClient", "version": "1.0.0" }
|
||||
}
|
||||
}
|
||||
-- server --
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"result": {
|
||||
"_meta": {},
|
||||
"capabilities": {
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {
|
||||
"listChanged": true
|
||||
},
|
||||
"resources": {
|
||||
"listChanged": true
|
||||
},
|
||||
"tools": {
|
||||
"listChanged": true
|
||||
}
|
||||
},
|
||||
"protocolVersion": "2025-03-26",
|
||||
"serverInfo": {
|
||||
"name": "testServer",
|
||||
"version": "v1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
40
mcp/testdata/conformance/server/version-older.txtar
vendored
Normal file
40
mcp/testdata/conformance/server/version-older.txtar
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
Check that when the client sends an older version, the server indicates
|
||||
support.
|
||||
|
||||
-- client --
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"method": "initialize",
|
||||
"params": {
|
||||
"protocolVersion": "2024-11-05",
|
||||
"capabilities": {},
|
||||
"clientInfo": { "name": "ExampleClient", "version": "1.0.0" }
|
||||
}
|
||||
}
|
||||
-- server --
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"result": {
|
||||
"_meta": {},
|
||||
"capabilities": {
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {
|
||||
"listChanged": true
|
||||
},
|
||||
"resources": {
|
||||
"listChanged": true
|
||||
},
|
||||
"tools": {
|
||||
"listChanged": true
|
||||
}
|
||||
},
|
||||
"protocolVersion": "2024-11-05",
|
||||
"serverInfo": {
|
||||
"name": "testServer",
|
||||
"version": "v1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue