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

64 lines (63 loc) 2.71 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.runCli = runCli; const commander_1 = require("commander"); const logger_util_js_1 = require("../utils/logger.util.js"); const constants_util_js_1 = require("../utils/constants.util.js"); const aws_sso_auth_cli_js_1 = __importDefault(require("./aws.sso.auth.cli.js")); const aws_sso_accounts_cli_js_1 = __importDefault(require("./aws.sso.accounts.cli.js")); const aws_sso_exec_cli_js_1 = __importDefault(require("./aws.sso.exec.cli.js")); const config_util_js_1 = require("../utils/config.util.js"); /** * CLI entry point for the AWS SSO MCP Server * Handles command registration, parsing, and execution */ // Create a logger instance for this module const cliLogger = logger_util_js_1.Logger.forContext('cli/index.ts'); /** * Run the CLI with provided arguments * * @param args Command line arguments * @returns A promise that resolves when the CLI command completes */ async function runCli(args) { cliLogger.debug('Initializing CLI with arguments', { argsCount: args.length, }); // Load and parse configuration config_util_js_1.config.load(); // Set up the program const program = new commander_1.Command(); program .name(constants_util_js_1.CLI_NAME) .description('MCP Server CLI for AWS SSO') .version(constants_util_js_1.VERSION); // Same as the server version // Register CLI commands cliLogger.debug('Registering CLI commands...'); // Register AWS SSO auth CLI commands aws_sso_auth_cli_js_1.default.register(program); cliLogger.debug('Registered AWS SSO authentication CLI commands'); // Register AWS SSO accounts CLI commands aws_sso_accounts_cli_js_1.default.register(program); cliLogger.debug('Registered AWS SSO accounts CLI commands'); // Register AWS SSO exec CLI commands aws_sso_exec_cli_js_1.default.register(program); cliLogger.debug('Registered AWS SSO exec CLI commands'); cliLogger.debug('CLI commands registered successfully'); // Execute the CLI cliLogger.debug('Parsing CLI arguments'); // Handle unknown commands program.on('command:*', (operands) => { cliLogger.error(`Unknown command: ${operands[0]}`); console.log(''); program.help(); process.exit(1); }); // Parse arguments; default to help if no command provided await program.parseAsync(args.length ? args : ['--help'], { from: 'user' }); cliLogger.debug('CLI command execution completed'); } exports.default = { runCli };