If you're curious about how to bring generative AI to your terminal and enhance it with contextual awareness of AWS services, this blog walks you through setting up Amazon Q CLI on a Windows environment and connecting it to one or more MCP (Model Context Protocol) servers.
Whether you're experimenting with infrastructure as code, checking AWS best practices, or planning cost analysis, MCP gives Amazon Q the power to understand your environment better.
Whatโs Amazon Q CLI and MCP?
Amazon Q CLI is a command-line tool that lets you interact with a generative AI assistant directly in your terminal. Think of it as having a smart AWS-AI assistant that can help with commands, code generation, documentation lookup, and much more.
MCP (Model Context Protocol) is an open protocol that connects AI tools like Q CLI to external services โ such as AWS documentation, CDK best practices, cost calculators, or even image generators. MCP servers provide that real-time context the model might not have, especially for newer APIs or service updates.
๐๏ธ Amazon Q CLI Architecture
You interact with Q CLI
โ You enter natural language or AWS-related commands into your terminal.Q CLI handles your session
โ It handles AWS authentication and keeps track of your session.It checks what youโre asking for
โ Q CLI checks whether you're requesting an AWS action, a local file operation, or AI help.It connects to AWS services or your local files
โ It either runs AWS commands or interacts with your local file system, based on the request.If your request needs AI understanding
โ For natural language or complex tasks, Q CLI calls Amazonโs large language model (LLM) to assist.Q CLI looks for any available MCP tools
โ It checks for any local MCP servers that are available and relevant to your requestRelevant parts of the request are sent to MCP servers
โ Q CLI sends parts of the request to the appropriate MCP tools for specialized processing.MCP tools send back results or extra context
โ These tools provide extra context or project-specific output to support your query.Final response is shown in your terminal
โ The final result whether its from AWS, local systems, AI, or MCP toolsโis provided in your terminal.
Each MCP server you configure exposes a specific domain of knowledge. You can connect multiple MCP servers depending on your use case.
How to setup Amazon Q CLI on Windows (via WSL)
Since Amazon Q CLI is Linux-based, you'll need to use the Windows Subsystem for Linux (WSL) to run it on a Windows machine. Follow these steps:
โ
Step 1: Install WSL on Windows ( I am using Visual Studio Terminal for installation)
Open PowerShell and run:
wsl --install
- This installs Ubuntu by default.
- During installation, youโll be prompted to set a username and password for the Linux environment.
โ
Step 2: Download the Amazon Q CLI Installer
From your WSL terminal, download the appropriate zip file for your Linux distribution.
For Linux x86-64, run:
curl --proto '=https' --tlsv1.2 -sSf "https://desktop-release.q.us-east-1.amazonaws.com/latest/q-x86_64-linux.zip" -o "q.zip"
โ
Step 3: Install Dependencies
Before proceeding, make sure required packages are installed:
sudo apt get install unzip
โ
Step 4: Extract the Q CLI Package
Unzip the downloaded file:
unzip q.zip
โ
Step 5: Install Amazon Q CLI
Run the install script:
q/install.sh
- During installation, you'll be asked to provide:
- Shell Config Modification: Select Yes to allow the script to update your shell configuration automatically.
- Login Method: Choose "Use for Free with Builder ID"-Authenticate using your Builder ID.
โ Step 6: Relaunch and Verify Setup
- Close the terminal after installation is complete.
- Relaunch the terminal and log back into your Ubuntu (WSL) environment.
- Run the following command to verify that Amazon Q CLI is installed correctly:
wsl -d Ubuntu
q --version
For official documentation, refer to: Amazon-Q-CLI Installation Guide
MCP Server Configuration with Amazon Q CLI
Now that Amazon Q CLI is installed, letโs proceed with setting up the MCP Server.
Prerequisites for MCP Server Installation
๐น Step 1: Install uv
Install uv using curl:
curl -LsSf https://astral.sh/uv/install.sh | sh
โน๏ธ Other installation methods (e.g., using pip) are also available โ refer GitHub Repository for details.
๐น Step 2: Verify uv Installation
uv --version
๐น Step 3: Install Python 3.10 Using uv
uv python install 3.10
๐น Step 4: Ensure AWS CLI is Installed
Check if AWS CLI is installed:
aws --version
If not, install it using:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Then configure credentials:
aws configure
Make sure your IAM role/user has permissions to use AWS MCP services (like access to the AWS Pricing API).
๐น Step 5: Install Required Packages for MCP
Some MCP servers (like AWS Diagram MCP Server) need tools like GraphViz. Install it:
sudo apt-get install graphviz
๐๏ธMCP Configuration in Amazon Q
Step 6: Create MCP Configuration Folder and File
Create the necessary folder:
Now we need to create a folder amazon q under ~/.aws
mkdir -p ~/.aws/amazonq
cd ~/.aws/amazonq
Create and edit the mcp.json file:
{
"mcpServers": {
"awslabs.nova-canvas-mcp-server": {
"command": "uvx",
"args": ["awslabs.nova-canvas-mcp-server@latest"],
"env": {
"AWS_PROFILE": "**your-aws-profile**",
"AWS_REGION": "us-east-1",
"FASTMCP_LOG_LEVEL": "ERROR"
},
"disabled": false,
"autoApprove": []
}
}
}
Don't forgot to change your ur profile details.
๐ You can configure multiple MCP servers by listing them under "mcpServers" like so:
{
"mcpServers": {
"mcpserver1": { ... },
"mcpserver2": { ... }
}
}
๐ Launch Amazon Q
Youโll now be logged into the Amazon Q CLI with your configured MCP servers.
I've set up four MCP servers โ nova-canvas, cost-analysis, aws-diagram, and document. The cover image was generated using the nova-canvas server, while the architecture diagram below was created using the aws-diagram MCP server
Security Considerations
- All communication between the CLI and AWS services is secured via HTTPS
- Authentication is handled through IAM
- Local file system and command execution is limited to the user's permissions
- MCP servers operate within the user's environment with appropriate access controls
References
GitHub link for AWS MCP servers
AWS-Cli-Installation
AWS-Cli-User-Guide
Thank you for reading!!!!!!
Top comments (2)
Good article swetha
Thank you Abi.