python-sdk/examples/snippets/clients/logging_client.py
2026-02-23 15:38:15 +00:00

13 lines
306 B
Python

from mcp import ClientSession, types
async def handle_log(params: types.LoggingMessageNotificationParams) -> None:
"""Handle log messages from the server."""
print(f"[{params.level}] {params.data}")
session = ClientSession(
read_stream,
write_stream,
logging_callback=handle_log,
)