part…
Building governance for MCP?
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
Logging allows the server to send structured log messages to the client. It is Deprecated (SEP-2577), with earliest removal in the first revision after 2027-07-28. It must be understood because it is still in production and because 2026-07-28 changed its mechanics before deprecating it.
{ "capabilities": { "logging": {} } }
debug, info, notice, warning, error, critical, alert, emergency.
There is no logging/setLevel. The client includes io.modelcontextprotocol/logLevel in a request's _meta; the server MAY then emit notifications/message with a level ≥ the requested one in that request's response stream, before the final response.
notifications/message for that request.subscriptions/listen or any other stream.-32602.{ "jsonrpc": "2.0", "method": "notifications/message", "params": {
"level": "error", "logger": "database", "data": { "error": "Connection failed", "details": { "host": "localhost", "port": 5432 } } } }
logging/setLevel set the level for the whole session; notifications could arrive on any stream (including the GET).
Messages MUST NOT contain credentials, PII or internal details that would help an attack. Implementations SHOULD rate-limit, validate data, control access and watch for sensitive content.
stdio → stderr; structured observability → OpenTelemetry (Part 13).
logLevel, forward it as is to modern servers; towards legacy servers, translate it to a per-session logging/setLevel and filter what arrives on other streams to return it on the request's correct stream (correlation may be impossible: document the loss).1. How does a modern client enable receiving logs?
It is per request; logging/setLevel was removed.
2. On which stream do notifications/message travel?
They are request-scoped and cannot go on any other stream.
3. What is the recommended migration path for logging in stdio?
stderr for stdio; OpenTelemetry for structured observability.