Execute AWS CLI Commands Securely
A standalone MCP server replicating Amazon Q's use_aws tool for any MCP-compatible AI client.
Why it matters
This asset provides a standardized interface for executing AWS CLI commands, replicating the functionality of Amazon Q Developer CLI's use_aws tool. It enhances security with automatic read-only/write operation detection and ensures proper parameter handling for various AI tools.
Outcomes
What it gets done
Execute AWS CLI commands through a standardized MCP interface.
Automatically detect and handle read-only vs. write operations for security.
Format parameters and manage AWS CLI user agents.
Truncate large responses for efficient handling.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-use-aws-mcp | bash Capabilities
Tools your agent gets
Execute AWS CLI commands with proper parameter handling and security checks
Overview
use_aws_mcp server
A standalone MCP server replicating Amazon Q's use_aws tool, letting any MCP client run AWS CLI commands safely. Use it when an AI tool outside Amazon Q needs to run AWS CLI operations with built-in read-only/write safety checks.
What it does
A standalone MCP server that replicates the use_aws tool from the Amazon Q Developer CLI, giving any MCP-compatible AI tool a portable interface to execute AWS CLI commands with a single use_aws tool - specifying service, operation, parameters, region, and profile.
When to use - and when NOT to
Use this when you need an AI client outside Amazon Q (e.g. Cursor, Avante/MCPHub in nvim) to run AWS CLI operations - listing S3 buckets, describing EC2 instances, listing Lambda functions - with the same safety model as use_aws. Non-shell MCP clients like Cursor don't inherit shell environment variables like AWS_DEFAULT_PROFILE the way the Amazon Q CLI does, so it's best to explicitly require the client to pass a specific AWS profile rather than relying on environment inheritance.
Capabilities
- Single tool
use_awswith schema: requiredservice_name(e.g. s3, ec2, lambda),operation_name(e.g. list-buckets, describe-instances), andregion; optionalparameters,profile_name, and alabeldescribing the operation. - Automatic read-only vs. write detection by operation-name prefix:
get,describe,list,ls,search,batch_getare treated as read-only; everything else requires explicit user acceptance. - Human-readable command descriptions with terminal formatting (service, operation, parameters, profile, region, label, and a read-only/write marker).
- Automatic kebab-case parameter conversion for AWS CLI compatibility, plus output truncation (max 100KB) to prevent memory issues.
- Communicates via stdin/stdout using the JSON-RPC protocol, and includes an example (
cargo run --example description_demo) that prints a formatted preview of a command's service, operation, parameters, profile, region, and label before it runs.
How to install
Requires Rust 1.70+/Cargo, AWS CLI installed and configured, and AWS credentials (via CLI, environment variables, or IAM roles). Install with:
cargo install use_aws_mcp
or build from source with cargo build --release (binary at target/release/use_aws). Configure an MCP client with:
{
"mcpServers": {
"use_aws_mcp": {
"name": "use_aws_mcp",
"command": "use_aws_mcp",
"timeout": 300,
"env": {},
"disabled": false
}
}
}
Then set an API key, or run aws sso login for the specific profile, before asking the MCP client any AWS-related questions.
Who it's for
Developers who already rely on Amazon Q Developer CLI's use_aws tool and want the same portable AWS CLI interface available in any MCP-compatible editor or AI tool - Cursor, Neovim (Avante/MCPHub), or others - with built-in read-only/write safety checks. For example, listing S3 buckets only needs service_name: "s3", operation_name: "ls", and a region, while describing specific EC2 instances or listing Lambda functions under a named profile follows the same schema with the relevant parameters and profile_name filled in. The project is dual-licensed under MIT and Apache-2.0.
Source README
use_aws MCP Server
๐ amazon-q-cli is great, and it is great because it has use_aws MCP tool to interact with AWS API.
๐ก Wouldn't it be greater if this use_aws was portable, and use it across different AI tools, whichever you're currently using?
โก use_aws_mcp is a standalone Model Context Protocol (MCP) server that provides AWS CLI functionality through a standardized interface.
This server replicates the functionality of the use_aws tool from the Amazon Q Developer CLI.
๐ฌ Demo
Usage with Avante, MCPHub in nvim

Usage with Cursor

