Skip to main content
Glama
azure-pricing-mcp

azure-pricing-mcp

by amritsc

mcp-azure-pricing-server

An MCP server that lets an AI agent answer Azure pricing questions correctly: "Where is a D4s v5 cheapest?", "What do six of these cost per month on a 3-year savings plan?" It wraps the public Azure Retail Prices API, which needs no auth, and runs over stdio for local clients or Streamable HTTP for remote ones such as Copilot Studio and Microsoft 365 Copilot agents.

CI

Why this exists

Pricing is one of the first things people ask a cloud agent, and the raw API is easy to get wrong. One VM size in one region returns around eleven rows (Spot, Low Priority, DevTest, Windows, reservations), and reservation prices are totals for the whole term even though the unit reads "1 Hour". If a model reads those rows itself, it will confidently quote a Spot price as the normal rate, or a 1-year reservation as an hourly price.

This server puts those rules in code and gives the model four narrow tools. It's also a worked example of MCP tool design: schemas that fail safely, structured output, and caching and rate limiting for a public upstream. The reasoning is in docs/TOOL-DESIGN.md.

Related MCP server: Azure Pricing MCP Server

Tools

Tool

What it does

list_skus

Lists the SKUs a service offers in a region, so the model can find exact names before pricing

compare_regions

Gives the pay-as-you-go price of one VM size across 2–15 regions, cheapest first, with % deltas and the regions where it isn't offered

estimate_monthly_cost

Prices up to 25 VM line items under pay-as-you-go, savings plans (1y/3y) or reservations (1y/3y), with warnings for anything it couldn't price

search_prices

Returns raw price rows for anything else (storage, databases), compacted and capped

All tools return structured content (JSON Schema-typed output) and are annotated read-only.

Architecture

flowchart LR
    subgraph Clients
        A[Claude / VS Code<br/>stdio]
        B[Copilot Studio /<br/>M365 Copilot agent<br/>Streamable HTTP]
    end
    subgraph Server["azure-pricing-mcp"]
        T[Tool layer<br/>schemas + validation]
        C[Catalog rules<br/>row selection, amortization]
        Q[OData builder<br/>allowlist + escaping]
        P[PricingClient<br/>TTL cache · token bucket · retries · paging]
    end
    API[(prices.azure.com<br/>Retail Prices API)]
    S[(Sample catalog<br/>--offline)]
    A --> T
    B --> T
    T --> C --> P
    T --> Q --> P
    P --> API
    P -.-> S

Quickstart

You need Python 3.11+ and uv.

git clone https://github.com/amritsc/mcp-azure-pricing-server
cd mcp-azure-pricing-server
uv sync

# Exercise every tool end to end over stdio, using the bundled sample catalog (no network)
uv run python examples/test_client.py --offline

# Same thing against live Azure prices
uv run python examples/test_client.py

# Run the test suite
uv run pytest

--offline serves a synthetic catalog generated by scripts/make_sample_data.py. It has the same row shapes as the real API, but the prices are made up. The server logs a warning in this mode and tells the model that the numbers aren't real.

Use it from a client

Claude Desktop (claude_desktop_config.json) or any stdio client:

{
  "mcpServers": {
    "azure-pricing": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp-azure-pricing-server", "run", "azure-pricing-mcp"]
    }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "azure-pricing": {
      "type": "stdio",
      "command": "uv",
      "args": ["--directory", "${workspaceFolder}", "run", "azure-pricing-mcp"]
    }
  }
}

Remote (Copilot Studio, Microsoft 365 Copilot agents, anything that needs a URL):

uv run azure-pricing-mcp --transport http --port 8000     # endpoint: http://127.0.0.1:8000/mcp
curl localhost:8000/healthz

To deploy, build the Dockerfile and run it anywhere that serves containers, e.g. Azure Container Apps. Then pass your public hostname with --allowed-host or ALLOWED_HOSTS so DNS-rebinding protection accepts it. To use the server as a declarative agent action, see copilot-agent-authoring-paths, which ships an agent package pointing at it.

