Skip to main content
Glama
gitCarrot

AWS Cognito MCP Server

by gitCarrot

sign_out

Log out users from AWS Cognito sessions to terminate authentication and secure access control.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function retrieves the current Cognito user, signs them out using cognitoUser.signOut(), and returns success or no-user messages with details.
    async ({ }) => {
        const cognitoUser = userPool.getCurrentUser();
        if (cognitoUser) {
            const username = cognitoUser.getUsername();
            cognitoUser.signOut();
            return {
                content: [
                    {
                        type: "text" as const,
                        text: "Signed out successfully",
                    },
                    {
                        type: "text" as const,
                        text: `Username: ${username}`,
                    },
                    {
                        type: "text" as const,
                        text: `Time: ${new Date().toISOString()}`,
                    },
                    {
                        type: "text" as const,
                        text: "All tokens have been invalidated",
                    }
                ]
            };
        } else {
            return {
                content: [
                    {
                        type: "text" as const,
                        text: "No user was signed in",
                    }
                ]
            };
        }
    }
  • Input schema for the sign_out tool: empty object, indicating no input parameters are required.
    {
    },
  • index.ts:119-159 (registration)
    Full registration of the sign_out tool via server.tool(), specifying the name, empty input schema, and inline handler function.
    server.tool(
        "sign_out",
        {
        },
        async ({ }) => {
            const cognitoUser = userPool.getCurrentUser();
            if (cognitoUser) {
                const username = cognitoUser.getUsername();
                cognitoUser.signOut();
                return {
                    content: [
                        {
                            type: "text" as const,
                            text: "Signed out successfully",
                        },
                        {
                            type: "text" as const,
                            text: `Username: ${username}`,
                        },
                        {
                            type: "text" as const,
                            text: `Time: ${new Date().toISOString()}`,
                        },
                        {
                            type: "text" as const,
                            text: "All tokens have been invalidated",
                        }
                    ]
                };
            } else {
                return {
                    content: [
                        {
                            type: "text" as const,
                            text: "No user was signed in",
                        }
                    ]
                };
            }
        }
    )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gitCarrot/mcp-server-aws-cognito'

If you have feedback or need assistance with the MCP directory API, please join our Discord server