@glinr/theauth-hono
v3.0.2
Published
Hono adapter for TheAuth - exposes agent auth as HTTP REST endpoints
Readme
@glinr/theauth-hono
Hono adapter for TheAuth.
Install
pnpm add theauth @glinr/@glinr/theauth-honoUsage
import { serve } from '@hono/node-server';
import { Hono } from 'hono';
import { createKavach } from '@glinr/theauth';
import { kavachHono } from '@glinr/theauth-hono';
const kavach = createKavach({
database: { provider: 'sqlite', url: 'kavach.db' },
});
const app = new Hono();
// Mount all TheAuth routes at /api/kavach
app.route('/api/kavach', kavachHono(kavach));
serve({ fetch: app.fetch, port: 3000 });This mounts the full TheAuth REST API: agent CRUD, authorization, delegations, audit logs, and dashboard stats.
With MCP OAuth 2.1
import { createMcpModule } from '@glinr/theauth/mcp';
import { kavachHono } from '@glinr/theauth-hono';
const mcp = createMcpModule({
issuer: 'https://your-app.com',
// ...
});
app.route('/api/kavach', kavachHono(kavach, { mcp }));When mcp is provided, the OAuth 2.1 endpoints are enabled:
GET /.well-known/oauth-authorization-serverGET /.well-known/oauth-protected-resourcePOST /mcp/registerGET /mcp/authorizePOST /mcp/token
API surface
kavachHono(kavach, options?) returns a Hono instance with all routes registered. Pass it to app.route() with your chosen prefix.
| Option | Type | Description |
|--------|------|-------------|
| mcp | McpAuthModule | Enables MCP OAuth 2.1 endpoints |
For full docs on agent identity, permissions, delegation, and audit, see the main @glinr/theauth package.
Links
License
MIT
