Configuration
Two configuration methods (not attributes) turn a domain into grouped facades โ see Tool grouping:
# config/initializers/mcp_authorization.rb
McpAuthorization.configure do |config|
config.server_name = "my-app"
config.server_version = "1.0.0"
# Build a context from each MCP request.
# Return anything that responds to .current_user.can?(symbol).
config.context_builder = ->(request) {
user = User.authenticate(request.headers["Authorization"])
OpenStruct.new(current_user: user)
}
endOptions๐
| Option | Default | Description |
|---|---|---|
server_name | "mcp-authorization" | Name in MCP handshake |
server_version | "1.0.0" | Version in MCP handshake |
mount_path | "/mcp" | URL prefix for MCP endpoints |
default_domain | "default" | Domain when no :domain segment in path |
tool_paths | ["app/mcp"] | Directories where tool classes live (relative to Rails.root) |
tool_producers | [] | Callables that register tool classes built at runtime โ see Generated tools |
shared_type_paths | ["sig/shared"] | Directories where shared .rbs type files live |
context_builder | required | (request) -> context |
cli_context_builder | nil | (domain:, role:) -> context for rake tasks |
strict_schema | false | Emit stricter compiled schemas |
tools_list_cache | nil | :memory, :redis, or any object responding to get/set โ see Caching tools/list |
tools_list_cache_ttl | 3600 | Per-entry TTL in seconds |
tools_list_cache_redis | nil | Explicit Redis client for the :redis store |
tools_list_cache_redis_url | nil | Explicit Redis URL; falls back to ENV["REDIS_URL"], then Redis.new |
Two configuration methods (not attributes) turn a domain into grouped facades โ see Tool grouping:
| Method | Purpose |
|---|---|
facet_domain :domain, group_by: :category, ... | Present this domain as one facade tool per category. Optional schema_strategy:, uncategorized:, facade_suffix:. |
categories { summary :key, "text" } | Declare one summary line per group, used as each facade description's lead. |
Collected from README.md in the repository. Edit it there, not here.