You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract and update the shared auth crate so generated Rust MCP servers can support the auth patterns currently used by jmagar/axon, jmagar/labby, jmagar/cortex, and rmcp-template without copying product-specific policy into the shared layer.
This issue intentionally rolls in the standalone-auth extraction scope from #66. Treat this as the canonical implementation issue for the shared auth crate.
Current findings
Lab's labby-auth is the strongest donor because it already has feature boundaries for core auth, Axum HTTP, and upstream OAuth/RMCP support.
Axon's axon-authz shows the desired separation: product-specific scopes and policy should live outside the shared auth crate.
rmcp-template already has local auth behavior and tests that should migrate to the shared crate through a thin template-local policy wrapper.
Locked decisions
Shared auth mechanics belong in the new crate; product scopes, env prefixes, route policy, and service-specific authorization rules belong in thin per-server wrappers.
The crate must be usable without Axum unless an HTTP/Axum feature is enabled.
The crate must not depend on gateway, Code Mode, traces, OpenAPI, or product runtime crates.
Preserve loopback development ergonomics.
Preserve trusted gateway/no-auth deployment modes, but make the trust boundary explicit.
OAuth metadata must reflect enabled routes and registration behavior accurately.
Requirements
Inventory auth capabilities in jmagar/axon, jmagar/labby, and jmagar/cortex.
Support static bearer tokens, trusted gateway/no-auth deployment modes, OAuth/JWT flows, upstream OAuth/RMCP support, and scope enforcement used across those services.
Provide feature-gated core, HTTP/Axum, Google OAuth, and upstream OAuth/RMCP support.
Provide adapters or migration guidance for existing rmcp-family servers.
Replace Lab-branded defaults with host-supplied configuration.
Keep token, route, metadata, and storage behavior testable without live credentials.
Known blockers to fix
TOKEN_ENCRYPTION_KEY is parsed and SQLite supports keyed open, but AuthState::new still opens SQLite without passing the key.
Configurable login/callback paths exist but route mounting hardcodes /auth/login and /auth/google/callback.
Metadata advertises registration_endpoint even when dynamic registration is disabled.
Lab-branded defaults remain in shared auth surfaces.
Cortex docs/code around /register and dynamic registration should be reconciled before treating Cortex behavior as precedent.
Acceptance criteria
New/extracted auth crate has feature-gated core, HTTP/Axum, Google OAuth, and upstream OAuth/RMCP support.
No product-specific scope names, env prefixes, branded defaults, or route policies are baked into the shared crate.
The shared auth crate can replace the service-local auth behavior needed by Axon, Labby, Cortex, and rmcp-template.
rmcp-template consumes the crate through a thin template-local policy wrapper.
Generated template services can opt into supported auth modes through documented configuration.
Token encryption configuration is actually wired into the storage layer.
Goal
Extract and update the shared auth crate so generated Rust MCP servers can support the auth patterns currently used by
jmagar/axon,jmagar/labby,jmagar/cortex, and rmcp-template without copying product-specific policy into the shared layer.This issue intentionally rolls in the standalone-auth extraction scope from #66. Treat this as the canonical implementation issue for the shared auth crate.
Current findings
labby-authis the strongest donor because it already has feature boundaries for core auth, Axum HTTP, and upstream OAuth/RMCP support.axon-authzshows the desired separation: product-specific scopes and policy should live outside the shared auth crate.Locked decisions
Requirements
jmagar/axon,jmagar/labby, andjmagar/cortex.Known blockers to fix
TOKEN_ENCRYPTION_KEYis parsed and SQLite supports keyed open, butAuthState::newstill opens SQLite without passing the key./auth/loginand/auth/google/callback.registration_endpointeven when dynamic registration is disabled./registerand dynamic registration should be reconciled before treating Cortex behavior as precedent.Acceptance criteria
Sources
/home/jmagar/workspace/lab/crates/labby-auth/Cargo.toml:15— current feature split./home/jmagar/workspace/lab/crates/labby-auth/src/config.rs:274— parameterizedAuthConfigBuilder./home/jmagar/workspace/lab/crates/labby-auth/src/state.rs:115— auth state opens SQLite store./home/jmagar/workspace/rmcp-template/crates/rtemplate-auth/src/config.rs:386— token encryption key parsing./home/jmagar/workspace/rmcp-template/crates/rtemplate-auth/src/sqlite.rs:49— keyed SQLite open support./home/jmagar/workspace/rmcp-template/crates/rtemplate-auth/src/routes.rs:15— hardcoded route mounting./home/jmagar/workspace/rmcp-template/crates/rtemplate-auth/src/metadata.rs:6— registration endpoint metadata./home/jmagar/workspace/axon/crates/axon-authz/src/lib.rs:9— thin product authz wrapper./home/jmagar/workspace/cortex/src/runtime.rs:1260— Cortex auth policy construction.Supersedes
Implementation phases
Inventory donor auth behavior.
Define shared crate API.
Port storage and metadata behavior.
Integrate rmcp-template.
Add migration docs and tests.
Local files likely touched
crates/rtemplate-auth/*crates/rtemplate-runtime/src/server.rscrates/rmcp-template/src/main.rscrates/rmcp-template/src/routes.rscrates/rtemplate-contracts/src/config.rscrates/*/testsor crate-local*_tests.rsrelease/components.tomlif the shared auth crate becomes independently versionedRisks