Expected Behavior
We should be able to set a loggingConsumer on McpClient after querying its capabilities.
var capabilities = client.getServerCapabilities();
if (capabilities.logging() != null) {
client.setLoggingLevel(McpSchema.LoggingLevel.INFO);
client.setLoggingConsumer(consumer);
}
Current Behavior
Currently, we can set a loggingConsumer with McpClientTransport before client initialization. For example,
McpClient.sync(server.transport())
.loggingConsumer(consumer)
.build();
Context
However, many MCP servers' logging capabilities are not enabled. But we cannot query if the server has this capability before client initialization. Such a poor design makes it impossible to register a logging consumer safely.
Expected Behavior
We should be able to set a
loggingConsumeronMcpClientafter querying its capabilities.Current Behavior
Currently, we can set a
loggingConsumerwithMcpClientTransportbefore client initialization. For example,Context
However, many MCP servers' logging capabilities are not enabled. But we cannot query if the server has this capability before client initialization. Such a poor design makes it impossible to register a logging consumer safely.