feat: broadcast 2025-11-25 as latest supported client version (#758)

* feat: broadcast 2025-11-25 as latest supported client version
* fix: ignore empty SSE events
This commit is contained in:
Luca Chang 2026-02-06 01:55:37 -08:00 • committed by GitHub
commit ef8399c1cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 43 additions and 22 deletions

View file

@ -90,7 +90,7 @@ class HttpClientStreamableHttpTransportTest {
// Verify the customizer was called
verify(mockRequestCustomizer, atLeastOnce()).customize(any(), eq("POST"), eq(uri), eq(
"{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"id\":\"test-id\",\"params\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{\"roots\":{\"listChanged\":true}},\"clientInfo\":{\"name\":\"MCP Client\",\"version\":\"0.3.1\"}}}"),
"{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"id\":\"test-id\",\"params\":{\"protocolVersion\":\"2025-11-25\",\"capabilities\":{\"roots\":{\"listChanged\":true}},\"clientInfo\":{\"name\":\"MCP Client\",\"version\":\"0.3.1\"}}}"),
eq(context));
});
}
@ -120,7 +120,7 @@ class HttpClientStreamableHttpTransportTest {
// Verify the customizer was called
verify(mockRequestCustomizer, atLeastOnce()).customize(any(), eq("POST"), eq(uri), eq(
"{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"id\":\"test-id\",\"params\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{\"roots\":{\"listChanged\":true}},\"clientInfo\":{\"name\":\"MCP Client\",\"version\":\"0.3.1\"}}}"),
"{\"jsonrpc\":\"2.0\",\"method\":\"initialize\",\"id\":\"test-id\",\"params\":{\"protocolVersion\":\"2025-11-25\",\"capabilities\":{\"roots\":{\"listChanged\":true}},\"clientInfo\":{\"name\":\"MCP Client\",\"version\":\"0.3.1\"}}}"),
eq(context));
});
}

View file

@ -77,14 +77,14 @@ class HttpClientStreamableHttpVersionNegotiationIntegrationTests {
.hasSize(3)
.map(McpTestRequestRecordingServletFilter.Call::headers)
.allSatisfy(headers -> assertThat(headers).containsEntry("mcp-protocol-version",
ProtocolVersions.MCP_2025_06_18));
ProtocolVersions.MCP_2025_11_25));
assertThat(response).isNotNull();
assertThat(response.content()).hasSize(1)
.first()
.extracting(McpSchema.TextContent.class::cast)
.extracting(McpSchema.TextContent::text)
.isEqualTo(ProtocolVersions.MCP_2025_06_18);
.isEqualTo(ProtocolVersions.MCP_2025_11_25);
mcpServer.close();
}
@ -93,7 +93,7 @@ class HttpClientStreamableHttpVersionNegotiationIntegrationTests {
startTomcat();
var transport = HttpClientStreamableHttpTransport.builder("http://localhost:" + PORT)
.supportedProtocolVersions(List.of(ProtocolVersions.MCP_2025_06_18, "2263-03-18"))
.supportedProtocolVersions(List.of(ProtocolVersions.MCP_2025_11_25, "2263-03-18"))
.build();
var client = McpClient.sync(transport).build();
@ -108,14 +108,14 @@ class HttpClientStreamableHttpVersionNegotiationIntegrationTests {
.hasSize(2)
.map(McpTestRequestRecordingServletFilter.Call::headers)
.allSatisfy(headers -> assertThat(headers).containsEntry("mcp-protocol-version",
ProtocolVersions.MCP_2025_06_18));
ProtocolVersions.MCP_2025_11_25));
assertThat(response).isNotNull();
assertThat(response.content()).hasSize(1)
.first()
.extracting(McpSchema.TextContent.class::cast)
.extracting(McpSchema.TextContent::text)
.isEqualTo(ProtocolVersions.MCP_2025_06_18);
.isEqualTo(ProtocolVersions.MCP_2025_11_25);
mcpServer.close();
}