authkestra
The Compile-Time Safe Identity & AI Agent Authorization Engine for Rust
authkestra is the primary facade crate for the Authkestra ecosystem. It unifies enterprise-grade identity (OAuth 2.1, OpenID Connect Provider/Client, Passkeys/WebAuthn, TOTP, Passwordless, DPoP, SD-JWT, SSF/CAEP) and autonomous AI agent tool authorization (Model Context Protocol (MCP) server guards, JCS cryptographic parameter binding, HITL step-up approval, and zero-trust downstream credential brokering) into a single, cohesive, compile-time safe Rust crate.
🚀 Key Highlights
- Compile-Time Safe Typestate Builder: Unrepresented or invalid auth configurations fail at compile-time, not in production.
- Unified Facade: Manage your entire identity and agent authorization stack from a single dependency via fine-grained Cargo feature flags.
- Autonomous AI Agent & MCP Security (
authkestra-mcp): Protect Model Context Protocol tool endpoints with 3-tier authorization (Public,Scoped,HumanApproved), RFC 8785 JSON Canonicalization Scheme (JCS) parameter binding, Passkey/WebAuthn human-in-the-loop (HITL) step-up approval, and AES-256-GCM zero-trust downstream credential vaults. - Framework Adapters: First-class, ergonomic integrations for both Axum (
authkestra-axum) and Actix Web (authkestra-actix). - Database & Schema Agnostic: No forced schemas or rigid user tables. Bring your own database via clean trait abstractions (
KvStore,SessionStore,CredentialStore,OpStore). - Production-Ready Tracing & Security: Full
tracinginstrumentation across all request lifecycles, timing-safe cryptographic comparisons, and single-useAtomicConsumeexecution proofs.
📦 Installation
Add authkestra to your Cargo.toml with the features you need:
[]
# Example: Axum web application with GitHub OAuth2 and in-memory store
= { = "0.13", = ["axum", "github", "memory"] }
Or for an MCP server protecting AI agent tool calls:
[]
# Example: Axum MCP server with Model Context Protocol security & Passkeys
= { = "0.13", = ["axum", "mcp", "webauthn", "memory"] }
🔐 TLS Backend
Authkestra requires an HTTPS crypto provider to speak to identity providers and token endpoints:
| Feature | Description |
|---|---|
rustls-aws-lc-rs |
Default. Fast, hardware-accelerated crypto provider via aws-lc-rs. Requires a C toolchain. |
rustls-no-provider |
Pure-Rust builds (ring) or custom environments where aws-lc-rs is banned by cargo-deny. |
🛠️ Quickstart
1. Web Application Authentication (Axum + OAuth2)
use Authkestra;
use MemoryStore;
use ;
use GithubProvider;
use Arc;
async
2. AI Agent MCP Server Guard (authkestra::mcp)
Protect your Model Context Protocol (MCP) server endpoints with granular security tiers, cryptographic parameter binding, and human-in-the-loop approval:
use ;
use ReproofRequirement;
use ;
use Arc;
;
// Build the MCP security router
let mut router = new;
// Register a high-risk tool requiring Passkey step-up and JCS parameter binding
router.register_tool;
Run the complete, runnable Axum MCP server example:
🧩 Feature Flags Reference
| Feature | Category | Description |
|---|---|---|
full |
Meta | Enables all capabilities across the engine, OIDC, OP, MCP, Passkeys, TOTP, and providers. |
mcp |
AI / Agent | Embedded Model Context Protocol security guard, RFC 8785 JCS parameter binding, HITL step-up approval, and zero-trust token vault. |
engine |
Core | Core authentication engine orchestrator, flows, sessions, and credentials. |
oidc |
Protocols | OpenID Connect discovery caching, ID token validation, and client flow. |
resource |
Protocols | OAuth 2.0 / 2.1 resource server verification (JWT validation, scope checks, DPoP). |
op |
Protocols | OpenID Connect Provider / Authorization Server implementation. |
devsig |
Protocols | Device-bound signature authentication (proof-of-possession). |
ssf |
Protocols | Shared Signals Framework & CAEP event ingestion. |
policy |
Authorization | Proof-of-concept AWS Cedar authorization policy engine. |
axum |
Framework | Axum adapter (authkestra-axum) with extractors and MCP router. |
actix |
Framework | Actix Web adapter (authkestra-actix) with ActixState macro and MCP scope. |
github |
Providers | Pre-configured GitHub OAuth 2.0 provider. |
google |
Providers | Pre-configured Google OpenID Connect provider. |
discord |
Providers | Pre-configured Discord OAuth 2.0 provider. |
webauthn |
Auth Methods | Passkeys and WebAuthn hardware security keys. |
totp |
Auth Methods | Time-based One-Time Passwords (RFC 6238). |
magic-link |
Auth Methods | Passwordless email login links. |
otp |
Auth Methods | Numeric email/SMS one-time codes. |
recovery-codes |
Auth Methods | Factor-agnostic backup lookup codes (NIST SP 800-63B). |
captcha |
Security | Cloudflare Turnstile and Google reCAPTCHA v3 bot protection. |
memory |
Storage | In-memory store for development and testing. |
redis |
Storage | High-performance Redis session and token store. |
sql-postgres |
Storage | PostgreSQL store backed by SQLx. |
sql-sqlite |
Storage | SQLite store backed by SQLx. |
sql-mysql |
Storage | MySQL / MariaDB store backed by SQLx. |
rustls-aws-lc-rs |
TLS | Default. Rustls with AWS-LC-RS crypto provider. |
rustls-no-provider |
TLS | Rustls without crypto provider (install ring manually). |
🧠 AI Discoverability & Claude Code Skills (llms.txt)
- Agent Index:
https://authkestra.com/llms.txt - Full API Documentation:
https://docs.authkestra.com/llms-full.txt - Official Skills Repository:
https://github.com/Authkestra/skillsfor Claude Code, Antigravity, and Roo Code agent integration.
📜 License
Dual-licensed under MIT or Apache 2.0 at your option.