Commit 7e0a339
committed
[Doc] Fix Rails controller example to return 202 for notifications
The previous example used `Server#handle_json` directly, which does not control HTTP status codes.
Notifications such as `notifications/initialized` require 202 Accepted per the MCP spec,
but the example always returned 200.
Use `StreamableHTTPTransport#handle_request` instead, which returns the correct HTTP status code
for each request type.
- https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#sending-messages-to-the-server
- https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#sending-messages-to-the-server
Closes #1581 parent 5b04089 commit 7e0a339
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | | - | |
249 | | - | |
| 249 | + | |
| 250 | + | |
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
| |||
256 | 257 | | |
257 | 258 | | |
258 | 259 | | |
259 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
| |||
0 commit comments