Transform how you manage and access your AWS infrastructure by connecting Claude, Cursor AI, and other AI assistants directly to your AWS accounts through AWS IAM Identity Center (formerly AWS SSO). Get instant access to your cloud resources, execute commands, and manage EC2 instances using natural language. ✅ Ask AI about your AWS accounts: "Show me all my AWS accounts and available roles" ✅ Exec
Add this skill
npx mdskills install aashari/mcp-server-aws-ssoWell-documented AWS SSO integration enabling AI assistants to manage multi-account AWS environments
1# Connect AI to Your AWS Resources23Transform how you manage and access your AWS infrastructure by connecting Claude, Cursor AI, and other AI assistants directly to your AWS accounts through AWS IAM Identity Center (formerly AWS SSO). Get instant access to your cloud resources, execute commands, and manage EC2 instances using natural language.45[](https://www.npmjs.com/package/@aashari/mcp-server-aws-sso)6[](https://www.npmjs.com/package/@aashari/mcp-server-aws-sso)78## What You Can Do910✅ **Ask AI about your AWS accounts**: *"Show me all my AWS accounts and available roles"*11✅ **Execute AWS commands**: *"List all S3 buckets in my production account"*12✅ **Manage EC2 instances**: *"Check the disk usage on server i-123456789"*13✅ **Access multi-account setups**: *"Switch to the staging account and describe the VPCs"*14✅ **Monitor resources**: *"Get the status of all running EC2 instances"*15✅ **Run shell commands**: *"Execute 'df -h' on my web server via SSM"*1617## Perfect For1819- **DevOps Engineers** managing multi-account AWS environments and infrastructure automation20- **Cloud Architects** needing quick access to resource information across AWS accounts21- **Developers** who want to check deployments and run AWS CLI commands through AI22- **SRE Teams** monitoring and troubleshooting AWS resources using natural language23- **IT Administrators** managing EC2 instances and executing remote commands securely24- **Anyone** who wants to interact with AWS using conversational AI2526## Quick Start2728Get up and running in 2 minutes:2930### 1. Get Your AWS SSO Setup3132Set up AWS IAM Identity Center:331. **Enable AWS IAM Identity Center** in your AWS account342. **Configure your identity source** (AWS directory, Active Directory, or external IdP)353. **Set up permission sets** and assign users to AWS accounts364. **Note your AWS SSO Start URL** (e.g., `https://your-company.awsapps.com/start`)3738### 2. Try It Instantly3940```bash41# Set your AWS SSO configuration42export AWS_SSO_START_URL="https://your-company.awsapps.com/start"43export AWS_REGION="us-east-1"4445# Start the authentication flow46npx -y @aashari/mcp-server-aws-sso login4748# List your accessible accounts and roles49npx -y @aashari/mcp-server-aws-sso ls-accounts5051# Execute an AWS command52npx -y @aashari/mcp-server-aws-sso exec-command \53 --account-id 123456789012 \54 --role-name ReadOnly \55 --command "aws s3 ls"56```5758## Connect to AI Assistants5960### For Claude Desktop Users6162Add this to your Claude configuration file (`~/.claude/claude_desktop_config.json`):6364```json65{66 "mcpServers": {67 "aws-sso": {68 "command": "npx",69 "args": ["-y", "@aashari/mcp-server-aws-sso"],70 "env": {71 "AWS_SSO_START_URL": "https://your-company.awsapps.com/start",72 "AWS_REGION": "us-east-1"73 }74 }75 }76}77```7879Restart Claude Desktop, and you'll see "🔗 aws-sso" in the status bar.8081### For Other AI Assistants8283Most AI assistants support MCP. Install the server globally:8485```bash86npm install -g @aashari/mcp-server-aws-sso87```8889Then configure your AI assistant to use the MCP server with STDIO transport.9091### Alternative: Configuration File9293Create `~/.mcp/configs.json` for system-wide configuration:9495```json96{97 "aws-sso": {98 "environments": {99 "AWS_SSO_START_URL": "https://your-company.awsapps.com/start",100 "AWS_REGION": "us-east-1",101 "DEBUG": "false"102 }103 }104}105```106107**Alternative config keys:** The system also accepts `"@aashari/mcp-server-aws-sso"` or `"mcp-server-aws-sso"` instead of `"aws-sso"`.108109## Real-World Examples110111### 🔐 Authenticate and Explore112113Ask your AI assistant:114- *"Log into AWS SSO and show me my authentication status"*115- *"List all my AWS accounts and the roles I can assume"*116- *"Check if I'm still authenticated to AWS"*117- *"Show me which AWS accounts I have access to"*118119### 🛠️ Execute AWS Commands120121Ask your AI assistant:122- *"List all S3 buckets in my production account using the ReadOnly role"*123- *"Show me all running EC2 instances in the us-west-2 region"*124- *"Describe the VPCs in my staging AWS account"*125- *"Get the status of my RDS databases in account 123456789012"*126127### 🖥️ Manage EC2 Instances128129Ask your AI assistant:130- *"Check the disk usage on EC2 instance i-1234567890abcdef0"*131- *"Run 'uptime' on my web server via Systems Manager"*132- *"Execute 'systemctl status nginx' on instance i-abc123 in production"*133- *"Get memory usage from all my application servers"*134135### 🔍 Infrastructure Monitoring136137Ask your AI assistant:138- *"List all Lambda functions in my development account"*139- *"Show me the CloudFormation stacks in us-east-1"*140- *"Check the health of my load balancers"*141- *"Get the latest CloudWatch alarms that are in ALARM state"*142143### 🔄 Multi-Account Operations144145Ask your AI assistant:146- *"Switch to account 987654321098 with AdminRole and list all security groups"*147- *"Compare the running instances between staging and production accounts"*148- *"Check backup policies across all my AWS accounts"*149- *"Audit IAM users in the security account"*150151<details>152<summary><b>MCP Tool Examples (Click to expand)</b></summary>153154### `aws_sso_login`155156**Basic Login:**157```json158{}159```160161**Custom Login Options:**162```json163{164 "launchBrowser": false165}166```167168### `aws_sso_status`169170**Check Authentication Status:**171```json172{}173```174175### `aws_sso_ls_accounts`176177**List All Accounts and Roles:**178```json179{}180```181182### `aws_sso_exec_command`183184**List S3 Buckets:**185```json186{187 "accountId": "123456789012",188 "roleName": "ReadOnly",189 "command": "aws s3 ls"190}191```192193**Describe EC2 Instances in a Specific Region:**194```json195{196 "accountId": "123456789012",197 "roleName": "AdminRole",198 "command": "aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType]' --output table",199 "region": "us-west-2"200}201```202203### `aws_sso_ec2_exec_command`204205**Check System Resources:**206```json207{208 "instanceId": "i-0a69e80761897dcce",209 "accountId": "123456789012",210 "roleName": "InfraOps",211 "command": "uptime && df -h && free -m"212}213```214215</details>216217## Transport Modes218219This server supports two transport modes for different integration scenarios:220221### STDIO Transport (Default for MCP Clients)222- Traditional subprocess communication via stdin/stdout223- Ideal for local AI assistant integrations (Claude Desktop, Cursor AI)224- Uses pipe-based communication for direct MCP protocol exchange225226```bash227# Run with STDIO transport (default for AI assistants)228TRANSPORT_MODE=stdio npx @aashari/mcp-server-aws-sso229230# Using npm scripts (after installation)231npm run mcp:stdio232```233234### HTTP Transport (Default for Server Mode)235- Modern HTTP-based transport with Server-Sent Events (SSE)236- Supports multiple concurrent connections237- Better for web-based integrations and development238- Runs on port 3000 by default (configurable via PORT env var)239- Endpoint: http://localhost:3000/mcp240- Health check: http://localhost:3000/241242```bash243# Run with HTTP transport (default when no CLI args)244TRANSPORT_MODE=http npx @aashari/mcp-server-aws-sso245246# Using npm scripts (after installation)247npm run mcp:http248249# Test with MCP Inspector250npm run mcp:inspect251```252253### Environment Variables254255**Transport Configuration:**256- `TRANSPORT_MODE`: Set to `stdio` or `http` (default: `http` for server mode, `stdio` for MCP clients)257- `PORT`: HTTP server port (default: 3000)258- `DEBUG`: Enable debug logging (default: false)259260**AWS Configuration:**261- `AWS_SSO_START_URL`: Your AWS IAM Identity Center start URL (e.g., `https://your-org.awsapps.com/start`)262- `AWS_SSO_REGION` or `AWS_REGION`: AWS region for SSO authentication (e.g., `us-east-1`)263- `AWS_PROFILE`: AWS profile name (optional, for CLI compatibility)264265## Available Tools266267When integrated with AI assistants via MCP, the following tools are available:268269### Authentication Tools270271- **`aws_sso_login`**: Initiates AWS SSO device authorization flow272 - Parameters: `launchBrowser` (optional, boolean, default: true)273 - Opens browser automatically for authentication274 - Handles device authorization code flow275 - Caches tokens for subsequent operations276277- **`aws_sso_status`**: Checks current authentication status278 - No parameters required279 - Returns session details and expiration time280 - Verifies cached token validity281282### Account Management Tools283284- **`aws_sso_ls_accounts`**: Lists all accessible AWS accounts and roles285 - No parameters required286 - Shows account IDs, names, emails, and available roles287 - Essential for discovering which accounts/roles you can use288289### Command Execution Tools290291- **`aws_sso_exec_command`**: Executes AWS CLI commands with SSO credentials292 - Required: `accountId`, `roleName`, `command`293 - Optional: `region`294 - Automatically obtains and caches temporary credentials295 - Supports any AWS CLI command296297- **`aws_sso_ec2_exec_command`**: Executes shell commands on EC2 instances via SSM298 - Required: `instanceId`, `accountId`, `roleName`, `command`299 - Optional: `region`300 - No SSH access required (uses AWS Systems Manager)301 - Instance must have SSM Agent installed302303## CLI Commands304305All tools are also available as CLI commands using `kebab-case`. Run `--help` for details (e.g., `mcp-aws-sso login --help`).306307- **login**: Authenticates via AWS SSO (`--no-launch-browser`). Ex: `mcp-aws-sso login`.308- **status**: Checks authentication status (no options). Ex: `mcp-aws-sso status`.309- **ls-accounts**: Lists accounts/roles (no options). Ex: `mcp-aws-sso ls-accounts`.310- **exec-command**: Runs AWS CLI command (`--account-id`, `--role-name`, `--command`, `--region`). Ex: `mcp-aws-sso exec-command --account-id 123456789012 --role-name ReadOnly --command "aws s3 ls"`.311- **ec2-exec-command**: Runs shell command on EC2 (`--instance-id`, `--account-id`, `--role-name`, `--command`, `--region`). Ex: `mcp-aws-sso ec2-exec-command --instance-id i-0a69e80761897dcce --account-id 123456789012 --role-name InfraOps --command "uptime"`.312313<details>314<summary><b>CLI Command Examples (Click to expand)</b></summary>315316### Login317318**Standard Login (launches browser and polls automatically):**319```bash320mcp-aws-sso login321```322323**Login without Browser Launch:**324```bash325mcp-aws-sso login --no-launch-browser326```327328### Execute AWS Commands329330**List S3 Buckets:**331```bash332mcp-aws-sso exec-command \333 --account-id 123456789012 \334 --role-name ReadOnly \335 --command "aws s3 ls"336```337338**List EC2 Instances with Specific Region:**339```bash340mcp-aws-sso exec-command \341 --account-id 123456789012 \342 --role-name AdminRole \343 --region us-west-2 \344 --command "aws ec2 describe-instances --output table"345```346347### Execute EC2 Commands348349**Check System Resources:**350```bash351mcp-aws-sso ec2-exec-command \352 --instance-id i-0a69e80761897dcce \353 --account-id 123456789012 \354 --role-name InfraOps \355 --command "uptime && df -h && free -m"356```357358</details>359360## Troubleshooting361362### "Authentication failed" or "Token expired"3633641. **Re-authenticate with AWS SSO**:365 ```bash366 # Test your SSO configuration367 npx -y @aashari/mcp-server-aws-sso login368 ```3693702. **Check your AWS SSO configuration**:371 - Verify your `AWS_SSO_START_URL` is correct (should be your organization's SSO portal)372 - Ensure your `AWS_REGION` matches your SSO region configuration3733743. **Verify your SSO setup**:375 - Make sure you can access the SSO portal in your browser376 - Check that your AWS account assignments are active377378### "Account not found" or "Role not found"3793801. **Check available accounts and roles**:381 ```bash382 # List all accessible accounts383 npx -y @aashari/mcp-server-aws-sso ls-accounts384 ```3853862. **Verify account ID format**:387 - Account ID should be exactly 12 digits388 - Use the exact account ID from the `ls-accounts` output3893903. **Check role permissions**:391 - Make sure you have permission to assume the specified role392 - Use the exact role name from your permission sets393394### "AWS CLI not found" or Command execution errors3953961. **Install AWS CLI v2**:397 - Download from [AWS CLI Installation Guide](https://aws.amazon.com/cli/)398 - Ensure `aws` command is in your system PATH3994002. **Test AWS CLI independently**:401 ```bash402 aws --version403 aws sts get-caller-identity404 ```405406### "EC2 command failed" or "SSM connection issues"4074081. **Verify EC2 instance setup**:409 - Instance must have SSM Agent installed and running410 - Instance needs an IAM role with `AmazonSSMManagedInstanceCore` policy4114122. **Check your role permissions**:413 - Your assumed role needs `ssm:SendCommand` and `ssm:GetCommandInvocation` permissions414 - Verify the instance is in a running state4154163. **Test SSM connectivity**:417 ```bash418 # Test if instance is reachable via SSM419 npx -y @aashari/mcp-server-aws-sso exec-command \420 --account-id YOUR_ACCOUNT \421 --role-name YOUR_ROLE \422 --command "aws ssm describe-instance-information"423 ```424425### Claude Desktop Integration Issues4264271. **Restart Claude Desktop** after updating the config file4282. **Check the status bar** for the "🔗 aws-sso" indicator4293. **Verify config file location**:430 - macOS: `~/.claude/claude_desktop_config.json`431 - Windows: `%APPDATA%\Claude\claude_desktop_config.json`432433### Getting Help434435If you're still having issues:4361. Run a simple test command to verify everything works4372. Check the [GitHub Issues](https://github.com/aashari/mcp-server-aws-sso/issues) for similar problems4383. Create a new issue with your error message and setup details439440## Frequently Asked Questions441442### What permissions do I need?443444**For AWS IAM Identity Center (SSO) Setup:**445- Access to AWS IAM Identity Center with a configured identity source446- Permission sets assigned to you by your AWS administrator447- Access to the specific AWS accounts you want to manage448449**For EC2 Commands via SSM:**450- Your assumed role needs `ssm:SendCommand` and `ssm:GetCommandInvocation` permissions451- EC2 instances need an IAM role with `AmazonSSMManagedInstanceCore` policy452- SSM Agent must be installed and running on target instances453454### Can I use this with multiple AWS organizations?455456Currently, each installation supports one AWS SSO start URL at a time. For multiple organizations, you can:457- Switch the `AWS_SSO_START_URL` environment variable between sessions458- Run separate instances with different configurations459- Use multiple Claude Desktop configurations for different organizations460461### How long do the SSO credentials last?462463- **SSO tokens**: Typically 8-12 hours (managed by AWS IAM Identity Center)464- **Temporary credentials**: Approximately 1 hour per account/role465- The tool automatically handles token refresh and credential caching466- You'll be prompted to re-authenticate when tokens expire467468### What AI assistants does this work with?469470Any AI assistant that supports the Model Context Protocol (MCP):471- **Claude Desktop** (most popular and well-tested)472- **Cursor AI** (code editor with AI)473- **Continue.dev** (VS Code extension)474- Any other MCP-compatible client475476### Is my data secure?477478Yes! This tool prioritizes security:479- Runs entirely on your local machine (no external servers)480- Uses your own AWS SSO credentials (no third-party authentication)481- Never sends your data to third parties482- Only accesses what you explicitly grant permission to483- Uses AWS temporary credentials that automatically expire484- Follows AWS best practices for credential management485- Credentials are stored in standard AWS locations (`~/.aws/`)486487### Do I need AWS CLI installed?488489**For `aws_sso_exec_command`:** Yes, AWS CLI v2 is required to execute AWS commands.490491**For other tools:** No, authentication (`aws_sso_login`), status checking (`aws_sso_status`), and account listing (`aws_sso_ls_accounts`) work without AWS CLI.492493**For `aws_sso_ec2_exec_command`:** No, this uses the AWS SDK directly via Systems Manager.494495### Can I use this with AWS CLI profiles?496497This tool uses AWS IAM Identity Center directly and manages its own credential cache. It doesn't require AWS CLI profiles but is compatible with them:498- The tool stores credentials in `~/.aws/sso/cache/` (standard AWS location)499- You can optionally set `AWS_PROFILE` for compatibility with other AWS tools500- The tool works independently of AWS CLI profile configuration501502### What's the difference between AWS SSO and AWS IAM Identity Center?503504They're the same service! AWS SSO was rebranded to **AWS IAM Identity Center** in 2022. This tool works with both names:505- References to "AWS SSO" in the code and documentation refer to AWS IAM Identity Center506- Your start URL format remains the same: `https://your-org.awsapps.com/start`507- All functionality is identical regardless of the naming508509### What is TOON format?510511TOON (Token-Oriented Object Notation) is an output format optimized for Large Language Models:512- More compact than JSON (saves tokens when sending data to AI)513- Still human-readable514- Automatically used when available, falls back to JSON if needed515- Learn more: [@toon-format/toon](https://www.npmjs.com/package/@toon-format/toon)516517### Where are logs stored?518519Debug logs are written to: `~/.mcp/data/@aashari.mcp-server-aws-sso.[session-id].log`520521Each session gets a unique log file. Enable debug logging with `DEBUG=true`.522523<details>524<summary><b>Response Format Examples (Click to expand)</b></summary>525526### Output Format (TOON)527528Responses are formatted using **TOON (Token-Oriented Object Notation)** format, which is optimized for LLM token efficiency. TOON provides a more compact representation than JSON while maintaining readability.529530**Key Features:**531- Automatically converts responses to TOON format when available532- Falls back to JSON if TOON conversion fails533- Truncates large responses (>10KB) with a note about the full response location534- Logs full responses to `~/.mcp/data/@aashari.mcp-server-aws-sso.[session-id].log`535536### MCP Tool Response Example (`aws_sso_exec_command`)537538```markdown539# AWS SSO: Command Result540541**Account/Role:** 123456789012/ReadOnly542**Region:** us-east-1 (Default: ap-southeast-1)543544## Command545546 aws s3 ls547548## Output549550 2023-01-15 08:42:53 my-bucket-1551 2023-05-22 14:18:19 my-bucket-2552 2024-02-10 11:05:37 my-logs-bucket553554*Executed: 2025-05-19 06:21:49 UTC*555```556557### Error Response Example558559```markdown560# ❌ AWS SSO: Command Error561562**Account/Role:** 123456789012/ReadOnly563**Region:** us-east-1 (Default: ap-southeast-1)564565## Command566567 aws s3api get-object --bucket restricted-bucket --key secret.txt output.txt568569## Error: Permission Denied570The role `ReadOnly` does not have permission to execute this command.571572## Error Details573574 An error occurred (AccessDenied) when calling the GetObject operation: Access Denied575576### Troubleshooting577578#### Available Roles579- AdminAccess580- PowerUserAccess581- S3FullAccess582583Try executing the command again using one of the roles listed above that has appropriate permissions.584585*Executed: 2025-05-19 06:17:49 UTC*586```587588### Large Response Handling589590When API responses exceed 10KB, the output is truncated with a message:591592```593[Response truncated for AI consumption. Full response logged to: /path/to/log/file.log]594```595596This ensures AI assistants receive manageable response sizes while developers can access full output in log files.597598</details>599600## Technical Details601602### Architecture603604This server follows a clean 5-layer architecture:6056061. **CLI Layer** (`src/cli/`): Command-line interface using Commander.js6072. **Tools Layer** (`src/tools/`): MCP tool definitions with Zod validation schemas6083. **Controllers Layer** (`src/controllers/`): Business logic and orchestration6094. **Services Layer** (`src/services/`): External API interactions (AWS SDK)6105. **Utils Layer** (`src/utils/`): Shared utilities (logging, config, caching, formatting)611612### Key Dependencies613614- **@modelcontextprotocol/sdk** v1.23.0: MCP protocol implementation615- **@aws-sdk/client-sso** v3.893.0: AWS SSO API client616- **@aws-sdk/client-ssm** v3.893.0: AWS Systems Manager for EC2 commands617- **@toon-format/toon** v2.0.1: Token-efficient output formatting618- **zod** v4.1.13: Runtime type validation619- **commander** v14.0.2: CLI framework620621### Logging622623Debug logs are written to: `~/.mcp/data/@aashari.mcp-server-aws-sso.[session-id].log`624625Enable debug logging by setting `DEBUG=true` in your environment.626627### Caching628629- **SSO tokens**: Cached in `~/.aws/sso/cache/` (standard AWS location)630- **Temporary credentials**: Cached for 1 hour per account/role combination631- **Account information**: Fetched fresh on each request (no persistent cache)632633## Development634635```bash636# Clone repository637git clone https://github.com/aashari/mcp-server-aws-sso.git638cd mcp-server-aws-sso639640# Install dependencies641npm install642643# Build the project644npm run build645646# Run in development mode with HTTP transport647npm run dev:http648649# Run with STDIO transport (for MCP client testing)650npm run dev:stdio651652# Run with MCP Inspector (visual debugging)653npm run mcp:inspect654655# Run tests656npm test657658# Run tests with coverage659npm test:coverage660661# Lint code662npm run lint663664# Format code665npm run format666```667668### Available npm Scripts669670- `npm run build` - Compile TypeScript to JavaScript671- `npm run mcp:stdio` - Run with STDIO transport672- `npm run mcp:http` - Run with HTTP transport673- `npm run mcp:inspect` - Run with MCP Inspector for debugging674- `npm test` - Run Jest tests675- `npm run lint` - Run ESLint676- `npm run format` - Format code with Prettier677678## Requirements679680- **Node.js**: Version 18.0.0 or higher681- **AWS CLI**: Version 2.x (required only for `aws_sso_exec_command`)682- **AWS IAM Identity Center**: Configured and accessible683- **Operating System**: macOS, Linux, or Windows684685## Version History686687### v3.0.1 (Current)688- Fixed picomatch dependency conflict for npm ci689- Enhanced raw response logging with truncation for large API responses690- Improved AI guidance for AWS SSO login instructions691692### v3.0.0693- **BREAKING**: Modernized to @modelcontextprotocol/sdk v1.23.0 with registerTool API694- Added Node.js version specification (Node 22.14.0 compatibility)695- Enhanced logging and error handling696697### v2.0.0698- **BREAKING**: Fixed AWS CLI execution and credential region mismatch issues699- Improved cross-region authentication handling700- Prevented dotenv from outputting to STDIO in MCP mode701702See [CHANGELOG.md](./CHANGELOG.md) for complete version history.703704## Contributing705706Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.707708## License709710ISC License - See LICENSE file for details711712## Support713714Need help? Here's how to get assistance:7157161. **Check the troubleshooting section above** - most common issues are covered there7172. **Visit our GitHub repository** for documentation and examples: [github.com/aashari/mcp-server-aws-sso](https://github.com/aashari/mcp-server-aws-sso)7183. **Report issues** at [GitHub Issues](https://github.com/aashari/mcp-server-aws-sso/issues)7194. **Start a discussion** for feature requests or general questions7205. **Check debug logs** at `~/.mcp/data/@aashari.mcp-server-aws-sso.[session-id].log` for detailed error information721722---723724**Built with:** TypeScript, MCP SDK, AWS SDK for JavaScript v3, TOON Format725726*Made with care for DevOps teams who want to bring AI into their AWS workflow.*727728
Full transparency — inspect the skill content before installing.