sign_up
Register new users by creating AWS Cognito accounts with email and password credentials for application authentication.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | |||
| password | Yes |
Implementation Reference
- index.ts:19-117 (handler)The complete implementation of the 'sign_up' MCP tool. It registers the tool with input schema for email and password, and the handler function creates a new user in AWS Cognito User Pool, handles signup callback for success/error, formats responses as content arrays with details like userSub, confirmation status, timestamps, and instructs to check email for code.server.tool( "sign_up", { password: z.string(), email: z.string(), }, async ({ password, email }) => { try { const attributeList: CognitoUserAttribute[] = []; const dataEmail = { Name: 'email', Value: email, }; const attributeEmail = new CognitoUserAttribute(dataEmail); attributeList.push(attributeEmail); return new Promise((resolve, reject) => { userPool.signUp(email, password, attributeList, attributeList, (err, result) => { if (err) { console.error('Error signing up:', err); reject({ content: [ { type: "text" as const, text: `Signup failed: ${err.message}`, }, { type: "text" as const, text: `Error code: ${(err as any).code || 'Unknown'}`, }, { type: "text" as const, text: `Email used: ${email}`, }, { type: "text" as const, text: `Password length: ${password.length} characters`, }, { type: "text" as const, text: `Time: ${new Date().toISOString()}`, } ] }); } resolve({ content: [ { type: "text" as const, text: "User created successfully", }, { type: "text" as const, text: `User ID: ${result?.userSub}`, }, { type: "text" as const, text: `Username: ${result?.user.getUsername()}`, }, { type: "text" as const, text: `Email: ${email}`, }, { type: "text" as const, text: `Confirmation required: ${!result?.userConfirmed}`, }, { type: "text" as const, text: `Time: ${new Date().toISOString()}`, }, { type: "text" as const, text: "Check your email for the confirmation code", } ], }); }); }); } catch (error: any) { return { content : [ { type: "text" as const, text: `Error setting AWS Cognito credentials: ${error.message}`, }, { type: "text" as const, text: `Stack trace: ${error.stack?.substring(0, 200) || 'Not available'}...`, }, { type: "text" as const, text: `Time: ${new Date().toISOString()}`, } ] } } } )
- index.ts:21-24 (schema)Input schema for the sign_up tool using Zod, validating 'password' and 'email' as strings.{ password: z.string(), email: z.string(), },