The Azure Pricing MCP Server provides a structured way to query Azure resource pricing information programmatically through the Model Context Protocol (MCP). This server interfaces with the Azure Retail Prices API, allowing you to retrieve real-time pricing data and calculate monthly costs for Azure resources without requiring an Azure account.
Clone the repository:
git clone https://github.com/sboludaf/mcp-azure-pricing.git
cd mcp-azure-pricing
Create and activate a virtual environment:
python -m venv .venv
For Windows:
.venv\Scripts\activate
For macOS/Linux:
source .venv/bin/activate
Install the dependencies:
pip install -r requirements.txt
To start the MCP server:
source .venv/bin/activate # Activate the virtual environment first
python azure_pricing_mcp_server.py
The server will start on http://0.0.0.0:8080
by default.
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"
}
Make sure the URL matches the address and port your server is running on.
The server provides a four-step workflow for accessing Azure pricing information:
First, retrieve the available Azure service families:
Tool: list_service_families
Parameters: (none required)
This will return a list of all service families available in Azure.
Next, get the service names within a specific family:
Tool: get_service_names
Parameters:
- service_family: "Compute" (or another family from step 1)
- region: "westeurope" (optional, default is "westeurope")
- max_results: 50 (optional, limits the number of results)
Once you have a service family and name, you can retrieve products:
Tool: get_products
Parameters:
- service_family: "Compute"
- region: "westeurope" (optional)
- type: "Consumption" (optional)
- service_name: "Virtual Machines" (optional)
- product_name_contains: "VM" (optional)
- limit: 10 (optional)
Finally, calculate the monthly cost for a specific product:
Tool: get_monthly_cost
Parameters:
- product_name: "Azure App Service Premium v3 Plan"
- region: "westeurope" (optional)
- monthly_hours: 730 (optional, default is 730)
- type: "Consumption" (optional)
The server includes robust error handling for common scenarios:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "azure-pricing" '{"command":"python","args":["azure_pricing_mcp_server.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"azure-pricing": {
"command": "python",
"args": [
"azure_pricing_mcp_server.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"azure-pricing": {
"command": "python",
"args": [
"azure_pricing_mcp_server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect