Merge pull request #176 from koic/tweak_the_readme_doc_for_stateless

[Doc] Tweak the README for stateless
This commit is contained in:
Koichi ITO 2025-11-20 10:10:31 +09:00 • committed by GitHub
commit 3c452b807c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,7 +126,6 @@ Notifications follow the JSON-RPC 2.0 specification and use these method names:
- **stdio**: Notifications are sent as JSON-RPC 2.0 messages to stdout
- **Streamable HTTP**: Notifications are sent as JSON-RPC 2.0 messages over HTTP with streaming (chunked transfer or SSE)
- **Stateless Streamable HTTP**: Notifications are not supported and all calls are request/response interactions; allows for easy multi-node deployment.
#### Usage Example
@ -136,9 +135,6 @@ server = MCP::Server.new(name: "my_server")
# Default Streamable HTTP - session oriented
transport = MCP::Server::Transports::StreamableHTTPTransport.new(server)
# OR Stateless Streamable HTTP - session-less
transport = MCP::Server::Transports::StreamableHTTPTransport.new(server, stateless: true)
server.transport = transport
# When tools change, notify clients
@ -146,6 +142,15 @@ server.define_tool(name: "new_tool") { |**args| { result: "ok" } }
server.notify_tools_list_changed
```
You can use Stateless Streamable HTTP, where notifications are not supported and all calls are request/response interactions.
This mode allows for easy multi-node deployment.
Set `stateless: true` in `MCP::Server::Transports::StreamableHTTPTransport.new` (`stateless` defaults to `false`):
```ruby
# Stateless Streamable HTTP - session-less
transport = MCP::Server::Transports::StreamableHTTPTransport.new(server, stateless: true)
```
### Unsupported Features ( to be implemented in future versions )
- Log Level