Skip to content

set loggingConsumer after client initialization #938

Open

Description

@haifengl

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.

Activity

  1. liotur commented on Oct 11, 2026

    @liotur

    Opened #1171 for this. The logging notification handler already iterates the consumer list on every notification, so this only needed a thread-safe list and an addLoggingConsumer method on both clients — no handler reinstallation.

  2. added a commit that references this issue on Oct 12, 2026
    ece8a7b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions