Skip to main content

Azure Pricing MCP Server - Query Azure resource pricing through MCP

Project description

Azure Pricing MCP Server

Python Version License: MIT

This project provides a Model Context Protocol (MCP) server that allows you to programmatically query Azure resource pricing. The server provides a structured workflow to retrieve pricing information from the Azure Retail Prices API.

Features

  • Query Azure pricing data through a simple, structured workflow
  • Get real-time pricing information from the Azure Retail Prices API
  • Navigate through Azure service families, service names, and products
  • Calculate monthly costs for Azure resources

System Requirements

  • Python 3.8 or higher
  • Internet connection to access the Azure Retail Prices API
  • Permission to install Python packages
  • No Azure account or credentials required (uses public pricing API)

Installation

  1. Clone the repository:

    git clone https://github.com/sboludaf/mcp-azure-pricing.git
    cd mcp-azure-pricing
    
  2. Create and activate a virtual environment:

    python -m venv .venv
    
    • Windows:
      .venv\Scripts\activate
      
    • macOS/Linux:
      source .venv/bin/activate
      
  3. Install the dependencies:

    pip install -r requirements.txt
    

Usage

The MCP server provides a structured four-step workflow for accessing Azure pricing information:

  1. Get service families - Retrieve the list of available Azure service families
  2. Get service names - Get service names within a specific family
  3. Get products - Get products associated with a service
  4. Calculate monthly costs - Calculate the monthly cost for a specific product

Starting the MCP Server

source .venv/bin/activate  # Activate the virtual environment
python azure_pricing_mcp_server.py

The server will start at http://0.0.0.0:8080 by default.

Available Endpoints

  • GET /sse: Server-Sent Events endpoint for MCP communication
  • GET /tools: Lists the available tools in the MCP server

MCP Client Configuration

To configure an MCP client to connect to this server, add the following to your mcp_config.json file:

"azure-pricing": {
  "serverUrl": "http://localhost:8080/sse"
}

This configuration tells the MCP client to connect to the local server on port 8080 using the SSE endpoint. Make sure the URL matches the address and port your server is running on.

MCP Tools

The server provides four main tools that form a logical workflow for querying Azure pricing:

1. list_service_families

Description: Lists all available service families in Azure according to Microsoft's official documentation.

2. get_service_names

Description: Gets all unique service names within a specified service family.

Parameters:

  • service_family: The service family to query (e.g., 'Compute', 'Storage')
  • region: Azure region (default: 'westeurope')
  • max_results: Maximum number of results to process

3. get_products

Description: Gets product names from a specific service family.

Parameters:

  • service_family: The service family to query
  • region: Azure region (default: 'westeurope')
  • type: Price type (optional, e.g., 'Consumption', 'Reservation')
  • service_name: Service name to filter by (optional)
  • product_name_contains: Filter products whose name contains this text (optional)
  • limit: Maximum number of products to return (optional)

4. get_monthly_cost

Description: Calculates the monthly cost of a specific Azure product.

Parameters:

  • product_name: Exact name of the product (e.g., 'Azure App Service Premium v3 Plan')
  • region: Azure region (default: 'westeurope')
  • monthly_hours: Number of hours per month (default: 730)
  • type: Price type (optional, e.g., 'Consumption')

Error Handling

The MCP server includes a robust error handling system that:

  • Provides descriptive error messages when resources cannot be found
  • Properly handles Azure API errors
  • Logs detailed information for debugging purposes

Common Error Scenarios

  • Product not found: When a product name doesn't exist in the specified region
  • Service family not found: When an invalid service family is specified
  • API rate limits: When the Azure Retail Prices API rate limits are exceeded
  • Network errors: When the server cannot connect to the Azure API

Limitations

  • Prices are estimates based on public information from the Azure Retail Prices API
  • Does not include all possible discounts, account-specific offers, or additional costs like taxes or support
  • The Azure Retail Prices API has rate limits that can affect performance with a high volume of requests
  • Prices may vary depending on the region and currency selected
  • Not all Azure resources are available in all regions

Contributing

Contributions are welcome! Here's how you can contribute to this project:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_mcp_azure_pricing-1.0.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_mcp_azure_pricing-1.0.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_mcp_azure_pricing-1.0.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_mcp_azure_pricing-1.0.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mcp_azure_pricing-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6ebb65e7fa1e537e5e9b63eddf0ebd0be51c63bca6bd5fe5d11971fea2930c52
MD5 69b898c7ca650aaddf5d6bb71e437e01
BLAKE2b-256 f5e770dfe8939ab2c889b31959589738522e0961495b38f24df62f33caf64ecb

See more details on using hashes here.

File details

Details for the file iflow_mcp_mcp_azure_pricing-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_mcp_azure_pricing-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mcp_azure_pricing-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1a1c53518ab73615fe8675725da92a1a51cc62553fd82381332f1de0d29b43b
MD5 31ddd9f2094ad57d2d72aec423694f63
BLAKE2b-256 e6e5838020e80f068e495979f5fe2dbd291e1dd692fa0eae157ecae255f6ee9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page