这是一个实现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 | 注册新用户 | 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: 字符串 |
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 Code 文档中的说明安装Claude Code
将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!