MCP logging lets a server send structured log messages to a client, and the client controls the verbosity per request. The levels follow the standard syslog severity levels from RFC 5424: debug, info, notice, warning, error, critical, alert and emergency. To receive messages for a request, the client includes a log level in the request metadata, and the server may then send notifications/message at or above that level on the response stream.
What you need
- The server logging capability declared
- The level of detail you want for this request
- A client view that can show or filter log messages
Step 1: Set the log level in the request metadata
Include io.modelcontextprotocol/logLevel in the request metadata, for example info for normal operation or debug when diagnosing a fault. The server must not emit log messages for a request that does not include this field.
Step 2: Check the messages match the level
Confirm the server only sends messages at or above the level you set. A debug-level request may be noisy, while an error-level request should stay quiet unless something actually fails.
Step 3: Check no secrets reach the log
Confirm log messages contain no credentials, personal identifying information, or internal system details that could aid an attack. If a message carries a secret, raise the level and fix the server before using it again.
Worked example: synthetic log level check for one request
The table below is a synthetic example. It shows the expected result of setting a log level; no request was sent.
| Level set | Messages sent | Result |
|---|---|---|
| debug | debug, info, warning, error | All levels shown |
| info | info, warning, error | Debug hidden |
| warning | warning, error | Info hidden |
| error | error only | Quiet |
Expected result (UNTESTED). each level shows only messages at or above it, and no message carries a secret. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Log messages are request-scoped: the server must not deliver them on a subscriptions stream or any stream other than the response to the request that set the level.
- An unrecognized log level value should be rejected with a standard JSON-RPC error.
- Servers should rate-limit log messages and use consistent logger names.
- Clients may present log messages in the UI, filter them, or persist them.
