Merge pull request #299 from koic/update_rails_controller_example_in_readme
[Doc] Update Rails controller example in README.md
This commit is contained in:
commit
2822e00b62
1 changed files with 3 additions and 2 deletions
|
|
@ -113,7 +113,7 @@ You can use `StreamableHTTPTransport#handle_request` to handle requests with pro
|
|||
status codes (e.g., 202 Accepted for notifications).
|
||||
|
||||
```ruby
|
||||
class McpController < ActionController::Base
|
||||
class McpController < ActionController::API
|
||||
def create
|
||||
server = MCP::Server.new(
|
||||
name: "my_server",
|
||||
|
|
@ -124,7 +124,8 @@ class McpController < ActionController::Base
|
|||
prompts: [MyPrompt],
|
||||
server_context: { user_id: current_user.id },
|
||||
)
|
||||
transport = MCP::Server::Transports::StreamableHTTPTransport.new(server)
|
||||
# Since the `MCP-Session-Id` is not shared across requests, `stateless: true` is set.
|
||||
transport = MCP::Server::Transports::StreamableHTTPTransport.new(server, stateless: true)
|
||||
server.transport = transport
|
||||
status, headers, body = transport.handle_request(request)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue