Skip to content

Latest commit

 

History

History
201 lines (143 loc) · 4.11 KB

File metadata and controls

201 lines (143 loc) · 4.11 KB

Getting Started with PricingCalculator MCP Server for Microsoft Azure

Installation

Prerequisites

  • Node.js 20 or higher
  • npm or yarn
  • Azure subscription (for pricing data)

Quick Install

# Clone or navigate to the project
cd azurepricing.mcp

# Install dependencies
npm install

# Build TypeScript
npm run build

First Run

1. Test the Installation

# Run basic tests
npm test

# Expected output:
✅ Search prices          PASS
✅ Calculate cost         PASS
✅ Terraform estimation   PASS
✅ List resources         PASS

2. Start the MCP Server

# Development mode (auto-reload)
npm run mcp:dev

# Or build and run
npm run mcp:build

The server will start and listen for MCP protocol messages.

VS Code Integration

Step 1: Configure MCP Server

Add to .vscode/settings.json in your Terraform project:

{
  "mcp.servers": {
    "azure-pricing": {
      "command": "node",
      "args": ["/absolute/path/to/azurepricing.mcp/dist/mcp/server.js"]
    }
  }
}

Step 2: Restart VS Code

Close and reopen VS Code to load the MCP server.

First Query

Open Copilot Chat and try:

What's the monthly cost of a Standard_D2s_v3 VM in East US?

Or:

Show me available VMs in the D-series for East US

Available MCP Tools

The server provides 5 tools:

  1. searchPrices - Search Azure pricing by service/SKU/region
  2. calculateCost - Calculate costs with time periods
  3. discoverVmOptions - Find available VM SKUs
  4. estimateTerraformCost - Estimate complete Terraform plan
  5. listSupportedResources - List supported resource types

Quick Examples

Example 1: VM Pricing

Calculate monthly cost for:
- VM: Standard_D2s_v3
- Region: East US
- OS: Linux

Example 2: Terraform Plan Estimation

{
  "planned_values": {
    "root_module": {
      "resources": [
        {
          "type": "azurerm_linux_virtual_machine",
          "values": {
            "size": "Standard_D2s_v3",
            "location": "eastus"
          }
        }
      ]
    }
  }
}

Paste this into Copilot Chat:

Estimate cost for this Terraform plan: [paste JSON]

Example 3: VM Discovery

What VMs are available in the D-series with 4 vCPUs?

Supported Resources

The server supports 11 Terraform resource types:

Resource Discovery Example SKU
Linux VMs ✅ Auto Standard_D2s_v3
Windows VMs ✅ Auto Standard_D2s_v3
AKS Clusters ✅ Auto Standard_D4s_v3
Storage Accounts ❌ Manual Standard LRS
MySQL Databases ❌ Manual GP_Gen5_2
PostgreSQL ❌ Manual GP_Gen5_2
SQL Database ❌ Manual S0
Cosmos DB ❌ Manual Standard
App Service Plans ❌ Manual S1
Public IPs ❌ Manual Static

Next Steps

  1. Read the usage guide: doc/02-usage/README.md
  2. Explore resource types: doc/03-resources/README.md
  3. Learn cost calculations: doc/02-usage/cost-calculation.md
  4. Run comprehensive tests: npm run test:all

Troubleshooting

MCP Server Not Starting

# Check for build errors
npm run build

# Test manually
node dist/mcp/server.js

VS Code Not Finding Server

  1. Check absolute path in settings.json
  2. Restart VS Code
  3. Check VS Code Output panel for errors

No Pricing Data Found

This is normal for some resources due to Azure API pagination. See Testing Guide.

Getting Help

  • Documentation: doc/
  • Examples: examples/
  • Issues: Check error messages in VS Code Output panel

Ready to explore? Continue to Usage Guide


Legal Notice

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.