Skip to content

Refactor logging system to use exchange for targeted client notifications #131

Closed
@tzolov

Description

@tzolov

Bug description
The current MCP logging implementation has several limitations:

  • Logging notifications are broadcast to all connected clients regardless of their interest level
  • There's a single global minimum logging level for the entire server
  • Clients cannot individually configure which log levels they want to receive
  • The current approach is inefficient as it sends unnecessary messages to clients

This design doesn't align with the per-session approach used for other MCP features like sampling and roots, where each client can have its own configuration.

Expected behavior

  • Use the exchange mechanism to send logging notifications only to specific client sessions
  • Track minimum logging level per client session rather than globally
  • Filter logging notifications at the server side based on each client's configured level
  • Change setLoggingLevel from a notification to a request/response pattern for proper acknowledgment
  • Deprecate the old broadcasting behavior.

Acceptance Criteria

  • Each client can set its own minimum logging level
  • Logging notifications below a client's minimum level are filtered out
  • Logging notifications at or above a client's minimum level are delivered
  • Ddd integration tests

Environment
Affects all MCP versions including 0.9.0-SN

Related to #97

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions