SuperAPI AI 工具集

cloud-auth

安全与审计

查看项目

更新于 10-16 06:10

技能介绍

用途

cloud-auth 用于处理 Flow Nexus 平台的用户身份认证、注册、会话管理和账户操作。它通过 MCP 服务器 flow-nexus 暴露一组工具,供调用方完成登录、注册、密码重置、邮箱验证、资料更新和订阅层级升级等任务。

主要能力

  • 认证状态:检查当前认证状态(可返回详细信息),初始化认证模式(user 或 service)。
  • 用户注册:使用邮箱、密码(至少 8 位)、可选用户名和全名注册新用户,返回 user_id、email、verification_sent。
  • 登录/登出:使用邮箱和密码登录,返回 user_id、token、expires_at、tier;登出返回 success。
  • 资料管理:获取用户资料(id、email、full_name、tier、created_at),更新资料(如 full_name、bio、github_username、website),获取用户统计(apps_published、credits_earned、challenges_completed)。
  • 密码管理:请求密码重置(发送邮件),使用重置令牌更新密码。
  • 邮箱验证:使用验证令牌验证邮箱,返回 verified。
  • 层级升级:将用户升级到 pro 或 enterprise,返回 new_tier、effective_date。

使用方式

前置条件:已配置 MCP 服务器 flow-nexus;注册需要有效邮箱地址;密码需满足安全要求。

典型认证流程:注册 → 验证邮箱 → 登录 → 会话激活 → 登出;忘记密码时可走重置密码流程。

核心调用示例(保留原始代码):

// Register a new user
await mcp__flow-nexus__user_register({
  email: "user@example.com",
  password: "secure_password",
  full_name: "User Name"
});

// Login
const session = await mcp__flow-nexus__user_login({
  email: "user@example.com",
  password: "secure_password"
});

// Check auth status
const status = await mcp__flow-nexus__auth_status({ detailed: true });

// Logout
await mcp__flow-nexus__user_logout();

其他工具调用形式:

mcp__flow-nexus__auth_init({ mode: "user" });

mcp__flow-nexus__user_register({
  email: "user@example.com",
  password: "secure_password",
  username: "username",
  full_name: "Full Name"
});

mcp__flow-nexus__user_profile({ user_id: "user_id" });

mcp__flow-nexus__user_update_profile({
  user_id: "user_id",
  updates: {
    full_name: "New Name",
    bio: "Developer",
    github_username: "username"
  }
});

mcp__flow-nexus__user_stats({ user_id: "user_id" });

mcp__flow-nexus__user_reset_password({ email: "user@example.com" });

mcp__flow-nexus__user_update_password({
  token: "reset_token",
  new_password: "new_secure_password"
});

mcp__flow-nexus__user_verify_email({ token: "verification_token" });

mcp__flow-nexus__user_upgrade({
  user_id: "user_id",
  tier: "pro"
});

适用场景

  • 在 Flow Nexus 平台注册新用户
  • 登录现有用户并管理会话
  • 重置忘记的密码
  • 验证邮箱地址
  • 更新用户资料和账户设置
  • 升级用户订阅层级
  • 排查认证问题

用户层级

层级 积分 功能
Free 100/月 基础功能、社区支持
Pro 1000/月 优先访问、邮件支持
Enterprise 无限 专用资源、SLA

会话管理

  • 会话基于令牌
  • 不活跃后自动过期
  • 安全登出会清除会话数据

限制与注意事项

  • 需要预先配置 MCP 服务器 flow-nexus。
  • 注册需要有效邮箱,密码至少 8 位。
  • 邮箱未验证时无法访问相关功能。
  • 会话令牌过期后需重新登录。
  • 密码重置令牌无效或过期时需重新请求。
  • 未登录时调用受保护操作会返回 unauthorized。

错误处理

错误 原因 解决方案
registration_failed 邮箱无效或密码过弱 验证邮箱格式,增强密码
login_failed 凭据错误或邮箱未验证 检查凭据,验证邮箱
session_expired 令牌过期 重新登录
email_not_verified 账户未验证 检查邮箱中的验证链接
password_reset_failed 令牌无效或过期 请求新的重置链接
unauthorized 未登录 先登录

最佳实践

  • 使用 8 位以上、包含字母、数字和符号的强密码
  • 访问功能前始终验证邮箱
  • 完成后登出,尤其是在共享设备上
  • 完善个人资料以获得更好体验
  • 定期更改密码
  • 在可用时启用双因素认证

集成点

  • 与用户工具集成:登录后配置用户设置,如更新偏好。
  • 与支付集成:登录后检查余额。

相关技能

  • cloud-user-tools:资料与存储管理
  • cloud-payments:积分与计费

安全指南

  • 切勿分享密码,必要时使用密码重置
  • 检查 URL,确认位于官方 Flow Nexus 站点
  • 报告可疑活动,立即联系支持
  • 保护与账户关联的邮箱
  • 在公共设备上登出,清除共享计算机上的会话

版本历史

1.0.0(2026-01-02):初始版本,由 flow-nexus-auth agent 转换而来。