Skip to content

Commit a2e00ab

Browse files
authored
If dose not specify the 'ProtocolVersion' in 'mcp.InitializeParams', the MCP server will specify the low version during initialization phase. (#687)
For example, the mcp server dose support '2025-06-18' version. But if client dose not specify the version, the mcp server will use '2025-03-26'. And, the other case is that the mcp client dose not need the latest '2025-11-25' version MCP features. But when client do initialization with MCP server, the server select '2025-11-25' version during negotiation and raised "unsupported protocol version 2025-11-25" error. Since mcp-go library dose not implement the '2025-11-25' version mcp feature temporary. fix issue #650. Signed-off-by: hai.yue <hai.yue@ingka.com>
1 parent 498341a commit a2e00ab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

client/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ func (c *Client) Initialize(
213213
Capabilities: capabilities,
214214
}
215215

216+
// By default, use client supported lastest protocol version if version not specified
217+
if params.ProtocolVersion == "" {
218+
params.ProtocolVersion = mcp.LATEST_PROTOCOL_VERSION
219+
}
220+
216221
response, err := c.sendRequest(ctx, "initialize", params, request.Header)
217222
if err != nil {
218223
return nil, err

0 commit comments

Comments
 (0)