Skip to main content
Glama

Azure Pricing MCP Server

by msftnadavbh
README.mdβ€’10.1 kB
# Azure Pricing MCP Server πŸ’° [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) [![MCP](https://img.shields.io/badge/MCP-1.0+-green.svg)](https://modelcontextprotocol.io/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) A **Model Context Protocol (MCP)** server that provides AI assistants with real-time access to Azure retail pricing information. Query VM prices, compare costs across regions, estimate monthly bills, and discover available SKUsβ€”all through natural language. <p align="center"> <img src="https://img.shields.io/badge/Azure-Pricing-0078D4?style=for-the-badge&logo=microsoft-azure&logoColor=white" alt="Azure Pricing"/> <img src="https://img.shields.io/badge/VS_Code-MCP-007ACC?style=for-the-badge&logo=visual-studio-code&logoColor=white" alt="VS Code MCP"/> </p> --- ## πŸš€ Quick Start ```bash # 1. Clone the repository git clone https://github.com/msftnadavbh/AzurePricingMCP.git cd azure-pricing-mcp # 2. Set up virtual environment python -m venv .venv source .venv/bin/activate # Linux/Mac # .venv\Scripts\activate # Windows # 3. Install dependencies pip install -r requirements.txt # 4. Test the server python -m azure_pricing_server ``` Then configure your AI assistant (VS Code, Claude Desktop, etc.) to use the MCP server. --- ## ✨ Features | Feature | Description | |---------|-------------| | πŸ” **Price Search** | Search Azure prices with filters (service, region, SKU, price type) | | βš–οΈ **Price Comparison** | Compare costs across regions or between different SKUs | | πŸ’‘ **Cost Estimation** | Calculate monthly/yearly costs based on usage hours | | πŸ’° **Savings Plans** | View 1-year and 3-year savings plan pricing | | 🎯 **Smart SKU Discovery** | Fuzzy matching for service names ("vm" β†’ "Virtual Machines") | | 🌍 **Multi-Currency** | Support for USD, EUR, GBP, and more | | πŸ“Š **Real-time Data** | Live data from Azure Retail Prices API | | 🏷️ **Customer Discounts** | Apply discount percentages to all pricing queries | --- ## πŸ› οΈ Available Tools | Tool | Description | |------|-------------| | `azure_price_search` | Search Azure retail prices with flexible filtering | | `azure_price_compare` | Compare prices across regions or SKUs | | `azure_cost_estimate` | Estimate costs based on usage patterns | | `azure_discover_skus` | List available SKUs for a specific service | | `azure_sku_discovery` | Intelligent SKU discovery with fuzzy name matching | | `get_customer_discount` | Get customer discount information | --- ## πŸ“‹ Installation ### Prerequisites - **Python 3.10+** - **pip** (Python package manager) ### Option 1: Automated Setup ```bash # Windows PowerShell .\setup.ps1 # Linux/Mac/Cross-platform python setup.py ``` ### Option 2: Manual Setup ```bash # Clone repository git clone https://github.com/msftnadavbh/AzurePricingMCP.git cd azure-pricing-mcp # Create virtual environment python -m venv .venv # Activate virtual environment source .venv/bin/activate # Linux/Mac .venv\Scripts\activate # Windows # Install dependencies pip install -r requirements.txt ``` ### Dependencies ``` mcp>=1.0.0 aiohttp>=3.9.0 pydantic>=2.0.0 requests>=2.31.0 ``` --- ## πŸ–₯️ VS Code Integration ### Step 1: Install GitHub Copilot Ensure you have the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) extension installed. ### Step 2: Configure MCP Server Create or edit `.vscode/mcp.json` in your workspace: ```jsonc { "servers": { "azure-pricing": { "type": "stdio", "command": "/absolute/path/to/azure-pricing-mcp/.venv/bin/python", "args": ["-m", "azure_pricing_server"] } } } ``` > **Windows users**: Use the full path with forward slashes or escaped backslashes: > ```json > "command": "C:/path/to/azure-pricing-mcp/.venv/Scripts/python.exe" > ``` ### Step 3: Restart MCP Server 1. Open Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`) 2. Run: **MCP: List Servers** 3. Click the refresh/restart button next to `azure-pricing` ### Step 4: Use in Copilot Chat Open Copilot Chat and ask: ``` What's the price of Standard_D32s_v6 in East US 2? ``` You'll see the MCP tools being invoked with real Azure pricing data! --- ## πŸ€– Claude Desktop Integration Add to your Claude Desktop configuration file: **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` ```json { "mcpServers": { "azure-pricing": { "command": "python", "args": ["-m", "azure_pricing_server"], "cwd": "/path/to/azure-pricing-mcp" } } } ``` --- ## πŸ’¬ Example Queries Once configured, ask your AI assistant: | Query Type | Example | |------------|---------| | **Basic Pricing** | "What's the price of a D4s_v3 VM in West US 2?" | | **Multi-Node** | "Price for 20 Standard_D32s_v6 nodes in East US 2" | | **Comparison** | "Compare VM prices between East US and West Europe" | | **Cost Estimate** | "Estimate monthly cost for D8s_v5 running 12 hours/day" | | **SKU Discovery** | "What App Service plans are available?" | | **Savings Plans** | "Show savings plan options for virtual machines" | | **Storage** | "What are the blob storage pricing tiers?" | ### Sample Response ``` Standard_D32s_v6 in East US 2: - Linux On-Demand: $1.613/hour β†’ $23,550/month for 20 nodes - 1-Year Savings: $1.113/hour β†’ $16,250/month (31% savings) - 3-Year Savings: $0.742/hour β†’ $10,833/month (54% savings) ``` --- ## πŸ§ͺ Testing ### Verify Installation ```bash # Run the server directly (should start without errors) python -m azure_pricing_server # Run tests python test_mcp_server.py ``` ### Test MCP Connection in VS Code 1. Open Command Palette β†’ **MCP: List Servers** 2. Verify `azure-pricing` shows 6 tools 3. Open Copilot Chat and ask a pricing question --- ## 🀝 Contributing We welcome contributions! Here's how to get started: ### Development Setup ```bash # Fork and clone the repository git clone https://github.com/YOUR_USERNAME/azure-pricing-mcp.git cd azure-pricing-mcp # Create development environment python -m venv .venv source .venv/bin/activate # Install dependencies pip install -r requirements.txt # Make your changes # ... # Test your changes python test_mcp_server.py ``` ### Contribution Guidelines 1. **Fork** the repository 2. **Create a branch** for your feature (`git checkout -b feature/amazing-feature`) 3. **Commit** your changes (`git commit -m 'Add amazing feature'`) 4. **Push** to your branch (`git push origin feature/amazing-feature`) 5. **Open a Pull Request** ### Code Style - Follow PEP 8 guidelines - Add type hints for function parameters and return values - Include docstrings for public functions - Test your changes before submitting ### Ideas for Contributions - [ ] Add support for Azure Reserved Instances pricing - [ ] Implement caching for frequently requested prices - [ ] Add more currency support - [ ] Create unit tests for all tools - [ ] Add support for Azure Government/China regions - [ ] Implement price alerts/notifications --- ## πŸ“ Project Structure ``` azure-pricing-mcp/ β”œβ”€β”€ azure_pricing_server.py # Main MCP server implementation β”œβ”€β”€ __init__.py # Package initialization β”œβ”€β”€ __main__.py # Module entry point β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ setup.py # Automated setup script β”œβ”€β”€ setup.ps1 # PowerShell setup script β”œβ”€β”€ test_mcp_server.py # Test suite β”œβ”€β”€ README.md # This file β”œβ”€β”€ QUICK_START.md # Quick start guide β”œβ”€β”€ USAGE_EXAMPLES.md # Detailed usage examples β”œβ”€β”€ config_examples.json # Example configurations └── .vscode/ └── mcp.json # VS Code MCP configuration ``` --- ## πŸ”Œ API Reference This server uses the [Azure Retail Prices API](https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices): ``` https://prices.azure.com/api/retail/prices ``` **No authentication required** - The Azure Retail Prices API is publicly accessible. --- ## πŸ“š Additional Documentation - **[QUICK_START.md](QUICK_START.md)** - Step-by-step setup guide - **[USAGE_EXAMPLES.md](USAGE_EXAMPLES.md)** - Detailed usage examples and API responses - **[config_examples.json](config_examples.json)** - Example configurations --- ## ⚠️ Troubleshooting ### Tools not appearing in VS Code 1. **Check Python syntax**: Ensure no syntax errors in `azure_pricing_server.py` 2. **Verify path**: Use absolute paths in `.vscode/mcp.json` 3. **Restart server**: Command Palette β†’ MCP: List Servers β†’ Restart ### "No module named 'mcp'" ```bash # Ensure you're in the virtual environment source .venv/bin/activate pip install mcp>=1.0.0 ``` ### Connection errors - Check your internet connection - The Azure Pricing API may rate-limit requests (automatic retry is built-in) --- ## πŸ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. --- ## πŸ™ Acknowledgments - **Original Author**: [@charris-msft](https://github.com/charris-msft) - **Current Maintainer + Version 2.0**: [@msftnadavbh](https://github.com/msftnadavbh) - [Model Context Protocol](https://modelcontextprotocol.io/) - The protocol that makes this possible - [Azure Retail Prices API](https://learn.microsoft.com/en-us/rest/api/cost-management/retail-prices/azure-retail-prices) - Microsoft's public pricing API - Contributors and the open-source community --- ## πŸ“¬ Support - **Issues**: [GitHub Issues]([ttps://github.com/msftnadavbh/AzurePricingMCP/issues](https://github.com/msftnadavbh/AzurePricingMCP/issues)) - **Discussions**: [GitHub Discussions]([https://github.com//msftnadavbh/AzurePricingMCP/discussions](https://github.com/msftnadavbh/AzurePricingMCP/discussions)) --- <p align="center"> Made with ❀️ for the Azure community </p>

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/msftnadavbh/AzurePricingMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server