Class: McpAuthorization::McpController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/mcp_authorization/mcp_controller.rb

Constant Summary collapse

TOOLS_LIST_CACHE_HEADER =

Response header stamped on every cached tools/list path so hosts can log cache behavior: "hit" (served from the store), "miss" (compiled cold and stored), or "bypass" (compiled but not cached — cache had no key for this request, e.g. the domain's decision vocabulary isn't learned yet, or the response wasn't a cacheable result).

"X-MCP-Tools-List-Cache"

Instance Method Summary collapse

Instance Method Details

#handleObject

POST/GET/DELETE /mcp/:domain : () -> void



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/mcp_authorization/mcp_controller.rb', line 14

def handle
  server_context = build_server_context

  if mcp_method == "tools/list" && McpAuthorization::Cache.enabled?
    return render_cached_tools_list(server_context)
  end

  status, headers, body = run_transport(server_context, tools_for_request(server_context))
  apply_headers(headers)
  render json: body.first, status: status
end