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
Reorder docs/server.md sections for a clearer overview narrative
Move DNS rebinding protection and multi-node deployment patterns into a
new `## Deployment` umbrella near the end — they were splitting the flow
between Transports and core primitives. Promote Logging from a `####`
under Tools to a `###` peer of Tools/Resources/Prompts, since
`ctx.mcpReq.log()` is available in any handler, not just tools. Add a
brief `#### Tool annotations` subsection under Tools (previously only in
the catch-all table). Remove the Tool annotations row from the
`More server features` table and drop the cross-link to client.md from
the Completions section.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/server.md
+60-54Lines changed: 60 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,30 +92,6 @@ const transport = new StdioServerTransport();
92
92
awaitserver.connect(transport);
93
93
```
94
94
95
-
## DNS rebinding protection
96
-
97
-
MCP servers running on localhost are vulnerable to DNS rebinding attacks. Use `createMcpExpressApp()` from `@modelcontextprotocol/express` to create an Express app with DNS rebinding protection enabled by default:
> For a full runnable example with `ResourceLink` outputs, see [`simpleStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/simpleStreamableHttp.ts).
187
163
188
-
#### Logging
189
-
190
-
Use `ctx.mcpReq.log(level, data)` (from {@linkcode@modelcontextprotocol/server!index.ServerContext | ServerContext}) inside a tool handler to send structured log messages to the client. The server must declare the `logging` capability:
Tools can include annotations that hint at their behavior — for example, whether a tool is read‑only, destructive, or idempotent. Annotations help clients present tools appropriately without changing their execution semantics.
214
167
215
168
> [!NOTE]
216
-
> For logging in a full server, see [`simpleStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/simpleStreamableHttp.ts) and [`jsonResponseStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/jsonResponseStreamableHttp.ts).
217
-
>
218
-
> For protocol details, see [Logging](https://modelcontextprotocol.io/specification/latest/server/utilities/logging) in the MCP specification.
169
+
> For tool annotations in a full server, see [`simpleStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/simpleStreamableHttp.ts).
219
170
220
171
### Resources
221
172
@@ -337,7 +288,37 @@ server.registerPrompt(
337
288
);
338
289
```
339
290
340
-
For client-side completion usage, see the [Client guide](client.md).
291
+
### Logging
292
+
293
+
Unlike tools, resources, and prompts, logging is not a registered primitive — it is a handler-level API available inside any callback. Use `ctx.mcpReq.log(level, data)` (from {@linkcode@modelcontextprotocol/server!index.ServerContext | ServerContext}) to send structured log messages to the client. The server must declare the `logging` capability:
> For logging in a full server, see [`simpleStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/simpleStreamableHttp.ts) and [`jsonResponseStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/jsonResponseStreamableHttp.ts).
320
+
>
321
+
> For protocol details, see [Logging](https://modelcontextprotocol.io/specification/latest/server/utilities/logging) in the MCP specification.
341
322
342
323
## Server‑initiated requests
343
324
@@ -453,6 +434,32 @@ Task-based execution enables "call-now, fetch-later" patterns for long-running o
453
434
> [!WARNING]
454
435
> The tasks API is experimental and may change without notice.
455
436
437
+
## Deployment
438
+
439
+
### DNS rebinding protection
440
+
441
+
MCP servers running on localhost are vulnerable to DNS rebinding attacks. Use `createMcpExpressApp()` from `@modelcontextprotocol/express` to create an Express app with DNS rebinding protection enabled by default:
The sections above cover the essentials. The table below links to additional capabilities demonstrated in the runnable examples.
@@ -463,5 +470,4 @@ The sections above cover the essentials. The table below links to additional cap
463
470
| Session management | Per-session transport routing, initialization, and cleanup |[`simpleStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/simpleStreamableHttp.ts)|
464
471
| Resumability | Replay missed SSE events via an event store |[`inMemoryEventStore.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/inMemoryEventStore.ts)|
465
472
| CORS | Expose MCP headers (`mcp-session-id`, etc.) for browser clients |[`simpleStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/simpleStreamableHttp.ts)|
466
-
| Tool annotations | Hint whether tools are read-only, destructive, etc. |[`simpleStreamableHttp.ts`](https://github.com/modelcontextprotocol/typescript-sdk/blob/main/examples/server/src/simpleStreamableHttp.ts)|
0 commit comments