Skip to content
glinckerPublic

About

Auth for AI agents and humans. First-class agent identity, MCP OAuth 2.1, delegation, audit. TypeScript, edge-native, MIT.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

24 stars

Watchers

2 watching

Forks

Latest commit

 

History

402 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

theAuth for TypeScript (this repository) theAuth for Go

theAuth, a TypeScript auth library for people and AI agents: agent identity, delegation, audit, MCP OAuth 2.1, passkeys and SSO

theAuth: TypeScript auth library

Self-hosted auth for people and AI agents. Each agent gets its own token, scoped permissions, delegation and an audit trail, in your app and your database.

npm CI CodeQL OpenSSF Scorecard License: MIT GitHub stars

npm install @glinr/theauth@1.2.0

Quickstart · Security · Status · Compare · Docs

Quickstart

Needs Node 20 or newer. Save as quickstart.mjs and run node quickstart.mjs. It uses an in-memory SQLite database.

import { createTheAuth, users } from "@glinr/theauth";

const auth = await createTheAuth({
  database: { provider: "sqlite", url: ":memory:" },
  agents: { enabled: true },
});

// Every agent has a human owner.
const now = new Date();
await auth.db.insert(users).values({
  id: "user-1", email: "owner@example.com", name: "Owner", createdAt: now, updatedAt: now,
});

const agent = await auth.agent.create({
  ownerId: "user-1",
  name: "github-reader",
  type: "autonomous",
  permissions: [{ resource: "mcp:github:*", actions: ["read"] }],
});

const read = await auth.authorize(agent.id, { action: "read", resource: "mcp:github:repos" });
const write = await auth.authorize(agent.id, { action: "write", resource: "mcp:github:repos" });
console.log(read.allowed, write.allowed); // true false
console.log(write.reason); // why it was denied

agent.token is returned when the agent is created. Next: the documentation and examples. Both follow this repository, which is ahead of npm (see Status).

What it solves

Your problem What theAuth does
Agents share one API key with full access Gives each agent its own token and a list of allowed actions and resources
A sub-agent needs part of its parent's access Delegates a subset with an expiry; revoking the parent cuts it off
You cannot tell what an agent did Writes an audit row for each authorization, with an optional hash chain
Some actions need a person to say yes A permission can require approval before it passes
MCP clients expect OAuth 2.1 Ships MCP authorization server functions in @glinr/theauth/mcp

Features

Everything in this table is exported by @glinr/theauth 1.2.0 on npm.

Area What you get
Agents Agent tokens, rotation, revocation, permissions with constraints, delegation, approvals, budget policies
Audit Query and export, optional tamper-evident chain with verification
MCP and OAuth MCP authorization server, token exchange, DPoP proof checks, client ID metadata documents
Sign-in Magic links, email codes, phone, username and password, 48 OAuth providers and presets
Passkeys and MFA WebAuthn passkeys and TOTP
Teams and SSO Organizations, admin, API keys, OIDC SSO, SCIM, SAML (experimental)
Storage SQLite and Postgres through Drizzle, Cloudflare D1 binding
Moving in User import and lazy password migration in @glinr/theauth/migrate

Status

Checked against the npm registry on 2026-12-03. Details and the full package list: what npm serves.

Area State
@glinr/theauth 1.2.0 on npm. This repository is at 2.0.0, which is not published
Only in the repository Built-in email and password, auth.user, the @glinr/theauth/http handler and the other 2.0.0 changes
Framework adapters, email and gateway packages Published, but they accept core below 1.0. Installing an adapter or the email package together with core makes npm pick core 0.8.0
@glinr/theauth-cli Version 1.2.0 on npm does not install
@glinr/theauth-client, @glinr/theauth-mcp 1.1.1 on npm, install cleanly
SAML Experimental, no independent audit
Databases SQLite is tested in CI. Postgres is run by hand, D1 is untested, MySQL is not supported (details)

Version rules are in STABILITY.md.

How it compares

theAuth 1.2.0 Better Auth Auth.js Clerk Auth0
Runs as Library Library or self-hosted server Library Hosted service Hosted service
Passkeys Yes Plugin Experimental Paid in production Yes
SAML Experimental Plugin Through BoxyHQ Paid in production Yes
OAuth server for MCP Yes Plugin Yes Yes
Agent identity Yes Plugin, not yet stable Agents act as the user Early access
Hosted dashboard Paid add-on Yes Yes

A blank cell means we did not verify it. Sources, retrieval dates and when each of the others is the better pick: docs/COMPARISON.md. Also read when not to use theAuth.

Trust and security

Check it yourself Where
Private vulnerability reporting, or support@glinr.com Security policy
Tests, CodeQL, OSV scan, dependency review, Scorecard Workflows
610 test files under packages/ (counted 2026-12-03) packages
npm provenance attestation on @glinr/theauth 1.2.0 npm
MIT license, governance and maintainers License, Governance, Maintainers

Know before you adopt: the first commit is dated 2026-03-21 and there has been no third party security audit.

Contribute

Formerly kavachOS: see the rename map. The Go library is glincker/theauth-go.

Made by

Built by GLINCKER, a GLINR STUDIOS company. More from the team:

GLINR Studios
Open source from the team behind theAuth

Levelrail

Self-hosted deployment platform. Git push, HTTPS, logs, rollback.

theSVG

Open SVG brand library with logos, icons and flags.

About

Auth for AI agents and humans. First-class agent identity, MCP OAuth 2.1, delegation, audit. TypeScript, edge-native, MIT.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

24 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages