Structured Logging to the Client
Emit leveled log messages over the protocol.
Logs the Client Can See
Printing to your terminal only helps you. MCP lets the server send log messages over the protocol so the host app can show them too.
The message Notification
Logs travel as a notifications/message notification. It carries a level, optional logger name, and the data you want recorded.
{"method": "notifications/message",
"params": {"level": "info", "data": "Indexing started"}}All lessons in this course
- Send Progress for Long Tasks
- Handle Cancellation Requests
- Structured Logging to the Client
- Set Log Levels at Runtime