A Model Context Protocol (MCP) server for querying Microsoft Azure pricing and estimating Terraform infrastructure costs.
See Getting Started Guide for detailed installation.
- 🔍 Search Azure Pricing - Query Microsoft Azure Retail Prices API for any service
- 💰 Calculate Costs - Estimate costs with time period conversions (hour/day/month/year)
- 🔎 Service Discovery - Auto-discover available SKUs for 7 service categories
- 📊 Terraform Estimation - Estimate complete Terraform plan costs
- 🎯 54 Resource Types - Support for all major Microsoft Azure services via Terraform
View all 54 supported resources →
Explore Microsoft Azure services before deployment:
- discoverVmOptions - Find VMs by series/OS with specs
- discoverStorageOptions - Compare storage tiers & redundancy
- discoverDatabaseOptions - Explore database SKUs by type/tier
- discoverComputeOptions - Functions, Container Instances, Container Apps
- discoverAppServiceOptions - App Service Plans by tier & OS
- discoverMessagingOptions - Event Hubs, Service Bus, Event Grid
- discoverNetworkingOptions - App Gateway, Firewall, Load Balancer, VPN
- discoverGenericOptions - Fallback for any Microsoft Azure service
Install the miiitchdev.pricingcalc-azure-mcp extension from the VS Code Marketplace:
code --install-extension miiitchdev.pricingcalc-azure-mcpSearch for Microsoft Azure retail prices with filters.
Parameters:
serviceName(string): Microsoft Azure service name (e.g., "Virtual Machines", "Storage")armRegionName(string): Microsoft Azure region (e.g., "eastus", "westeurope")armSkuName(string): SKU name (e.g., "Standard_D2s_v3")productName(string): Product name patternunitOfMeasure(string): Unit (e.g., "1 Hour", "1 GB/Month")limit(number): Max results (default: 10)
Example:
@azure-pricing search prices for Virtual Machines in eastus with SKU Standard_D2s_v3
Calculate cost for a specific Microsoft Azure service.
Parameters:
serviceName(string, required): Service namearmRegionName(string, required): RegionarmSkuName(string): SKU namequantity(number, required): Quantity (e.g., number of VMs, GB)period(string): Time period - "hour", "day", "month" (default), "year"
Example:
@azure-pricing calculate cost for 2 VMs with Standard_D2s_v3 in eastus for 1 month
Discover available VM SKUs with pricing in a region. Helps explore VM options before deployment.
Parameters:
armRegionName(string, required): Microsoft Azure region (e.g., "eastus", "westeurope")osType(string, required): Operating system - "Linux" or "Windows"seriesFilter(string, optional): VM series filter (e.g., "d", "e", "f" for D/E/F-series)limit(number, optional): Maximum results (default: 20)
Note: The osType parameter ensures accurate pricing comparisons by preventing mixing of Linux and Windows VM pricing (which includes Windows Server licensing). Spot VMs are automatically excluded for consistent results.
Example:
@azure-pricing show me available D-series Linux VMs in East US
See VM Discovery Documentation for detailed usage examples.
Estimate total cost for a Terraform plan (resources to be created/updated).
Parameters:
planJson(string, required): Terraform plan JSON (fromterraform show -json tfplan)period(string): Time period - "hour", "day", "month" (default), "year"
Example:
# Generate plan and estimate
terraform plan -out=tfplan
terraform show -json tfplan > plan.json
# Use with MCP
@azure-pricing estimate cost for my terraform planEstimate cost for existing Terraform infrastructure from state file.
Parameters:
stateJson(string, required): Terraform state JSON (fromterraform show -jsonor.tfstatefile)period(string): Time period - "hour", "day", "month" (default), "year"
Example:
# Get current state cost
terraform show -json > state.json
# Use with MCP
@azure-pricing estimate cost for my current terraform stateUse Cases:
- Audit current infrastructure costs
- Track spending over time
- Compare environments (dev vs prod)
Compare costs between current state and planned changes. Shows before/after and delta.
Parameters:
stateJson(string, required): Current Terraform state JSONplanJson(string, required): Terraform plan JSON with changesperiod(string): Time period - "hour", "day", "month" (default), "year"
Example:
# Generate both state and plan
terraform show -json > state.json
terraform plan -out=tfplan
terraform show -json tfplan > plan.json
# Compare costs
@azure-pricing compare costs between my state and planOutput:
- Current state cost
- After changes cost
- Delta ($ and %)
- Impact indicator (increase/decrease/no change)
Use Cases:
- Review cost impact before applying changes
- Infrastructure change approval process
- Budget planning and forecasting
List all 54 supported Terraform resource types.
Example:
@azure-pricing what terraform resources are supported?
Explore storage SKUs with filtering.
Parameters:
armRegionName(required): Microsoft Azure regionstorageType(optional): blob, file, queue, table, datalakeperformanceTier(optional): Standard, PremiumredundancyFilter(optional): LRS, GRS, ZRS, GZRSlimit(optional): Max results (default: 20)
Explore database SKUs by type and tier.
Parameters:
armRegionName(required): Microsoft Azure regiondatabaseType(required): mysql, postgresql, sql, cosmosdb, redis, mariadb, sqlmi, cassandratier(optional): Basic, GeneralPurpose, BusinessCriticalgeneration(optional): Gen4, Gen5limit(optional): Max results (default: 20)
Explore Functions, Container Instances, and Container Apps options.
Parameters:
armRegionName(required): Microsoft Azure regioncomputeType(required): functions, appservice, containerinstances, containerappstier(optional): Basic, Standard, PremiumosType(optional): Linux, Windowslimit(optional): Max results (default: 20)
Discover Azure App Service Plan SKUs and pricing. Filter by tier and OS type.
Parameters:
armRegionName(required): Microsoft Azure regiontier(optional): Basic, Standard, Premium, PremiumV2, PremiumV3, Isolated, IsolatedV2osType(optional): Linux, WindowscurrencyCode(optional): Currency code (default: USD)limit(optional): Max results (default: 20)
Example:
@azure-pricing show me Premium App Service Plans for Linux in westeurope
Explore Event Hubs, Service Bus, Event Grid SKUs.
Parameters:
armRegionName(required): Microsoft Azure regionmessagingType(required): eventhub, servicebus, eventgridtier(optional): Basic, Standard, Premiumlimit(optional): Max results (default: 20)
Explore networking service SKUs.
Parameters:
armRegionName(required): Microsoft Azure regionnetworkingType(required): applicationgateway, firewall, loadbalancer, vpntier(optional): Basic, Standard, Premium, WAFlimit(optional): Max results (default: 20)
Fallback discovery for any Microsoft Azure service.
Parameters:
serviceName(required): Exact Microsoft Azure service namearmRegionName(required): Microsoft Azure regionproductFilter(optional): Filter by product patternskuFilter(optional): Filter by SKU patternunitOfMeasure(optional): Filter by unitlimit(optional): Max results (default: 20)
Example:
@azure-pricing show me Azure Data Factory v2 options in eastus
Prompts are reusable chat prompt templates accessible via @mcp slash commands in VS Code. They guide the AI to orchestrate the tools above into complete workflows.
Estimate the monthly cost of an Azure architecture described in natural language.
Arguments:
description(required): Natural language description of the architectureregion(required): Azure region (e.g., "westeurope")currency(optional): Currency code (default: USD)
Example:
/mcp.pricingcalc-azure-mcp.estimateArchitecture
→ "2 D4s_v3 Linux VMs, a PostgreSQL Flexible Server GP tier, and 500GB blob storage in westeurope"
Analyze a Terraform plan JSON and produce a detailed cost report with per-resource breakdown.
Arguments:
planJson(required): Terraform plan JSON outputcurrency(optional): Currency code (default: USD)
Compare costs between current Terraform state and planned changes with delta analysis.
Arguments:
stateJson(required): Current Terraform state JSONplanJson(required): Terraform plan JSON with proposed changescurrency(optional): Currency code (default: USD)
Find the cheapest Azure VMs matching specific requirements, sorted by price.
Arguments:
region(required): Azure regionos(required): "Linux" or "Windows"minCpu(optional): Minimum vCPUs requiredminRamGb(optional): Minimum RAM in GB required
Example:
/mcp.pricingcalc-azure-mcp.findCheapestVm
→ region: westeurope, os: Linux, minCpu: 4, minRamGb: 16
Compare pricing for an Azure service/SKU across multiple regions.
Arguments:
serviceName(required): Azure service nameskuName(required): SKU nameregions(required): Comma-separated list of regions
Example:
/mcp.pricingcalc-azure-mcp.compareRegionPricing
→ serviceName: Virtual Machines, skuName: Standard_D2s_v3, regions: eastus,westeurope,francecentral
Calculate the monthly budget for a specific Azure service with quantity and cost breakdown.
Arguments:
serviceName(required): Azure service namesku(required): SKU nameregion(required): Azure regionquantity(required): Number of instancescurrency(optional): Currency code (default: USD)
# Initialize and create plan
terraform init
terraform plan -out=tfplan
# Convert to JSON
terraform show -json tfplan > plan.jsonThen use the JSON content with the estimateTerraformCost tool.
See the examples/ directory:
simple-plan.json: Basic VM, storage, and public IPaks-plan.json: Kubernetes cluster with PostgreSQL database
# Build first
npm run build
# Run the server (it will wait for stdin)
node dist/mcp/server.js
# Send a request (paste this JSON and press Enter)
{"jsonrpc":"2.0","id":1,"method":"tools/list"}
# Or test with a tool call
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"listSupportedResources","arguments":{}}}node dist/mcp/server.js
# Then send:
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"estimateTerraformCost","arguments":{"planJson":"<paste-examples/simple-plan.json-content>"}}}src/
├── mcp/
│ └── server.ts # MCP server with 15 tools and 6 prompts
├── pricing/
│ ├── PricingCalculator.ts # Azure Pricing API client with caching
│ ├── PricingDiscovery.ts # Service discovery (VMs, storage, databases, etc.)
│ └── types.ts # TypeScript interfaces
├── calculator/
│ ├── CostCalculator.ts # Cost calculation logic
│ └── UnitConverter.ts # Unit conversion (hours, GB, etc.)
└── terraform/
├── TerraformParser.ts # Parse Terraform plan JSON
├── TerraformCostEstimator.ts # Main orchestrator
└── ResourceMapper.ts # Map TF resources to Azure
The server automatically handles different Azure pricing units:
- Time-based (
1 Hour): VMs, databases → multiply by hours in period - Storage (
1 GB/Month): Storage accounts → quantity is GB capacity - Data Transfer (
1 GB): Network egress → quantity is GB transferred - Static (
1/Month): Public IPs → flat monthly rate - Transactions (
100 Transactions): Storage operations
- Architecture - Technical summary and architecture decisions
- Time Period Handling - Detailed explanation of time calculations (730 hours/month)
- VM Discovery - How to discover and compare VM options
- Resource Type Handling - How different Azure resources are handled
- Resource Workflows - Visual workflows for all resource types
- Other Resources Status - Quick reference for non-VM resources
The server uses Azure's standard calculation:
- 1 month = 730 hours (365 days × 24 hours ÷ 12 months)
- 1 year = 8,760 hours (365 days × 24 hours)
- All calculations assume 24/7 operation unless specified
See Time Period Handling for formulas and examples.
All estimates use Consumption pricing (pay-as-you-go). Reserved Instances and Spot pricing are not included.
- Unsupported Terraform resources are reported but don't fail estimation
- Missing pricing data returns null for specific resources
- All errors include descriptive messages
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run basic tests (4 tests)
npm test
# Run comprehensive resource tests (17 tests)
npm run test:resources
# Run VM discovery tests
npm run test:discovery
# Run all tests
npm run test:all
# Development mode with auto-reload
npm run mcp:dev
# Build and run server
npm run mcp:buildSee TESTING.md for detailed testing documentation.
Test Suites:
npm test- Basic functionality (4 tests)npm run test:resources- Resource type mapping testsnpm run test:discovery- VM discoverynpm run test:all- Complete test suite
Note: Resource tests may show warnings for missing pricing data. This is normal due to Azure API pagination and availability. Tests validate code logic, not API data completeness.
Base URL: https://prices.azure.com/api/retail/prices
API Version: 2023-01-01-preview
OData Filters Supported:
serviceName eq 'Virtual Machines'armRegionName eq 'eastus'armSkuName eq 'Standard_D2s_v3'contains(productName, 'Linux')type eq 'Consumption'
Make sure the server is running and accessible:
node dist/mcp/server.jsYou should see: PricingCalculator MCP Server for Microsoft Azure running on stdio
- Check region name (use
armRegionNamelike "eastus", not "East US") - Verify SKU name is correct (e.g., "Standard_D2s_v3")
- Some resources may not have pricing data in all regions
- Ensure you're using JSON format:
terraform show -json tfplan - Check that resource types are supported: use
listSupportedResourcestool - Verify the plan includes
resource_changesarray
To add support for new Terraform resource types:
- Add mapping to
src/terraform/ResourceMapper.ts - Define
serviceName,extractSku, andskuField - Rebuild and test
MIT
Microsoft, Azure, Terraform, and GitHub are trademarks of their respective owners.
This is an independent open-source project and is not affiliated with, endorsed by, or sponsored by Microsoft Corporation, HashiCorp, Inc., or GitHub, Inc.
This tool is designed to work with Microsoft Azure services and the Terraform infrastructure-as-code tool.