mcp-use supports this feature through a logging_callback function that can be passed to the MCPClient.
Server-Side: Sending Logs
On the server (usingfastmcp), you can send log messages with different severity levels from within a tool’s context (ctx).
logging/message notifications to the client.
Client-Side: Handling Logs
While you can catchLoggingMessageNotification events within the general message_handler, the recommended approach is to use the dedicated logging_callback. This keeps your code clean by separating logging concerns from other notification handling.
The logging_callback receives the parameters of the log notification directly, which include the level and message.
logging_callback, you can easily route server-side logs to your client’s logging system, display them in a debug console, or handle them in any other way that suits your application’s needs.