Class: Resque::Mcp::EndpointController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- Resque::Mcp::EndpointController
- Defined in:
- app/controllers/resque/mcp/endpoint_controller.rb
Instance Method Summary collapse
Instance Method Details
#handle ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/resque/mcp/endpoint_controller.rb', line 8 def handle # Rack 3 input may not be rewindable: read before the transport does. @raw_jsonrpc_body = request.raw_post server = ServerFactory.build(environment: Rails.env.to_s) config = Resque::Mcp.config # Passthrough first; our security-critical keys override, so nothing # in mcp_transport_options can weaken the DNS-rebinding posture. = config..merge( stateless: true, enable_json_response: true, dns_rebinding_protection: true, allowed_hosts: config.allowed_hosts, allowed_origins: config.allowed_origins ) transport = ::MCP::Server::Transports::StreamableHTTPTransport.new(server, **) status, headers, body = transport.handle_request(request) render_transport_response(status, headers, body) end |
#method_not_allowed ⇒ Object
28 29 30 |
# File 'app/controllers/resque/mcp/endpoint_controller.rb', line 28 def method_not_allowed head :method_not_allowed end |