AWS Cognito MCP Server

AWS Cognito MCP Server

site icon
2025.03.24 0
JavaScript身份验证用户管理交流协作
AWS Cognito MCP Server 是一个基于 Model Context Protocol (MCP) 的服务实现,用于连接 AWS Cognito 进行身份验证和用户管理。该服务器提供了一系列工具,支持用户注册、登录、密码管理等认证流程。
View on GitHub

Overview

基本能力

产品定位

AWS Cognito MCP Server 主要用于身份验证和用户管理,通过与 AWS Cognito 集成,提供了一套完整的用户认证解决方案。

核心功能

  • 用户注册 (sign_up)
  • 账户验证 (sign_up_confirm_code_from_email)
  • 用户登录 (sign_in)
  • 用户登出 (sign_out)
  • 获取当前用户信息 (getCurrentUser)
  • 密码重置 (reset_password_send_code, reset_password_veryify_code)
  • 密码更改 (change_password)
  • 会话刷新 (refresh_session)
  • 用户属性更新 (update_user_attributes)
  • 用户删除 (delete_user)
  • 重新发送验证码 (resend_confirmation_code)
  • TOTP MFA 验证 (verify_software_token)

适用场景

  • 需要集成 AWS Cognito 身份验证的应用程序
  • 需要管理用户认证流程的开发项目
  • 需要多因素认证 (MFA) 支持的系统

工具列表

工具名称 描述 参数
sign_up 注册新用户 email: 字符串, password: 字符串
sign_up_confirm_code_from_email 使用确认码验证账户 username: 字符串, confirmationCode: 字符串
sign_in 认证用户 username: 字符串, password: 字符串
sign_out 登出当前用户
getCurrentUser 获取当前登录用户
reset_password_send_code 请求密码重置码 username: 字符串
reset_password_veryify_code 使用验证码重置密码 username: 字符串, code: 字符串, newPassword: 字符串
change_password 更改已登录用户的密码 oldPassword: 字符串, newPassword: 字符串
refresh_session 刷新认证令牌
update_user_attributes 更新用户配置文件属性 attributes: {name: 字符串, value: 字符串} 数组
delete_user 删除当前登录用户
resend_confirmation_code 重新发送账户验证码 username: 字符串
verify_software_token 验证 MFA 的 TOTP username: 字符串, totpCode: 字符串

常见问题解答

  1. 如何调试 MCP 服务器? 使用 npm run inspector 命令启动 MCP 检查器,可以在浏览器中访问调试工具。

  2. 如何配置 AWS Cognito? 需要在 AWS 控制台中创建或使用现有的用户池,并设置环境变量 AWS_COGNITO_USER_POOL_IDAWS_COGNITO_USER_POOL_CLIENT_ID

使用教程

使用依赖

  • AWS 账户并配置了 Cognito 用户池
  • Node.js 18 或更高版本

安装教程

# 克隆仓库
git clone https://github.com/yourusername/mcp-server-aws-cognito.git

# 安装依赖
cd mcp-server-aws-cognito
npm install

# 构建服务器
npm run build

AWS Cognito 配置

  1. 登录 AWS 控制台并导航到 Amazon Cognito
  2. 创建用户池或使用现有用户池
  3. 记录用户池 ID 和应用程序客户端 ID
  4. 将这些值设置为环境变量或在 .env 文件中

调试方式

# 开发模式(自动重建)
npm run watch

# 启动 MCP 检查器进行调试
npm run inspector

许可证

None