You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/client.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -388,6 +388,24 @@ const client = new Client(
388
388
);
389
389
```
390
390
391
+
### SDK diagnostics logger
392
+
393
+
SDK-internal diagnostics, such as capability-gating debug messages and schema conversion warnings, use the {@linkcode@modelcontextprotocol/client!index.ProtocolOptions.logger | logger} constructor option. It defaults to `console`. The logger is partial: each method is optional, and omitted levels are silently skipped.
For full control — or for notification types not covered by `listChanged` (such as log messages) — register handlers directly with {@linkcode@modelcontextprotocol/client!client/client.Client#setNotificationHandler | setNotificationHandler()}:
Copy file name to clipboardExpand all lines: docs/server.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -346,6 +346,8 @@ server.registerPrompt(
346
346
> [!WARNING]
347
347
> MCP logging is deprecated as of protocol version 2026-07-28 (SEP-2577). It remains fully functional during the deprecation window (at least twelve months); see the [deprecated features registry](https://modelcontextprotocol.io/specification/draft/deprecated). Migrate to stderr logging (STDIO servers) or OpenTelemetry.
348
348
349
+
This section covers MCP protocol logging sent from your server to the client. SDK-internal diagnostics, such as tool-name validation warnings and schema conversion fallbacks, are separate and use the `logger` constructor option on `Server` and `McpServer`. The option defaults to `console`; each logger method is optional, so omitted levels are skipped.
350
+
349
351
Logging lets your server send structured diagnostics — debug traces, progress updates, warnings — to the connected client as notifications (see [Logging](https://modelcontextprotocol.io/specification/latest/server/utilities/logging) in the MCP specification).
350
352
351
353
Declare the `logging` capability, then call `ctx.mcpReq.log(level, data)` (from {@linkcode@modelcontextprotocol/server!index.ServerContext | ServerContext}) inside any handler:
0 commit comments