Tradeoffs

  • Narrow tools over a generic query tool. A single query(filter) tool would cover more ground, but it would make every model rediscover the row-selection traps, and it would invite OData injection. The narrow tools cover the common questions. search_prices is the escape hatch, with guardrails.

  • API version 2023-01-01-preview. It's the only version that returns savings plan rates. The cost is case-sensitive filter values, so empty results come back with a hint that says so.

  • Commitment pricing is Linux-only. Savings plans and reservations discount compute, not the Windows license, so a compute-only Windows number would be misleadingly low. The tools decline and say why, instead of guessing at license costs.

  • 730 hours a month. This matches the Azure pricing calculator. Reservations always bill all 730, and the estimator enforces that.

  • Client-side rate limiting. The API publishes no limit but does throttle bursts. A token bucket (5 req/s, burst 10) smooths fan-out from compare_regions. Retries back off and honor Retry-After.

  • One hour of caching. Retail prices change a few times a month, so the cache trades a tiny staleness window for much less upstream traffic. The cache is in memory and per replica, which keeps the deployment stateless.

  • Stateless HTTP. No sessions, so any replica can serve any request. Nothing in these tools needs per-session state.

  • Synthetic offline data, plus a weekly live job. Tests stay deterministic and network-free. The scheduled live CI job checks the real API weekly so drift in its shape gets caught. It reports without blocking merges, because the upstream is out of our hands.

Limitations

The server covers retail list prices only, with no EA, MCA or CSP discounts. Estimates cover compute only (no disks, bandwidth or support). Non-USD prices are Microsoft's reference conversions.

License

MIT

Available Tools

4 tools
compare_regionsCompare regionsB
Read-onlyIdempotent

Pay-as-you-go hourly and monthly price of one VM size across regions, cheapest first.

Inputs: regions (required), arm_sku_name (required), os, currency. Returns: os, results, currency, unavailable, +1 more

estimate_monthly_costEstimate monthly VM costB
Read-onlyIdempotent

Monthly cost of a set of virtual machines under one pricing model. Compute only: excludes disks, bandwidth and licenses beyond the Windows VM rate.

Inputs: items (required), pricing, currency. Returns: lines, pricing, currency, warnings, +1 more

list_skusList SKUsA
Read-onlyIdempotent

Distinct SKUs offered for a service in a region, to find exact names before pricing.

Inputs: region (required), service_name (required), limit, name_contains. Returns: hint, skus, region, truncated, +1 more

search_pricesSearch Azure pricesB
Read-onlyIdempotent

Raw price rows for a service, SKU and/or region. Needs at least one of service_name or arm_sku_name. Use when the other tools are too specific, e.g. storage or database meters.

Inputs: limit, region, currency, price_type, +2 more. Returns: hint, rows, truncated, total_matched

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a distinct scope: raw price lookup, SKU discovery, regional VM comparison, and VM cost estimation. The descriptions explicitly position search_prices as the fallback for cases the more specific tools do not cover, reducing overlap confusion.

    Naming Consistency5/5

    All four names use a consistent snake_case verb_noun pattern: search_prices, list_skus, compare_regions, estimate_monthly_cost. The convention is predictable and readable throughout.

    Tool Count5/5

    Four tools is well-scoped for an Azure pricing server: one broad search, one SKU lister, and two higher-level cost comparison/estimation tools. Each tool earns its place without redundancy.

    Completeness4/5

    The core pricing workflow is covered: discover SKUs, search raw prices, compare VM costs across regions, and estimate VM monthly cost. Non-VM monthly cost aggregation and richer pricing models are not directly supported, though search_prices provides a raw fallback.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides AI assistants with real-time access to Azure retail pricing information, enabling price searches, regional cost comparisons, monthly bill estimates, and SKU discovery through natural language queries.
      13
      56
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables querying Azure retail pricing information, comparing costs across regions and SKUs, estimating usage-based expenses, and discovering Azure services with savings plan information through the Azure Retail Prices API.
      16
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables LLMs to query Azure service pricing via the public Azure Retail Prices API, with tools for searching prices, estimating costs, comparing regions, and listing services.
      5
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to query Azure retail pricing, compare costs, estimate bills, and analyze reserved instances, with additional tools for spot VMs, orphaned resources, PTU sizing, Databricks DBU, and GitHub pricing.
      1
      MIT