本项目是一个实现Model Context Protocol(MCP)协议的服务器,它可连接到AWS Cognito进行身份验证和用户管理。该服务器提供了一系列实用工具,能高效处理包括注册、登录、密码管理等在内的用户认证流程。
# 克隆仓库
git clone https://github.com/yourusername/mcp-server-aws-cognito.git
# 安装依赖项
cd mcp-server-aws-cognito
npm install
# 构建服务器
npm run build
AWS_COGNITO_USER_POOL_ID=your-user-pool-id
AWS_COGNITO_USER_POOL_CLIENT_ID=your-app-client-id
属性 | 详情 |
---|---|
工具名称 | 描述 |
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 |
重新发送账户验证代码 |
verify_software_token |
验证TOTP进行双重身份验证 |
参数 | 详情 |
---|---|
sign_up |
email : string, password : string |
sign_up_confirm_code_from_email |
username : string, confirmationCode : string |
sign_in |
username : string, password : string |
sign_out |
无 |
getCurrentUser |
无 |
reset_password_send_code |
username : string |
reset_password_veryify_code |
username : string, code : string, newPassword : string |
change_password |
oldPassword : string, newPassword : string |
refresh_session |
无 |
update_user_attributes |
attributes : Array of {name: string, value: string} |
delete_user |
无 |
resend_confirmation_code |
username : string |
verify_software_token |
username : string, totpCode : string |
Inspector将在您的浏览器中提供一个URL来访问调试工具。
在使用之前,请确保Node.js已安装在您的桌面上,以便npx正常工作。
claude_desktop_config.json
:{
"mcpServers": {
"aws-cognito-mcp-server": {
"command": "/path/to/mcp-server-aws-cognito/build/index.js",
"env": {
"AWS_COGNITO_USER_POOL_ID": "your-user-pool-id",
"AWS_COGNITO_USER_POOL_CLIENT_ID": "your-app-client-id"
}
}
}
}
Claude Code是Claude的命令行界面。要使用此MCP服务器与Claude Code一起使用:
claude mcp add "aws-cognito-mcp" npx tsx index.ts
claude mcp list
claude
使用自动重建进行开发:
npm run watch
由于MCP服务器通过stdio通信,调试可能具有挑战性。使用MCP Inspector获得更好的可见性:
npm run inspector
现在您可以使用AWS Cognito身份验证工具与Claude一起工作!