@glinr/theauth-mcp server is read-only by default. Add --allow-writes (or set THEAUTH_ALLOW_WRITES=1) to register four write tools. Each write needs human approval.
Embed as a library
Host the server in your own process instead of spawning the CLI. Import from@glinr/theauth-mcp.
Read tools
Always registered:list_agents, get_agent, list_delegations, list_sessions, query_audit, check_permission, inspect_token, doctor and get_approval_status. Tokens and secret-looking fields are redacted.
Write tools
Approval flow
Writes use the approval flow. No write runs on the first call.1
Request
The client calls the tool with the targetid. The server logs the request, opens an approval (for example admin:revoke_agent on agent:abc) and returns { "status": "pending", "approvalId": "..." }.2
Approve
A human approves or denies through your normal approval channel.3
Retry
The client pollsget_approval_status, or calls the same tool again with approvalId.4
Run
If the approval is approved and unexpired, the server spends it and runs the change. Otherwise nothing runs.Audit
WithTHEAUTH_MCP_ACTOR set (default theauth-mcp), every call is logged as admin_mcp.<tool> with that actor. Writes log each step: requested, pending, executed, denied or failed.
Deployment routes
Core ships these routes as an opt-in plugin,adminApi. It is off unless enabled is exactly true. When it is off, every route answers 404.
Limits
- Calls need an
Authorization: Bearercredential for a user inadminUserIds. Bad credentials get 401, other users get 403, and an empty list refuses everyone. Cookie-only requests are refused. systemAgentIdmust be an existing agent. TheagentIdanduserIdthe MCP server sends are labels and are ignored. The approval belongs to the calling admin.- Approval actions must look like
admin:<name>. Only the admin who opened an approval can consume it. Approving is four-eyes: the admin who opened a request cannot approve or deny it (403SELF_APPROVAL) unlessallowSelfApproval: true. Each decision writes anadmin_api.approval.approveor.denyaudit event. - The dashboard Approvals page calls these routes, so it needs an app that serves
/api/approvalswith the signed-in admin’s Bearer token. Thetheauth dashboardCLI server signs in with one shared secret, has no admin identity, and cannot use the page. A decision is audited after it is applied, so a failed audit write does not undo it. - An approval is single use and tied to one action and one resource.
- If the audit write for a new request fails, the request is not opened.
- Admins cannot disable themselves or other configured admins, unless
allowDisablingAdminsis set. - Requests are rate limited per admin user. Ids, enums and body sizes are validated.