Class: McpAuthorization::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- McpAuthorization::Engine
- Defined in:
- lib/mcp_authorization/engine.rb
Overview
Rails Engine that wires the gem into a host application.
The engine handles three things automatically so the host app doesn’t have to:
-
*Autoload paths* — tool directories (default
app/mcp) are added to the Rails autoloader so tool and handler classes are discovered without explicit requires. -
*Cache invalidation* — on code reload (development mode) the ToolRegistry and RbsSchemaCompiler caches are cleared. Tools re-register themselves via the
inheritedhook when their classes are reloaded. -
*Route mounting* — MCP endpoints are prepended to the host app’s router at
config.mount_path(default/mcp). The routes support multi-domain routing via an optional:domainsegment:POST /mcp → default domain POST /mcp/operator → "operator" domain POST /mcp/recruiting → "recruiting" domainAll three HTTP methods required by the MCP StreamableHTTP transport (GET, POST, DELETE) are accepted.