Reference
Every option, DSL method, annotation tag, and lifecycle detail.
One page per section of the project README.
- Three layers of authorization
The gem gives you three independent controls over what each user sees:
- Install
Routes install automatically at /mcp. No mount needed.
- Configuration
Two configuration methods (not attributes) turn a domain into grouped facades โ see Tool grouping:
- The contract
The gem has two opinions about your app:
- Quick example
Define reusable types as .rbs files. These are plain RBS -- no comment markers.
- Handler interface
A handler includes McpAuthorization::DSL and implements two methods:
- @requires rules
On input params -- the param is excluded from the input schema when can? returns false. Tag them in the #: annotation above def call:
- Shared types
Define reusable types as .rbs files in sig/shared/ (configurable via shared_type_paths):
- Tool DSL
authorization :perm is just a convenience for gate :requires, :perm โ internally there is one gate pipeline, not two. Multiple gate declarations AND together...
- Contract validation
If a handler is missing required methods or schema definitions, the gem raises an ArgumentError on first request with a full diagnostic:
- Multi-domain routing
Tag a tool with multiple domains to make it available in each:
- Tool grouping (facades)
As a domain grows into the hundreds of tools, a flat tools/list spends the
- RBS type syntax
The @rbs type comments compile to JSON Schema:
- Performance
Source files are parsed once at boot and cached in memory. Only @requires filtering runs per request (hash lookups and can? calls). In development, caches ar...
- Caching tools/list
tools/list must materialize a per-user schema for every tool in a domain. That cost can be cached. Default is no caching, so nothing changes unless you opt in:
- Development
In development mode, the gem wires into the Rails reloader. Edit an @rbs type annotation, save, and the next MCP request returns the updated schema. No serve...
- How it works
Different users hitting the same endpoint can see different tools, different descriptions, different input fields, and different output shapes.
- Stateless transport and schema lifetime
The gem uses the MCP SDK's Streamable HTTP transport in stateless mode. Each HTTP request creates a fresh MCP::Server, materialized with tools filtered and s...
- Requirements
- License
MIT
Collected from README.md in the repository. Edit it there, not here.