microsoft / microsoft/mcp

Add command: azmcp costmanagement query run

Open
#2,602 2 comments 0 reactions 0 assignees View on GitHub
customer-reported enhancement needs-team-triage server-Azure.Mcp
Dominant language
C#
Stars
3.7k
Forks
624
Avg merge
2d 20h
Merged PRs (30d)
220

Description

## Summary

Add a new `costmanagement` toolset starting with `azmcp costmanagement query run` that retrieves actual Azure costs from the Cost Management Query/Usage API for a subscription or resource group.

## Motivation

Azure MCP Server has no tool to retrieve actual Azure costs today. The only cost-adjacent tool is `azmcp pricing get`, which queries the public retail catalog (estimates, not actual spend). This gap was previously surfaced in:

- #1420 — `[ONBOARD] finops recommenders` (closed Done 2026-02 with no follow-up PR)
- #447 — `Create CostManagement Tool File Structure` (closed without merge 2025-10 due to inactivity)

AWS Billing MCP and GCP have analogous tools; Azure does not.

## Scope of this issue (PR1)

`azmcp costmanagement query run` — read-only, scoped to subscription (optionally narrowed to a resource group). Backed by the GA SDK `Azure.ResourceManager.CostManagement` 1.0.3.

```bash
azmcp costmanagement query run --subscription \
[--resource-group ] \
[--timeframe ] \
[--from ] [--to ] \
[--granularity ] \
[--group-by ]
```

Caller must have `Cost Management Reader` or `Reader` role on the scope.

PR is ready and will be opened from `francesco1501/mcp:feature/add-costmanagement-query` shortly.

cc @anannya03 (CODEOWNER of `tools/Azure.Mcp.Tools.Pricing/` and original assignee of #1420) — would appreciate a sanity check on the design before review.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the analogous tools/Azure.Mcp.Tools.Pricing/ implementation and the Azure.ResourceManager.CostManagement 1.0.3 Query/Usage API. Check the proposed command options and subscription/resource-group scope against the API contract. Done means the read-only query command supports the listed timeframes, date range, granularity, and grouping options.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
api, cli, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.