10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/admin_suite/mcp_controller.rb', line 10
def create
return head :not_found unless AdminSuite.config.mcp.enabled
return head :unauthorized unless admin_suite_actor
return head :method_not_allowed unless request.post?
AdminSuite::DefinitionLoader.load!(:resources)
server = AdminSuite::Mcp.server_for(actor: admin_suite_actor, request: request)
transport = ::MCP::Server::Transports::StreamableHTTPTransport.new(
server, stateless: true, allowed_hosts: [request.host]
)
status, , body = transport.handle_request(request)
self.status = status
.each { |name, value| response.(name, value) }
self.response_body = body
end
|