fix: ServerCapabilities should not enable logging by default (#463)

- Change LoggingCapabilities from default-initialized to nullable in ServerCapabilities
- Add check if server logging is enabled in McpAsyncClient before setting logging level
- Ensure McpAsyncServer always enables logging capabilities when built
- Ensure McpStatelessAsyncServer has disabled logging capability by default
- Update tests to verify logging capabilities can be null

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Co-authored-by: Christian Tzolov <christian.tzolov@broadcom.com>
This commit is contained in:
Jordan Zimmerman 2025-08-06 22:40:21 +01:00 • committed by Christian Tzolov
commit a96da37140

View file

@ -950,7 +950,7 @@ public abstract class AbstractMcpClientServerIntegrationTests {
List<McpSchema.LoggingMessageNotification> receivedNotifications = new CopyOnWriteArrayList<>();
var clientBuilder = clientBuilders.get(clientType);
;
// Create server with a tool that sends logging notifications
McpServerFeatures.AsyncToolSpecification tool = McpServerFeatures.AsyncToolSpecification.builder()
.tool(Tool.builder()
@ -999,7 +999,7 @@ public abstract class AbstractMcpClientServerIntegrationTests {
.build();
var mcpServer = prepareAsyncServerBuilder().serverInfo("test-server", "1.0.0")
.capabilities(ServerCapabilities.builder().logging().tools(true).build())
.capabilities(ServerCapabilities.builder().tools(true).build())
.tools(tool)
.build();