Skip to main content

How adapters work

The kavachos package has zero framework dependencies. It operates entirely on the Web platform Request/Response API. Adapter packages wrap the core and expose framework-idiomatic handlers for authentication, authorization, and MCP OAuth routes. Because the core uses only Web platform APIs, KavachOS runs on edge runtimes without modification: Next.js Edge Runtime, Cloudflare Workers, Deno Deploy, Vercel Edge Functions, and Bun. The Hono and SvelteKit adapters are fully edge-compatible out of the box. The Next.js adapter works on edge when you use export const runtime = 'edge' in your route file. Each adapter follows the same pattern: accept a kavach instance, optionally accept a config object, and return something your framework knows how to mount.
Pass mcp to the adapter to enable all MCP OAuth 2.1 endpoints under the same mount path.

Available adapters

Endpoints registered

All adapters register the same set of REST routes under basePath (default /api/kavach): When mcp is passed, additional endpoints are registered:

Using without an adapter

If your framework is not listed, use the core handler directly. It works with any server that handles standard Request objects.
handleRequest returns null when the request URL does not match any KavachOS route, so your own handlers run normally for all other paths.

Choose your framework

Hono

Lightweight, fast, runs everywhere.

Express

The most widely used Node.js framework.

Next.js

App Router with catch-all route handler.

Fastify

High-performance with plugin architecture.

Nuxt

Vue-based with H3 server routes.

SvelteKit

Svelte with +server.ts handlers.

Astro

Content-focused with API routes.
Last modified on April 29, 2026