@glinr/theauth-express
v3.0.2
Published
Express adapter for TheAuth - exposes agent auth as HTTP REST endpoints
Readme
@glinr/theauth-express
Express adapter for TheAuth.
Install
pnpm add theauth @glinr/@glinr/theauth-expressUsage
import express from 'express';
import { createKavach } from '@glinr/theauth';
import { kavachExpress } from '@glinr/theauth-express';
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
const kavach = createKavach({
database: { provider: 'sqlite', url: 'kavach.db' },
});
// Mount all TheAuth routes at /auth
app.use('/auth', kavachExpress(kavach));
app.listen(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 { kavachExpress } from '@glinr/theauth-express';
const mcp = createMcpModule({
issuer: 'https://your-app.com',
// ...
});
app.use('/auth', kavachExpress(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
kavachExpress(kavach, options?) returns an Express Router. Pass it to app.use() 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
