agent-auth-mcp

โดย better-auth

ใช้เครื่องมือ Agent Auth MCP เพื่อค้นหาผู้ให้บริการ เชื่อมต่อเอเจนต์ จัดการความสามารถ และดำเนินการผ่านโปรโตคอล MCP ใช้เมื่อทำงาน…

npx skills add https://github.com/better-auth/agent-auth --skill agent-auth-mcp

Agent Auth MCP Tools

You have access to Agent Auth MCP tools for interacting with Agent Auth providers. Always prefer using these MCP tools for any agent authentication operations rather than making raw HTTP requests or writing custom code.

Starting the MCP Server

The MCP server is part of the CLI:

auth-agent mcp

Or with pre-configured providers:

auth-agent mcp --url https://api.example.com

Cursor / Claude Desktop configuration

{
  "mcpServers": {
    "auth-agent": {
      "command": "npx",
      "args": ["@auth/agent-cli", "mcp", "--url", "https://api.example.com"]
    }
  }
}

Available Tools

The MCP server exposes 17 tools. Follow the numbered workflow below.

Step 1: Discovery — Find a Provider

ToolParametersWhen to use
list_providers(none)Call this first. Lists all discovered/configured providers.
search_providersintent (required)Search the directory by name or intent (e.g. "deploy web apps", "vercel").
discover_providerurl (required)Look up a specific provider by URL. Only use if list/search didn't help.

Always start with list_providers. If empty, use search_providers or discover_provider.

Step 2: Capabilities — Understand What's Available

ToolParametersWhen to use
list_capabilitiesprovider (required), query, agent_id, limit, cursorList capabilities for a provider.
describe_capabilityprovider, name (required), agent_idGet full definition including input schema. Always call before executing.

Step 3: Connect — Authenticate an Agent

ToolParametersWhen to use
connect_agentprovider (required), capabilities, mode, name, reason, preferred_method, login_hint, binding_message, force_newConnect an agent to a provider. Returns agent_id.

Key parameters:

  • capabilities — Array of capability names to request.
  • mode"delegated" (acts for a user, default) or "autonomous" (independent).
  • preferred_method"device_authorization" (default, opens browser) or "ciba" (backchannel notification).
  • login_hint — User email for CIBA flow.
  • force_new — Create a new connection even if one exists.

Step 4: Use the Agent

ToolParametersWhen to use
execute_capabilityagent_id, capability (required), argumentsExecute a granted capability.
agent_statusagent_id (required)Check agent status, grants, and constraints.
sign_jwtagent_id (required), capabilities, audienceSign an agent JWT for manual use.
request_capabilityagent_id, capabilities (required), reason, preferred_method, login_hint, binding_messageRequest additional capabilities.
disconnect_agentagent_id (required)Revoke an agent.
reactivate_agentagent_id (required)Reactivate an expired agent.

Host Management

ToolParametersWhen to use
enroll_hostprovider, enrollment_token (required), nameEnroll a host with a one-time token.
rotate_agent_keyagent_id (required)Rotate an agent's keypair.
rotate_host_keyissuer (required)Rotate the host keypair for a provider.

Workflow Example

Here is the standard workflow for connecting to a provider and executing a capability:

1. list_providers
   → See what providers are already known

2. search_providers({ intent: "deploy web apps" })
   → Find a provider if none are known (or discover_provider with a URL)

3. list_capabilities({ provider: "https://api.example.com" })
   → See what the provider offers

4. describe_capability({ name: "deploy_app", provider: "https://api.example.com" })
   → Understand the input schema before executing

5. connect_agent({ provider: "https://api.example.com", capabilities: ["deploy_app"], name: "deploy-bot" })
   → Authenticate and get an agent_id
   → If approval is required, the user will be prompted

6. agent_status({ agent_id: "..." })
   → Confirm the agent is active and capabilities are granted

7. execute_capability({ agent_id: "...", capability: "deploy_app", arguments: { app: "my-app", env: "production" } })
   → Run the capability with the correct arguments

