Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt

Use this file to discover all available pages before exploring further.

Auth for AI agents. KavachOS gives every agent its own identity, checks permissions at call time, and writes an audit row for every decision. Plugs in after your human auth (Clerk, Auth.js, better-auth, or your own). Runs on Node, edge, Workers, Deno, and Bun.

Quickstart

Agent in five minutes.

npm install

npm i kavachos
import { createKavach } from 'kavachos';

const kavach = await createKavach({
  database: { provider: 'sqlite', url: 'kavach.db' },
});

const agent = await kavach.agent.create({
  ownerId: user.id,
  name: 'code-reviewer',
  type: 'autonomous',
  permissions: [
    { resource: 'mcp:github:*', actions: ['read'] },
  ],
});

const { allowed, auditId } = await kavach.authorize(agent.id, {
  action: 'read',
  resource: 'mcp:github:repos',
});

What’s in the box

Agent identity as a first-class entity, not an extension of a user.
Resource wildcards with rate limits, time windows, and IP allowlists.
Delegation chains with depth, expiry, and cascading revocation.
Append-only audit with JSON and CSV export.
MCP OAuth 2.1 authorization server, PKCE and DCR built in.
Trust scoring per agent with anomaly detection and budget caps.
Ten adapters for Node, edge, Workers, Deno, Bun.
Four databases: SQLite, Postgres, MySQL, Cloudflare D1.
Web Crypto only in core, no Node-specific APIs.

How it fits with your stack

KavachOS does not replace your human auth. It does not handle login forms, password resets, or social OAuth for users. It starts where human auth ends, at the point your product spins up an agent to act on a user’s behalf.

Pick your framework

https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/nextdotjs.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=f0cc7e25920e30e38244119c094828b9

Next.js

App Router and Pages.
https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/hono.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=7239faee8b017493e32eac94989a3939

Hono

Workers, Deno, Bun.
https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/express.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=817f8590ed8c4e37cce5618f6ceace1c

Express

Classic Node handlers.
https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/fastify.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=c7737f2ec89270f83729ffee9e1763b9

Fastify

Plugins and decorators.
https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/nestjs.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=236e06766e1bf716ff0a20f20e63991d

NestJS

Guards and decorators.
https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/nuxt.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=bf06e0d2f934f93e36dd97e57b8da5ba

Nuxt

Server routes.
https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/svelte.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=8935cc45c851159f1f0cbcdefb73e2aa

SvelteKit

Hooks and endpoints.
https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/astro.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=9fa26c4cf28d569b45a36fbd07ef7c1c

Astro

Server islands.

The six primitives

Agent identity

Bearer tokens (kv_...), rotation, expiry. SHA-256 hashed at rest.

Permission engine

Resource wildcards, rate limits, time windows, IP allowlists, approval gates.

Delegation

Orchestrator delegates a subset to a sub-agent with depth and expiry. Revocation cascades.

Audit trail

Every authorize() writes agent, user, resource, action, result, duration.

MCP OAuth 2.1

Spec-compliant AS with PKCE S256, RFC 9728, RFC 7591.

Trust scoring

Nine-factor score per agent. Anomaly detection and budget policies on top.

Switching from another auth library

From better-auth

Concepts map, code diffs, data migration SQL.

From Clerk

Hooks, middleware, Clerk data export, rollout plan.
New releases land on GitHub every week or two. Watch the repo or follow @thegdsks for the highlights.
Last modified on April 20, 2026