
Azure FinOps MCP Server
io.github.raviteja-pegata由 GitHub 账号 raviteja-pegata 发布v0.1.1更新于 Nov 3, 2026
Azure FinOps MCP: cost, budgets, forecasting and optimization for Claude, VS Code and Cursor.
概览
本地运行的 MCP 服务器,让助手在允许的订阅范围内进行 Azure 成本分析、预算跟踪、支出预测和闲置资源优化。
- 可以做什么
- 列出允许访问的订阅及其友好名称
- 查询成本总额、本月至今支出,以及按服务、资源组、位置、计量或标签的明细,并支持跨订阅汇总
- 查看单个订阅或全部订阅的预算消耗情况
- 查找闲置资源、获取 Azure Advisor 成本优化建议、查看虚拟机 CPU 使用率
- 预测单个订阅或整个订阅组合的月末支出
- 适用场景
- 适合希望用自然语言向助手询问 Azure 支出、预算余量、节省空间或月末预测的场景,尤其是需要跨多个订阅查看时,无需手写查询。
- 运行要求
- 以 Python 包形式本地运行(需 Python 3.11+),通过 stdio 启动;需安装 Azure CLI 并已执行 az login,远程部署时可用托管标识。必须设置 AZURE_ALLOWED_SUBSCRIPTIONS 和 AZURE_DEFAULT_SUBSCRIPTION,可选 FINOPS_CACHE_TTL_SECONDS。所用身份需在每个被查询的订阅上具备 Cost Management Reader、Reader 和 Monitoring Reader 角色。
安装
在 SourceWeft 中
- 打开 控制台中的 Azure FinOps MCP Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Azure FinOps MCP Server
An MCP server that gives LLM clients (Claude Desktop, Claude Code, VS Code, Cursor) conversational access to Azure cost analysis, budget tracking, forecasting, and resource optimization — across multiple subscriptions.
Tools
Discovery
Cost Analysis
Budgets
Optimization
Forecasting
Quick Install
Then add it to your MCP client config using the installed command — no cloning needed:
See the Client Configuration section below for per-client config file locations.
Prerequisites
- Python 3.11+
- Azure CLI installed and logged in (
az login)
Azure RBAC Permissions
The identity running this server (your user, a service principal, or a managed identity) needs three roles assigned on each subscription you want to query:
Assign via Azure CLI
Repeat for each subscription listed in AZURE_ALLOWED_SUBSCRIPTIONS.
Local development (your own user)
Your user already has these roles if you're a subscription Owner or Contributor. If not, ask your Azure admin to assign them.
Managed Identity (Container Apps deployment)
After deploying with deploy.sh, the script automatically assigns these three roles
to the Container App's system-assigned managed identity on each allowed subscription.
No credentials or secrets are needed — DefaultAzureCredential picks up the
managed identity automatically at runtime.
Install
Configure .env
Test with MCP Inspector
The Inspector is a web UI that lets you call tools interactively and see raw JSON-RPC messages. Always test here before connecting to Claude Desktop.
In the Inspector UI:
- Verify Transport Type is STDIO
- Click Connect — should succeed and show "azure-finops" as the server name
- Navigate to Tools, click List Tools — you should see all 15 tools
- Try
list_subscriptionsfirst (no arguments needed) - Try
get_month_to_date_cost(no arguments needed — uses default sub)
Client Configuration
Find the absolute path to your venv's Python first — you'll need it in every config below:
Claude Desktop
Edit claude_desktop_config.json:
Restart Claude Desktop. A tool icon in the chat input confirms the server connected.
VS Code (GitHub Copilot / Agent mode)
Create .vscode/mcp.json in your workspace (or add to user settings.json under "mcp"):
Requires VS Code 1.99+ with the GitHub Copilot extension. Open the Chat panel,
switch to Agent mode, and the azure-finops tools will appear automatically.
Cursor
Create or edit ~/.cursor/mcp.json:
Or add it via Cursor Settings → MCP → Add new global MCP server. Restart Cursor. The tools appear in Cursor's Agent/Composer panel.
Claude Code (CLI)
Remote HTTP (after deploying to Azure Container Apps)
All clients support connecting to the deployed server over HTTP — no local Python needed:
Claude Desktop / Cursor — add to the same config files above:
VS Code — in .vscode/mcp.json:
Claude Web — Settings → Integrations → Add → https://<your-container-app-fqdn>/mcp
Example Prompts
Try these once connected:
- "What are our allowed subscriptions?"
- "What's our total month-to-date spend across all subscriptions?"
- "Which 10 services cost the most on our prod subscription last month?"
- "Break down last quarter's spend by the
costcentertag." - "Are any budgets close to breaching?"
- "Show me idle resources across all our subscriptions."
- "What does Azure Advisor recommend for cost savings?"
- "Is VM
my-analytics-vmactually being used? Check its CPU over 14 days." - "Compare our forecast for this month against our budgets."
Architecture
Key design decisions
Narrow tools over flexible tools. The LLM picks among well-named tools far better than it constructs complex query objects. 15 purpose-built tools beats 3 configurable ones.
Subscription allowlist. A frozenset loaded from env. Every tool calls
resolve_subscription() which refuses any ID not in the list. Prevents the
LLM from querying unauthorized subscriptions — important for prompt injection
defense.
Portfolio tools catch per-sub errors. When querying 5+ subscriptions, one
might have different RBAC or be in a weird state. Portfolio tools (get_portfolio_*)
wrap each sub in try/except so partial results are returned with errors listed
separately.
Cache on Cost Management only. Cost queries are expensive and rate-limited (~30 req/min per tenant). Cost data updates hourly at best. Default 15-minute TTL trades almost nothing in freshness for significant rate-limit headroom. Resource Graph and Advisor are fast and cheap — no caching needed.
Structured returns, not prose. Tools return dicts with columns/rows/metadata. The LLM narrates them naturally. This avoids encoding English into tool responses (which makes them brittle to prompt changes).
Deploying to Azure (Remote Mode)
For team-wide access, deploy as a remote HTTP server:
-
Transport swap in
server.py: -
Dockerfile:
-
Deploy to Azure Container Apps with a user-assigned managed identity.
-
Grant RBAC to the managed identity (same 3 roles: Cost Management Reader, Reader, Monitoring Reader) on each subscription.
-
Add auth via APIM or Azure Front Door + Entra ID. MCP supports OAuth for remote servers.
-
DefaultAzureCredentialpicks up the managed identity automatically — no code changes needed.
Troubleshooting
来源:README.md,提交 ef5b83b
工具
0版本历史
1- v0.1.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分