โจ Features
- AWS CLI Integration: Execute AWS CLI commands with proper parameter handling
- Safety Checks: Automatic detection of read-only vs. write operations
- User Agent Management: Proper AWS CLI user agent setup for tracking
- Parameter Formatting: Automatic conversion of parameters to kebab-case for CLI compatibility
- Error Handling: Comprehensive error handling and output formatting
- MCP Protocol: Full Model Context Protocol compliance
- Human-Readable Descriptions: Rich command descriptions using terminal formatting
๐ฆ Installation
๐ Prerequisites
- ๐ฆ Rust (1.70 or later), Cargo
- for MacOS and linux, install with
curl https://sh.rustup.rs -sSf | sh
- for MacOS and linux, install with
- โ๏ธ AWS CLI installed and configured
- ๐ AWS credentials configured (via AWS CLI, environment variables, or IAM roles)
๐จ Building
cargo build --release
The binary will be available at target/release/use_aws.
๐ Usage
๐ MCP Client Integration
To use this server with an MCP client, first install it using Cargo:
cargo install use_aws_mcp
Then configure your MCP client with:
{
"mcpServers": {
"use_aws_mcp": {
"name": "use_aws_mcp",
"command": "use_aws_mcp",
"timeout": 300,
"env": {},
"disabled": false
}
}
}
โ ๏ธ Important Caveat for Using MCP Client
With q cli, mcp clients are shell process, so credentials env like AWS_DEFAULT_PROFILE are automatically transfered to mcp server.
However, non shell mcp clients like cursor cannot take advantage of this, so it is best advised to require mcp clients directly to use specific aws profile.
๐ User Flow:
- Set mcp.json above
- Set API key, or login to specific profile using
aws sso login - Ask away mcp client aws related questions! and be sure to require it to use specific profile.
Running the MCP Server Locally
./target/release/use_aws_mcp
The server communicates via stdin/stdout using JSON-RPC protocol.
Command Descriptions
The server provides human-readable descriptions of AWS CLI commands. You can see this in action by running the example:
cargo run --example description_demo
This will output something like:
Running aws cli command:
Service name: s3
Operation name: list-buckets
Parameters:
- max-items: "10"
- query: "Buckets[].Name"
Profile name: development
Region: us-west-2
Label: List S3 buckets with query
โ
This command is read-only (no acceptance required)
๐ ๏ธ Tool Specification
The server provides a single tool called use_aws with the following schema:
{
"name": "use_aws",
"description": "Execute AWS CLI commands with proper parameter handling and safety checks",
"inputSchema": {
"type": "object",
"properties": {
"service_name": {
"type": "string",
"description": "AWS service name (e.g., s3, ec2, lambda)"
},
"operation_name": {
"type": "string",
"description": "AWS CLI operation name (e.g., list-buckets, describe-instances)"
},
"parameters": {
"type": "object",
"description": "Optional parameters for the AWS CLI command",
"additionalProperties": true
},
"region": {
"type": "string",
"description": "AWS region (e.g., us-west-2, eu-west-1)"
},
"profile_name": {
"type": "string",
"description": "Optional AWS profile name"
},
"label": {
"type": "string",
"description": "Optional label for the operation"
}
},
"required": ["service_name", "operation_name", "region"]
}
}
๐ Examples
List S3 Buckets
{
"name": "use_aws",
"arguments": {
"service_name": "s3",
"operation_name": "ls",
"region": "us-west-2"
}
}
Describe EC2 Instances
{
"name": "use_aws",
"arguments": {
"service_name": "ec2",
"operation_name": "describe-instances",
"region": "us-west-2",
"parameters": {
"instance-ids": "i-1234567890abcdef0"
}
}
}
List Lambda Functions with Profile
{
"name": "use_aws",
"arguments": {
"service_name": "lambda",
"operation_name": "list-functions",
"region": "us-west-2",
"profile_name": "development"
}
}
๐ก๏ธ Safety Features
Read-Only Operation Detection
The server automatically detects read-only operations based on the operation name prefix:
- Read-only prefixes:
get,describe,list,ls,search,batch_get - Write operations: All other operations require explicit user acceptance
Output Truncation
Large outputs are automatically truncated to prevent memory issues, with a maximum response size of 100KB.
Development
Running Tests
cargo test
๐จ Building for Development
cargo build
Running with Logging
RUST_LOG=use_aws=debug cargo run
Examples
# Run the description demo
cargo run --example description_demo
Architecture
The project is structured as follows:
src/lib.rs: Core library with types and constantssrc/error.rs: Error handling typessrc/use_aws.rs: Core AWS CLI functionality (replicated from original)src/mcp_server.rs: MCP server implementationsrc/main.rs: Binary entry pointexamples/description_demo.rs: Example demonstrating command descriptions
๐ฆ Dependencies
If you do not have Cargo (the Rust package manager) installed, you can get it by installing Rust using rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Follow the on-screen instructions to complete the installation. After installation, restart your terminal and ensure Cargo is available by running:
cargo --version
You should see the installed Cargo version printed.
This project is distributed as a Rust crate. The following dependencies are managed automatically by Cargo:
tokioserdeserde_jsoneyrebstrconvert_caseasync-traitthiserrortracingtracing-subscribercrossterm
test/dev dependencies:
tokio-test
You do not need to install these manually; Cargo will handle them during installation.
๐ License
MIT, Apache-2.0
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
๐ Security
This server executes AWS CLI commands, which may have security implications:
- Ensure proper AWS credentials and permissions
- Review all commands before execution
- Use read-only operations when possible
- Consider running in a restricted environment
๐ง Troubleshooting
Common Issues
- AWS CLI not found: Ensure AWS CLI is installed and in PATH
- Permission denied: Check AWS credentials and permissions
- Invalid region: Verify the region name is correct
- Parameter errors: Check parameter names and values
Debug Mode
Run with debug logging to see detailed information:
RUST_LOG=use_aws=debug ./target/release/use_aws
References
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.