~Engineers solve problems, I solve engineer's problems 🤘
A deep dive into Amazon Q CLI and Model Context Protocol (MCP) servers, exploring how these tools have revolutionized my development workflow and productivity.
Amazon Q CLI is a command-line interface that brings AI-powered assistance directly to your terminal. It integrates with AWS services and provides intelligent code suggestions, documentation lookup, and automated task execution.
Model Context Protocol (MCP) servers are standardized interfaces that allow AI models to interact with external tools and data sources. They provide a consistent way for AI assistants to access databases, APIs, file systems, and other resources.
# Install Amazon Q CLI
curl -fsSL https://aws.amazon.com/q/cli/install.sh | bash
# Verify installation
q --version
# Configure AWS credentials
aws configure
q configure
# Initialize Q CLI
q init
# Set default region
q config set region us-east-1
# Configure output format
q config set output json
# Enable auto-suggestions
q config set suggestions true
# Instead of remembering complex AWS CLI syntax
q "create an S3 bucket with versioning enabled"
# Q CLI generates:
aws s3api create-bucket --bucket my-bucket --region us-east-1
aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled
# Q CLI understands your current context
q "show me the security groups for this EC2 instance"
# Automatically detects current instance and shows relevant security groups
aws ec2 describe-security-groups --group-ids $(aws ec2 describe-instances --instance-ids i-1234567890abcdef0 --query 'Reservations[0].Instances[0].SecurityGroups[].GroupId' --output text)
# When AWS CLI commands fail, Q CLI provides solutions
aws s3 cp file.txt s3://non-existent-bucket/
# Q CLI suggests:
q "fix this S3 error: The specified bucket does not exist"
# Provides solution:
aws s3 mb s3://my-bucket
aws s3 cp file.txt s3://my-bucket/
# Install MCP server for AWS
npm install -g @aws/mcp-server
# Configure MCP server
q mcp install aws-server
# List available MCP servers
q mcp list
{
"mcpServers": {
"aws-tools": {
"command": "node",
"args": ["/path/to/aws-mcp-server"],
"env": {
"AWS_REGION": "us-east-1",
"AWS_PROFILE": "default"
}
},
"terraform-tools": {
"command": "python",
"args": ["/path/to/terraform-mcp-server.py"],
"env": {
"TF_VAR_environment": "production"
}
},
"jira-tools": {
"command": "python",
"args": ["/path/to/jira-mcp-server.py"],
"env": {
"JIRA_URL": "https://your-domain.atlassian.net",
"JIRA_USERNAME": "your-email@company.com",
"JIRA_API_TOKEN": "your-api-token"
}
},
"confluence-tools": {
"command": "python",
"args": ["/path/to/confluence-mcp-server.py"],
"env": {
"CONFLUENCE_URL": "https://your-domain.atlassian.net",
"CONFLUENCE_USERNAME": "your-email@company.com",
"CONFLUENCE_API_TOKEN": "your-api-token"
}
},
"aws-billing-tools": {
"command": "python",
"args": ["/path/to/aws-billing-mcp-server.py"],
"env": {
"AWS_REGION": "us-east-1",
"AWS_PROFILE": "billing-readonly"
}
}
}
}
# Step 1: Create API token in Atlassian
# Go to: https://id.atlassian.com/manage-profile/security/api-tokens
# Click "Create API token"
# Copy the generated token
# Step 2: Configure environment variables
export JIRA_URL="https://your-domain.atlassian.net"
export JIRA_USERNAME="your-email@company.com"
export JIRA_API_TOKEN="your-api-token"
export CONFLUENCE_URL="https://your-domain.atlassian.net"
export CONFLUENCE_USERNAME="your-email@company.com"
export CONFLUENCE_API_TOKEN="your-api-token"
# Step 3: Test API access
curl -u "$JIRA_USERNAME:$JIRA_API_TOKEN" "$JIRA_URL/rest/api/3/myself"
curl -u "$CONFLUENCE_USERNAME:$CONFLUENCE_API_TOKEN" "$CONFLUENCE_URL/wiki/rest/api/user/current"
There are several open-source MCP servers available that can be easily integrated with Amazon Q CLI:
Popular Open-Source MCP Servers:
AWS Official MCP Servers: AWS provides official MCP servers for their services:
Configuration Example:
{
"mcpServers": {
"jira-tools": {
"command": "npx",
"args": ["@company/jira-mcp-server"],
"env": {
"JIRA_URL": "https://your-domain.atlassian.net",
"JIRA_USERNAME": "your-email@company.com",
"JIRA_API_TOKEN": "your-api-token"
}
},
"aws-billing": {
"command": "npx",
"args": ["@aws/billing-mcp-server"],
"env": {
"AWS_REGION": "us-east-1",
"AWS_PROFILE": "billing-readonly"
}
}
}
}
While there are many open-source MCP servers available, it’s also straightforward to create your own custom MCP servers for specific use cases:
Key Benefits of Custom MCP Servers:
MCP Server Structure:
{
"tools": [
{
"name": "tool_name",
"description": "Tool description",
"inputSchema": {
"type": "object",
"properties": {
"parameter": {"type": "string"}
}
}
}
]
}
Easy Integration:
npm install @company/custom-mcp-server
mcp.json
with environment variablesq "create JIRA ticket with custom template"
Installing MCP Servers:
# Install open-source MCP servers
npm install @company/jira-mcp-server
npm install @company/confluence-mcp-server
npm install @aws/billing-mcp-server
# Install AWS official MCP servers
npm install @aws/cli-mcp-server
npm install @aws/cost-explorer-mcp-server
Configuration in mcp.json:
{
"mcpServers": {
"jira-tools": {
"command": "npx",
"args": ["@company/jira-mcp-server"],
"env": {
"JIRA_URL": "https://your-domain.atlassian.net",
"JIRA_USERNAME": "your-email@company.com",
"JIRA_API_TOKEN": "your-api-token"
}
},
"confluence-tools": {
"command": "npx",
"args": ["@company/confluence-mcp-server"],
"env": {
"CONFLUENCE_URL": "https://your-domain.atlassian.net",
"CONFLUENCE_USERNAME": "your-email@company.com",
"CONFLUENCE_API_TOKEN": "your-api-token"
}
},
"aws-billing": {
"command": "npx",
"args": ["@aws/billing-mcp-server"],
"env": {
"AWS_REGION": "us-east-1",
"AWS_PROFILE": "billing-readonly"
}
}
}
}
# Q CLI can access AWS documentation directly
q "show me the AWS Lambda pricing model"
# Q CLI provides:
# - Current pricing information
# - Regional variations
# - Free tier details
# - Cost optimization tips
# Architecture diagram generation
q "create an architecture diagram for a serverless web application"
# Q CLI generates Mermaid diagram:
graph TB
A[User] --> B[CloudFront]
B --> C[API Gateway]
C --> D[Lambda Functions]
D --> E[DynamoDB]
D --> F[S3 Bucket]
G[Route 53] --> B
H[Cognito] --> C
Q CLI can generate professional architecture diagrams using Mermaid syntax:
Available Diagram Types:
Diagram Features:
# Traditional approach
aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml --parameters ParameterKey=Environment,ParameterValue=prod
# With Q CLI
q "deploy a CloudFormation stack named my-stack with production environment"
# Q CLI generates optimized command with error handling
aws cloudformation create-stack \
--stack-name my-stack \
--template-body file://template.yaml \
--parameters ParameterKey=Environment,ParameterValue=prod \
--capabilities CAPABILITY_IAM \
--on-failure ROLLBACK
# Complex EKS operations simplified
q "create an EKS cluster with 3 nodes and enable logging"
# Q CLI generates:
eksctl create cluster \
--name my-cluster \
--region us-east-1 \
--nodegroup-name workers \
--node-type t3.medium \
--nodes 3 \
--nodes-min 1 \
--nodes-max 5 \
--enable-iam \
--enable-cloudwatch-logs
# RDS operations made simple
q "create an RDS PostgreSQL instance with backup enabled"
# Q CLI generates:
aws rds create-db-instance \
--db-instance-identifier my-postgres-db \
--db-instance-class db.t3.micro \
--engine postgres \
--engine-version 13.7 \
--master-username admin \
--master-user-password MyPassword123 \
--allocated-storage 20 \
--backup-retention-period 7 \
--preferred-backup-window "03:00-04:00" \
--preferred-maintenance-window "sun:04:00-sun:05:00"
# Create a user story with acceptance criteria and definition of done
q "create a JIRA user story for implementing user authentication with 5 story points"
# Q CLI uses JIRA MCP server to create:
# - Title: "Implement User Authentication"
# - Description: Detailed user story description
# - Acceptance Criteria: Given/When/Then format
# - Definition of Done: Code review, tests, documentation
# - Story Points: 5
# - Epic Link: Authentication Epic
# Create architecture documentation
q "create a Confluence page for our microservices architecture"
# Q CLI uses Confluence MCP server to create:
# - Architecture overview
# - Component descriptions
# - Data flow diagrams
# - Security considerations
# - Deployment notes
# Analyze cost anomalies
q "analyze AWS cost anomalies for the last 30 days"
# Q CLI uses AWS billing MCP server to:
# - Get daily cost data
# - Identify services with >20% cost changes
# - Generate anomaly report
# - Suggest cost optimization opportunities
# Get AWS service documentation
q "show me the AWS Lambda cold start optimization best practices"
# Q CLI provides:
# - Current AWS documentation
# - Best practices for cold start reduction
# - Code examples
# - Performance tuning tips
# Generate architecture diagrams
q "create a microservices architecture diagram with API Gateway, Lambda, and DynamoDB"
# Q CLI generates Mermaid diagram:
graph TB
A[Client] --> B[API Gateway]
B --> C[Auth Lambda]
B --> D[User Lambda]
B --> E[Order Lambda]
C --> F[Cognito]
D --> G[DynamoDB Users]
E --> H[DynamoDB Orders]
I[CloudWatch] --> C
I --> D
I --> E
# Terraform MCP server enables infrastructure management
q "plan terraform changes for production environment"
# Q CLI uses Terraform MCP server to:
# - Run terraform plan with proper parameters
# - Show resource changes and costs
# - Validate configuration
# - Suggest optimizations
# Docker MCP server commands
q "build and run a Docker container with my app"
# Q CLI uses Docker MCP server to:
docker build -t my-app:latest .
docker run -d -p 8080:8080 --name my-app-container my-app:latest
# Git MCP server integration
q "create a new branch and push my changes"
# Q CLI generates:
git checkout -b feature/new-feature
git add .
git commit -m "Add new feature"
git push origin feature/new-feature
Creating custom MCP servers is straightforward and allows you to build domain-specific tools:
Development Process:
mcp.json
configurationKey Components:
Benefits:
{
"mcp.servers": {
"aws-q-cli": {
"command": "q",
"args": ["mcp", "serve"],
"env": {
"AWS_PROFILE": "default"
}
}
}
}
# .github/workflows/deploy.yml
name: Deploy with Q CLI
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: $
aws-secret-access-key: $
aws-region: us-east-1
- name: Install Q CLI
run: |
curl -fsSL https://aws.amazon.com/q/cli/install.sh | bash
- name: Deploy with Q CLI
run: |
q "deploy the application to production environment"
# Good: Specific and contextual
q "create an S3 bucket for storing application logs with lifecycle policy"
# Bad: Too vague
q "create something"
# Organize MCP servers by domain
q mcp install aws-tools
q mcp install terraform-tools
q mcp install monitoring-tools
# Q CLI provides intelligent error resolution
q "fix this error: Access Denied"
# Suggests:
# 1. Check IAM permissions
# 2. Verify AWS credentials
# 3. Check resource policies
# Check MCP server status
q mcp status
# Restart MCP server
q mcp restart aws-tools
# Check logs
q mcp logs aws-tools
# Verify AWS credentials
aws sts get-caller-identity
# Reconfigure Q CLI
q configure --reset
# Enable caching
q config set cache true
# Set cache size
q config set cache_size 1000
# Clear cache when needed
q cache clear
Amazon Q CLI and MCP servers have fundamentally transformed my development workflow. The combination of intelligent command generation, context-aware suggestions, and seamless tool integration has resulted in:
The integration of JIRA and Confluence MCP servers has revolutionized my project management workflow, ensuring consistent ticket quality with proper acceptance criteria and definition of done. The AWS billing MCP server provides proactive cost monitoring and optimization insights that would take hours to gather manually.
The key to success is starting with basic operations and gradually building custom MCP servers for your specific use cases. The investment in learning these tools pays dividends in productivity, code quality, and project management efficiency.
Most Impactful Features:
These tools have not just improved my productivity—they’ve fundamentally changed how I approach development, documentation, and project management.