agent-auth-cli
作者: better-auth
使用 Agent Auth CLI(auth-agent)发现提供商、连接代理、管理能力并执行操作。当用户希望交互时使用…
npx skills add https://github.com/better-auth/agent-auth --skill agent-auth-cliAgent Auth CLI
You have access to the auth-agent CLI for interacting with Agent Auth providers. Always prefer using the CLI for any agent authentication operations rather than making raw HTTP requests or writing custom code.
Binary
The CLI binary is auth-agent (package: @auth/agent-cli). If not installed globally, run via npx @auth/agent-cli.
Workflow
Follow this order when working with a provider:
1. Discover or find a provider
# If you have the provider URL
auth-agent discover https://api.example.com
# If you need to search by intent
auth-agent search "deploy web apps"
# List already-known providers
auth-agent providers
discoverfetches the/.well-known/agent-configurationdocument and caches the provider.searchqueries the directory and returns matching providers.- Always discover or search first before connecting.
2. Explore capabilities
# List all capabilities for a provider
auth-agent capabilities --provider https://api.example.com
# Filter by query
auth-agent capabilities --provider https://api.example.com --query "transfer"
# Get full definition with input schema
auth-agent describe transfer_money --provider https://api.example.com
- Always run
describebefore executing a capability to understand the required input schema and constraints. - If connected, pass
--agent-id <id>to see which capabilities are granted.
3. Connect an agent
# Basic connection with specific capabilities
auth-agent connect --provider https://api.example.com \
--capabilities read_data transfer_money \
--name my-agent
# With constraints on capability arguments
auth-agent connect --provider https://api.example.com \
--capabilities read_data transfer_money \
--constraints '{"transfer_money":{"amount":{"max":1000}}}' \
--name constrained-agent
# Autonomous mode (no user association)
auth-agent connect --provider https://api.example.com \
--capabilities read_data \
--mode autonomous
# With CIBA approval (backchannel, sends notification to user)
auth-agent connect --provider https://api.example.com \
--capabilities read_data \
--preferred-method ciba \
--login-hint [email protected]
- Save the returned
agent_id— you need it for all subsequent operations. - If approval is required, the CLI opens the browser or prints the approval URL. Pass
--no-browserto suppress browser opening. - Use
--force-newto create a new connection even if one exists.
4. Check status
auth-agent status <agent-id>
- Shows agent status (
pending_approval,active,expired,revoked), granted capabilities, and constraints. - Run this after connecting to confirm the agent was approved.
5. Execute capabilities
auth-agent execute <agent-id> transfer_money \
--args '{"amount": 50, "to": "alice"}'
- The
--argsflag takes a JSON string matching the capability's input schema. - Always
describethe capability first to know the required arguments.
6. Request additional capabilities
auth-agent request <agent-id> \
--capabilities admin_panel \
--constraints '{"admin_panel":{"scope":{"in":["read","write"]}}}' \
--reason "Need admin access for deployment"
7. Lifecycle management
# Disconnect (revoke) an agent
auth-agent disconnect <agent-id>
# Reactivate an expired agent
auth-agent reactivate <agent-id>
# View stored connection details
auth-agent connection <agent-id>
# List all connections for a provider
auth-agent connections <issuer-url>
8. Key rotation
# Rotate an agent's keypair
auth-agent rotate-agent-key <agent-id>
# Rotate the host keypair for a provider
auth-agent rotate-host-key <issuer-url>
9. Host enrollment
auth-agent enroll-host --provider https://api.example.com --token <enrollment-token> --name "My Device"
10. Sign JWTs manually
# Sign an agent JWT (for use with external HTTP calls)
auth-agent sign <agent-id>
# Scope to specific capabilities
auth-agent sign <agent-id> --capabilities transfer_money read_data
Global Flags
| Flag | Env var | Description |
|---|---|---|
--storage-dir <path> | AGENT_AUTH_STORAGE_DIR | Storage directory (default: ~/.agent-auth) |
--directory-url <url> | AGENT_AUTH_DIRECTORY_URL | Directory URL for provider search |
--host-name <name> | AGENT_AUTH_HOST_NAME | Host name for identification |
--no-browser | AGENT_AUTH_NO_BROWSER=1 | Suppress browser opening for approval URLs |
--url <urls...> | AGENT_AUTH_URLS | Provider URLs to auto-discover at startup |
Important Rules
- Never make raw HTTP requests to Agent Auth endpoints. Always use the CLI.
- Always discover before connecting. The CLI needs the provider's configuration cached locally.
- Always describe before executing. Check the input schema so you pass correct arguments.
- Check status after connecting. The agent may require user approval before it becomes active.
- Store agent IDs. You need them for execute, status, request, disconnect, and all other operations.
- Use constraints when connecting to limit what the agent can do — this is a security best practice.
- Set
AGENT_AUTH_ENCRYPTION_KEYin production to encrypt private keys stored in~/.agent-auth/.
Storage
Connections, keys, and provider configs are stored in ~/.agent-auth/ by default:
host.json— host identity and keypairagents/<agent-id>.json— agent connectionsproviders/<encoded-issuer>.json— cached provider configurations
来自 better-auth 的更多技能
agent-auth-mcp
better-auth
使用Agent Auth MCP工具发现提供商、连接代理、管理能力,并通过MCP协议执行操作。在处理……时使用。
official
better-icons
better-auth
通过命令行界面和MCP服务器集成,从200多个图标库中搜索并获取SVG图标。支持在主要图标集合(Lucide、Material Design Icons、Heroicons、Tabler等200多个)中进行搜索,可按前缀和结果数量进行筛选。提供命令行指令用于搜索图标、批量下载SVG文件,以及获取可自定义颜色和大小的单个图标。MCP服务器工具为AI代理提供智能推荐、相似度匹配、项目扫描和批量图标处理等功能。
official
better-auth-best-practices
better-auth
完整的Better Auth服务器与客户端配置,涵盖数据库适配器、会话管理、插件及安全配置。覆盖从安装到数据库迁移、环境变量设置以及跨多个框架的路由处理器创建的完整工作流程。支持多种数据库适配器(Prisma、Drizzle、MongoDB、直连),并提供关于模型与表命名约定的关键指导。包含会话存储策略(Redis/KV辅助存储)、Cookie...
official
create-auth-skill
better-auth
在TypeScript/JavaScript应用中搭建并实现认证功能,包括Better Auth框架检测、数据库适配器配置和OAuth集成。通过项目扫描检测框架(Next.js、SvelteKit、Nuxt、Astro、Express、Hono)、数据库(Prisma、Drizzle、MongoDB、原生驱动)及现有认证库。支持邮箱/密码、OAuth(Google、GitHub、Apple、Microsoft、Discord、Twitter)、魔法链接、通行密钥和手机认证,并支持可配置的邮箱验证...
official
Email & Password Best Practices
better-auth
email-&-password-best-practices — 一个可安装的AI代理技能,由better-auth/skills发布。
official
email-and-password-best-practices
better-auth
电子邮件验证、密码重置流程以及可自定义的密码策略,适用于Better Auth。支持电子邮件验证,可选择强制要求验证通过后才能登录,并支持可配置的令牌过期时间和一次性重置令牌。密码重置流程内置安全机制:后台发送邮件、防止时序攻击、对无效请求执行虚拟操作,以及重置时可选择撤销会话。可配置密码长度限制(默认8-256个字符)及自定义...
official
organization-best-practices
better-auth
通过 Better Auth 实现多租户组织设置,包含成员管理、基于角色的访问控制和团队支持。配置组织时可自定义创建规则、成员限制和所有权约束;创建者自动获得所有者角色。管理成员和邀请,支持邮件发送、有效期设置和可分享的邀请链接;每个成员可拥有多个角色。定义自定义角色和权限,实现动态访问控制;检查权限...
official
two-factor-authentication-best-practices
better-auth
使用TOTP、OTP、备份码和可信设备管理实现Better Auth的多因素认证。支持三种验证方式:身份验证器应用(含二维码的TOTP)、电子邮件/短信验证码(OTP)以及一次性备份码。处理完整的2FA登录流程,包含自动会话管理、临时2FA Cookie以及可配置过期时间的可信设备追踪。内置安全功能包括速率限制(每10秒3次请求)和静态加密密钥保护。
official