Important Rules

  • Never make raw HTTP requests to Agent Auth endpoints. Always use MCP tools.
  • Always call list_providers first. This tells you what's already configured.
  • Always call describe_capability before execute_capability. You need the input schema.
  • Always call agent_status after connect_agent. The agent may be pending approval.
  • Save the agent_id returned by connect_agent — every subsequent tool needs it.
  • Use constraints when connecting to limit agent permissions — pass them in the capabilities parameter as objects with name and constraints fields.
  • Handle approval flows. When connect_agent returns approval info (device code URL or CIBA), the user must approve before the agent becomes active. Poll agent_status to check.
  • Errors return structured objects like { error: "message", code: "error_code" } — check these and retry or adjust accordingly.

Capability Constraints

When connecting, you can restrict what an agent can do with its capabilities:

{
  "provider": "https://api.example.com",
  "capabilities": [
    "read_data",
    {
      "name": "transfer_money",
      "constraints": {
        "amount": { "max": 1000, "min": 1 },
        "currency": { "in": ["USD", "EUR"] }
      }
    }
  ]
}

Constraint types: eq (exact match), min/max (numeric bounds), in/not_in (allowed/blocked values).

When to Use CLI vs MCP

  • Use MCP tools when operating inside an MCP-enabled environment (Cursor, Claude Code, Claude Desktop) — the tools are already available and integrated.
  • Use the CLI when running from a terminal directly, scripting, or when MCP is not available.
  • Both expose the same operations and share the same storage (~/.agent-auth/).

Skills เพิ่มเติมจาก better-auth

agent-auth-cli
better-auth
ใช้ Agent Auth CLI (auth-agent) เพื่อค้นหาผู้ให้บริการ เชื่อมต่อเอเจนต์ จัดการความสามารถ และดำเนินการต่างๆ ใช้เมื่อผู้ใช้ต้องการโต้ตอบ...
official
better-icons
better-auth
ค้นหาและเรียกคืน SVG จากคลังไอคอนกว่า 200 แห่ง พร้อมการผสานรวม CLI และเซิร์ฟเวอร์ MCP รองรับการค้นหาข้ามคอลเลกชันหลัก (Lucide, Material Design Icons, Heroicons, Tabler และอื่นๆ อีกกว่า 200 แห่ง) พร้อมการกรองตามคำนำหน้าและจำกัดผลลัพธ์ คำสั่ง CLI สำหรับค้นหาไอคอน ดาวน์โหลดเป็นชุดไฟล์ SVG และเรียกคืนไอคอนเดี่ยวพร้อมปรับแต่งสีและขนาด เครื่องมือเซิร์ฟเวอร์ MCP สำหรับเอเจนต์ AI รวมถึงคำแนะนำอัจฉริยะ การจับคู่ความคล้ายคลึง การสแกนโปรเจกต์ และการประมวลผลไอคอนเป็นชุด...
official
better-auth-best-practices
better-auth
การตั้งค่าเซิร์ฟเวอร์และไคลเอนต์ Better Auth ที่สมบูรณ์ พร้อมอะแดปเตอร์ฐานข้อมูล การจัดการเซสชัน ปลั๊กอิน และการกำหนดค่าความปลอดภัย ครอบคลุมเวิร์กโฟลว์ทั้งหมดตั้งแต่การติดตั้งไปจนถึงการย้ายฐานข้อมูล การตั้งค่าตัวแปรสภาพแวดล้อม และการสร้างตัวจัดการเส้นทางในหลายเฟรมเวิร์ก รองรับอะแดปเตอร์ฐานข้อมูลหลายตัว (Prisma, Drizzle, MongoDB, การเชื่อมต่อโดยตรง) พร้อมคำแนะนำสำคัญเกี่ยวกับหลักการตั้งชื่อโมเดลกับตาราง รวมถึงกลยุทธ์การจัดเก็บเซสชันด้วยพื้นที่จัดเก็บรอง (Redis/KV), คุกกี้...
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 พร้อมคิวอาร์โค้ด), รหัสทางอีเมล/SMS (OTP) และรหัสสำรองแบบใช้ครั้งเดียว จัดการขั้นตอนการเข้าสู่ระบบ 2FA แบบสมบูรณ์ด้วยการจัดการเซสชันอัตโนมัติ คุกกี้ 2FA ชั่วคราว และการติดตามอุปกรณ์ที่เชื่อถือได้พร้อมกำหนดวันหมดอายุได้ มีคุณสมบัติความปลอดภัยในตัวรวมถึงการจำกัดอัตรา (3 คำขอต่อ 10 วินาที) และการเข้ารหัสขณะจัดเก็บสำหรับข้อมูลลับ...
official