UNPKG

@aashari/mcp-server-aws-sso

Version:

Node.js/TypeScript MCP server for AWS Single Sign-On (SSO). Enables AI systems (LLMs) with tools to initiate SSO login (device auth flow), list accounts/roles, and securely execute AWS CLI commands using temporary credentials. Streamlines AI interaction w

55 lines (54 loc) 2.59 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const logger_util_js_1 = require("../utils/logger.util.js"); const error_util_js_1 = require("../utils/error.util.js"); const aws_sso_accounts_controller_js_1 = __importDefault(require("../controllers/aws.sso.accounts.controller.js")); /** * AWS SSO Accounts CLI Module * * Provides CLI commands for listing and exploring AWS accounts and roles * available through AWS SSO. Commands for viewing account details and roles * require valid AWS SSO authentication. */ // Create a module logger const cliLogger = logger_util_js_1.Logger.forContext('cli/aws.sso.accounts.cli.ts'); // Log module initialization cliLogger.debug('AWS SSO accounts CLI module initialized'); /** * Register AWS SSO accounts CLI commands * @param program Commander program instance */ function register(program) { const registerLogger = logger_util_js_1.Logger.forContext('cli/aws.sso.accounts.cli.ts', 'register'); registerLogger.debug('Registering AWS SSO accounts CLI commands'); registerListAccountsCommand(program); registerLogger.debug('AWS SSO accounts CLI commands registered'); } /** * Register the list-accounts command * @param program Commander program instance */ function registerListAccountsCommand(program) { program .command('ls-accounts') .description('List all AWS accounts and roles accessible to you through AWS SSO. This command displays each account\'s ID, name, email, and all available roles you can assume. The information is essential for the "exec-command" command. The command handles pagination internally and caches results for better performance. Prerequisites: You must first authenticate using the "login" command.') .action(async () => { const listLogger = logger_util_js_1.Logger.forContext('cli/aws.sso.accounts.cli.ts', 'ls-accounts'); try { listLogger.debug('Listing all AWS accounts and roles'); // Call controller with no options const result = await aws_sso_accounts_controller_js_1.default.listAccounts(); // Directly print the content from the controller console.log(result.content); } catch (error) { listLogger.error('List-accounts command failed', error); (0, error_util_js_1.handleCliError)(error); } }); } // Export the register function exports.default = { register };