
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
azureai-optimizer
Advanced tools
AI-Powered Azure Infrastructure Optimization via Model Context Protocol
🚀 AI-Powered Azure Infrastructure Optimization via Model Context Protocol
AzureAI Optimizer is a specialized MCP (Model Context Protocol) server that provides AI-powered Azure infrastructure optimization, cost management, and security compliance through any MCP-compatible AI assistant (Claude, ChatGPT, GitHub Copilot).
Key Value Proposition: Reduce Azure costs by 20-40% while improving security posture and performance through AI-driven analysis and recommendations.
The easiest way to get started is using NPX - no installation required!
Set your Azure credentials:
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
export AZURE_TENANT_ID="your-tenant-id" # optional
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"azureai-optimizer": {
"command": "npx",
"args": ["-y", "azureai-optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZURE_TENANT_ID": "your-tenant-id"
}
}
}
}
Restart Claude Desktop and start optimizing:
"Analyze my Azure costs for the last 30 days"
Install Prerequisites:
# Ensure you have Node.js 18+ installed
node --version
Add to VS Code MCP Configuration:
Create or update .vscode/mcp.json
:
{
"servers": {
"AzureAI Optimizer": {
"command": "npx",
"args": [
"-y",
"azureai-optimizer@latest",
"server",
"start"
],
"env": {
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZURE_TENANT_ID": "your-tenant-id"
}
}
}
}
Restart VS Code and activate GitHub Copilot Agent Mode
Start optimizing:
@azureai analyze my Azure costs for the last 30 days
@azureai recommend VM right-sizing for my production environment
@azureai assess security compliance for SOC2
Step 1: Locate your Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
Step 2: Add the AzureAI Optimizer configuration to your claude_desktop_config.json
:
{
"mcpServers": {
"azureai-optimizer": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZURE_TENANT_ID": "your-tenant-id"
}
}
}
}
Step 3: Replace the placeholder values:
your-subscription-id
- Your Azure subscription ID (GUID format)your-tenant-id
- Your Azure tenant ID (optional, auto-detected if not provided)Step 4: Restart Claude Desktop
Add to your Cline MCP configuration:
{
"mcpServers": {
"azureai-optimizer": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZURE_TENANT_ID": "your-tenant-id"
}
}
}
}
Add to your Continue configuration:
{
"mcpServers": [
{
"name": "azureai-optimizer",
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZURE_TENANT_ID": "your-tenant-id"
}
}
]
}
# Run the server directly
npx -y azureai-optimizer@latest server start
# Or with custom configuration
npx -y azureai-optimizer@latest server start --port 8080 --transport sse
analyze_cost_optimization
- Comprehensive cost analysis with AI recommendationsright_size_resources
- VM and database right-sizing suggestionsreserved_instance_analysis
- RI and Savings Plan recommendationsunused_resource_detection
- Identify and eliminate wastesecurity_compliance_check
- Multi-framework compliance assessmentvulnerability_scan
- Security posture analysisaccess_review
- IAM and RBAC optimizationencryption_audit
- Data protection complianceperformance_analysis
- Resource performance insightsscaling_recommendations
- Auto-scaling optimizationnetwork_optimization
- Traffic and latency analysisstorage_optimization
- Storage tier and access pattern analysisresource_inventory
- Complete Azure resource discoverytag_management
- Resource tagging and governancepolicy_compliance
- Azure Policy assessmentbackup_analysis
- Backup and disaster recovery reviewCreate or update ~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"azureai-optimizer": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "12345678-1234-1234-1234-123456789012",
"AZURE_TENANT_ID": "87654321-4321-4321-4321-210987654321",
"OPENROUTER_API_KEY": "sk-or-v1-your-openrouter-key",
"OPENROUTER_COST_MODEL": "openai/gpt-4.1-preview",
"OPENROUTER_SECURITY_MODEL": "anthropic/claude-3.5-sonnet:beta",
"AZUREAI_LOG_LEVEL": "info"
}
}
}
}
Alternative configuration using direct OpenAI/Anthropic APIs:
{
"mcpServers": {
"azureai-optimizer": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "12345678-1234-1234-1234-123456789012",
"AZURE_TENANT_ID": "87654321-4321-4321-4321-210987654321",
"OPENAI_API_KEY": "sk-your-openai-key",
"ANTHROPIC_API_KEY": "sk-ant-your-anthropic-key",
"AZUREAI_LOG_LEVEL": "info"
}
}
}
}
Add to your Cline settings:
{
"mcpServers": {
"azureai-optimizer": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "12345678-1234-1234-1234-123456789012",
"AZURE_TENANT_ID": "87654321-4321-4321-4321-210987654321"
}
}
}
}
For organizations with multiple Azure subscriptions:
{
"mcpServers": {
"azureai-production": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "prod-subscription-id",
"AZURE_CLIENT_ID": "prod-service-principal-id",
"AZURE_CLIENT_SECRET": "prod-service-principal-secret",
"AZUREAI_LOG_LEVEL": "warn"
}
},
"azureai-development": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "dev-subscription-id",
"AZURE_CLIENT_ID": "dev-service-principal-id",
"AZURE_CLIENT_SECRET": "dev-service-principal-secret",
"AZUREAI_LOG_LEVEL": "debug"
}
}
}
}
# Required
AZURE_SUBSCRIPTION_ID=your-subscription-id
AZURE_TENANT_ID=your-tenant-id
# Optional - Authentication (uses DefaultAzureCredential if not provided)
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
# AI Providers (OpenRouter recommended for latest models)
OPENROUTER_API_KEY=sk-or-v1-your-openrouter-key
OPENROUTER_COST_MODEL=openai/gpt-4.1-preview
OPENROUTER_SECURITY_MODEL=anthropic/claude-3.5-sonnet:beta
# Alternative - Direct AI Providers
OPENAI_API_KEY=sk-your-openai-key
ANTHROPIC_API_KEY=sk-ant-your-anthropic-key
# Optional - Configuration
AZUREAI_LOG_LEVEL=info
AZUREAI_CACHE_TTL=300
AZUREAI_MAX_CONCURRENT_REQUESTS=10
Generate MCP configuration for your client:
# Generate configuration for Claude Desktop
npx azureai-optimizer config --output claude_desktop_config.json
# Generate configuration with custom settings
npx azureai-optimizer config --transport sse --port 8080
# Display configuration in terminal
npx azureai-optimizer config
The server uses Azure's DefaultAzureCredential
which tries authentication in this order:
az login
credentialsVerify your configuration before using:
# Check Azure connectivity and permissions
npx azureai-optimizer health
# Expected output:
# 🏥 Running health checks...
# ✅ Environment variables configured
# ✅ Azure authentication successful
# ✅ Subscription access confirmed: Production Subscription
# 🎉 All health checks passed!
Once configured, you can use natural language with your AI assistant:
"Analyze my Azure costs for the last 30 days and show me the top optimization opportunities"
"What are my most expensive Azure services this month?"
"Compare this month's Azure spending to last month and identify any anomalies"
"Show me potential cost savings from right-sizing my virtual machines"
"Check my Azure security compliance for SOC2 requirements"
"What security vulnerabilities exist in my Azure environment?"
"Assess my Azure resources against ISO27001 compliance framework"
"Show me the top security risks and how to fix them"
"Analyze the performance of my Azure VMs and identify bottlenecks"
"What resources are underperforming and need optimization?"
"Check for performance issues in my production environment"
"Recommend performance improvements for my Azure infrastructure"
"List all my unused Azure resources that are costing money"
"What VMs can be right-sized to save costs?"
"Show me resources without proper tags"
"Analyze my reserved instance coverage and recommendations"
For programmatic access or custom integrations:
{
"tool": "analyze_cost_optimization",
"arguments": {
"subscription_id": "12345678-1234-1234-1234-123456789012",
"resource_group": "production-rg",
"days_back": 30,
"include_recommendations": true,
"granularity": "daily"
}
}
{
"tool": "security_compliance_check",
"arguments": {
"subscription_id": "12345678-1234-1234-1234-123456789012",
"compliance_framework": "SOC2",
"include_remediation": true,
"severity_filter": "medium"
}
}
{
"tool": "right_size_resources",
"arguments": {
"subscription_id": "12345678-1234-1234-1234-123456789012",
"resource_types": ["VirtualMachines", "SqlDatabases"],
"utilization_threshold": 70,
"analysis_days": 30
}
}
{
"tool": "performance_analysis",
"arguments": {
"subscription_id": "12345678-1234-1234-1234-123456789012",
"resource_group": "production-rg",
"analysis_days": 7,
"performance_threshold": 80
}
}
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ MCP Client │ │ AzureAI Server │ │ Azure APIs │
│ (Claude/GPT) │◄──►│ (NPX Package) │◄──►│ (Cost/Security)│
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ AI Analysis │
│ (Multi-LLM Stack)│
└──────────────────┘
npx -y azureai-optimizer@latest server start
npm install -g @azureai/optimizer
azureai-optimizer server start
docker run -e AZURE_SUBSCRIPTION_ID=your-id azureai/optimizer:latest
az container create \
--resource-group myResourceGroup \
--name azureai-optimizer \
--image azureai/optimizer:latest \
--environment-variables AZURE_SUBSCRIPTION_ID=your-id
Plan | Price/Month | Azure Spend Limit | Features |
---|---|---|---|
Starter | $199 | $10K | Basic optimization, Security assessment |
Professional | $599 | $100K | Advanced optimization, Real-time monitoring |
Enterprise | $1,499 | Unlimited | Multi-subscription, Custom compliance |
We welcome contributions! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
command
and args
are correctnode --version
npx azureai-optimizer health
# Check Azure CLI login
az account show
# Verify subscription access
az account set --subscription your-subscription-id
# Test authentication
npx azureai-optimizer health
# Set required variables
export AZURE_SUBSCRIPTION_ID="12345678-1234-1234-1234-123456789012"
export AZURE_TENANT_ID="87654321-4321-4321-4321-210987654321"
# Verify configuration
npx azureai-optimizer config
# Clear NPX cache
npx clear-npx-cache
# Force latest version
npx -y @azureai/optimizer@latest --version
Client | Configuration File |
---|---|
Claude Desktop (macOS) | ~/Library/Application Support/Claude/claude_desktop_config.json |
Claude Desktop (Windows) | %APPDATA%\Claude\claude_desktop_config.json |
Claude Desktop (Linux) | ~/.config/Claude/claude_desktop_config.json |
VS Code (Cline) | VS Code Settings → Extensions → Cline → MCP Servers |
Continue | .continue/config.json in your project |
Enable debug logging for troubleshooting:
{
"mcpServers": {
"azureai-optimizer": {
"command": "npx",
"args": ["-y", "@azureai/optimizer@latest", "server", "start"],
"env": {
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZUREAI_LOG_LEVEL": "debug"
}
}
}
}
Made with ❤️ for the Azure community
FAQs
AI-Powered Azure Infrastructure Optimization via Model Context Protocol
We found that azureai-optimizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.