Cover image
Try Now
2025-04-14

Azure MCP服务器

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

Azure MCP Server

A Model Context Protocol (MCP) server implementation that provides programmatic access to Azure Cloud resources through Azure CLI commands. This server enables seamless integration with Azure services and supports a wide range of Azure operations.

Features

Authentication

  • Service Principal authentication support
  • Automatic token management
  • Environment variable configuration

Supported Azure Operations

Compute

  • Virtual Machines (list, show, start, stop, delete, restart)
  • Virtual Machine Scale Sets (list, scale, update)
  • Azure Kubernetes Service (list clusters)

Storage

  • Storage Accounts (list, show, create, delete)
  • Storage Containers (list, create, delete)

App Services

  • Web Apps (list, show, create, delete, start, stop, restart)
  • Function Apps (list, show, delete, start, stop, restart)
  • Deployment management

Networking

  • Virtual Networks (list)
  • Network Security Groups (list)
  • Public IP Addresses (list)

Database

  • SQL Servers (list)
  • Cosmos DB Accounts (list)

Security

  • Key Vaults (list, create, delete)
  • Secrets Management (list, set, delete)
  • Managed Identities (list)

Container Registry

  • Registry Management (list, create, delete, update)
  • Repository Management (list)

Resource Management

  • Resource Groups (list, show, create, delete)
  • Role Assignments (list, create, delete)
  • Role Definitions (list)
  • Subscription Management (list, show)

Prerequisites

  • Python 3.13 or higher
  • Azure CLI installed and configured
  • Azure subscription and appropriate permissions
  • Service Principal with required access

Installation

  1. Clone the repository:
git clone <repository-url>
cd py-az-mcp
  1. Install dependencies using uv:
uv pip install -r requirements.txt

Configuration

  1. Create a Service Principal and configure environment variables by running the utility script:
python create_service_principal.py

This script will:

  • Authenticate you with Azure interactively
  • Create a new Service Principal with Contributor role
  • Automatically generate a .env file with the required credentials:
    • AZURE_CLIENT_ID
    • AZURE_CLIENT_SECRET
    • AZURE_TENANT_ID
    • AZURE_SUBSCRIPTION_ID

Note: The .env file is automatically excluded from git tracking for security purposes.

Claude Desktop Configuration

To use this MCP server with Claude Desktop, configure the following:

  1. Create or update the Claude Desktop configuration file:
{
  "mcpServers": {
    "Azure": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "mcp",
        "run",
        "/your-path-to/py-az-mcp/server-azure.py"
      ]
    }
  }
}

The configuration file is located at:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
  1. Replace YOUR_USERNAME with your actual system username in both paths.

  2. Ensure your virtual environment is properly set up:

cd /Users/YOUR_USERNAME/Source/Code/py-az-mcp
python -m venv .venv
source .venv/bin/activate
pip install mcp[cli]
  1. Verify the configuration:
    • Open Claude Desktop
    • Click on the settings icon (⚙️)
    • Navigate to the "MCP Servers" section
    • The Azure server should be listed and enabled

Note: The server will start automatically when needed by Claude Desktop. Ensure all environment variables from the .env file are properly configured before using Azure commands through Claude.

Usage

  1. Start the MCP server:
uv run --with mcp[cli] mcp run server-azure.py
  1. The server will be available at http://127.0.0.1:6274

Example API Calls

List all subscriptions:

curl -X POST http://127.0.0.1:6274/tool/azure-cli -H "Content-Type: application/json" -d '{"command": "account list --output json"}'

List all resource groups:

curl -X POST http://127.0.0.1:6274/tool/azure-cli -H "Content-Type: application/json" -d '{"command": "group list --output json"}'

Project Structure

  • server-azure.py: Main MCP server implementation with Azure CLI integration
  • create_service_principal.py: Utility script for creating Azure Service Principal
  • pyproject.toml: Project dependencies and configuration
  • .env: Environment variables configuration (not tracked in git)

Error Handling

The server includes comprehensive error handling:

  • JSON validation for all responses
  • Azure CLI error capture and formatting
  • Authentication error handling
  • Parameter validation

Security Considerations

  • Uses Service Principal authentication
  • Supports environment variable configuration for sensitive data
  • Implements proper error handling to prevent information disclosure
  • Validates all input parameters

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

MIT License

Copyright (c) 2025

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

相关推荐

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • sigoden
  • 使用普通的bash/javascript/python函数轻松创建LLM工具和代理。

  • hkr04
  • 轻巧的C ++ MCP(模型上下文协议)SDK

  • RockChinQ
  • 😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack

  • dmayboroda
  • 带有可配置容器的本地对话抹布

  • modelscope
  • 开始以更轻松的方式开始构建具有LLM授权的多代理应用程序。

  • paulwing
  • 使用MCP服务创建的测试存储库

    Reviews

    2.9 (13)
    Avatar
    user_KpHXexCa
    2025-04-23

    As an avid user of the py-az-mcp application by JCallico, I must say it's an outstanding tool. The user experience is seamless, and the functionalities offered are top-notch. The application is well-structured, making it easy to navigate and use. I highly recommend it to anyone looking for a reliable and efficient solution.

    Avatar
    user_c5yIMpiw
    2025-04-23

    As a dedicated user of the py-az-mcp by JCallico, I must say this tool has greatly enhanced my workflows. Its intuitive design and seamless integration have streamlined my processes remarkably. Highly recommend it to anyone seeking efficient and reliable productivity solutions!

    Avatar
    user_LNG7WjMG
    2025-04-23

    As a dedicated user of the py-az-mcp application by JCallico, I am thoroughly impressed by its seamless integration and user-friendly interface. This application not only simplifies my workflow but also enhances productivity by providing efficient solutions within the Azure environment. Highly recommended for anyone looking to streamline their processes!

    Avatar
    user_lUxWUwU3
    2025-04-23

    As a dedicated user of the py-az-mcp application by JCallico, I must say it has revolutionized my workflow. The intuitive design and robust functionality make it an essential tool in my toolkit. Whether I'm debugging or streamlining processes, this app never disappoints. Highly recommend it to anyone seeking efficiency and reliability!

    Avatar
    user_Tn291Sgq
    2025-04-23

    As a devoted user of the py-az-mcp application, I must say it has significantly streamlined my development workflow. JCallico has done a fantastic job creating a user-friendly and efficient tool. The ease of use and seamless integration with my existing projects make it a go-to application for my Python Azure management coding practices. Highly recommend this for anyone looking for a reliable MCP application!

    Avatar
    user_vkNkY2jR
    2025-04-23

    I've been using py-az-mcp by JCallico for a while now, and it has positively transformed my workflow. Its seamless integration and intuitive interface make complex processes straightforward. The support documentation is thorough, which significantly reduces the learning curve. Highly recommend it for anyone looking to optimize their MCP applications!

    Avatar
    user_xRMJILJK
    2025-04-23

    I've been using py-az-mcp for a while now, and I must say it has significantly improved my workflow. JCallico did a fantastic job with this product, making it both user-friendly and powerful. The seamless integration and efficient performance are particularly impressive. Highly recommend it to anyone in need of a reliable MCP application!

    Avatar
    user_AZGUzQJL
    2025-04-23

    The py-az-mcp by JCallico is an outstanding tool that has greatly simplified my workflow. Its user-friendly interface and seamless integration make it a must-have for anyone working in this field. The detailed documentation provided ensures a smooth onboarding process. Highly recommended!

    Avatar
    user_tSs70IIi
    2025-04-23

    As a dedicated user of the py-az-mcp application by JCallico, I must say it has greatly simplified my workflow. The seamless integration and user-friendly interface make it incredibly efficient for managing multiple processes. The Welcome message sets a positive tone right from the start, and the comprehensive documentation is a huge plus. Highly recommended for anyone needing a reliable MCP solution!

    Avatar
    user_gSPpAv5J
    2025-04-23

    As a dedicated user of the py-az-mcp application by JCallico, I've found it to be an exceptional tool. The user interface is intuitive, and the performance is consistently reliable. This product has substantially streamlined my workflow, and the comprehensive documentation available makes it effortless to get started. Highly recommended for anyone looking to enhance their productivity with a robust and efficient application.

    Avatar
    user_zawFpZg2
    2025-04-23

    I've been using py-az-mcp by JCallico and it's been a game-changer for my projects. The ease of use and robust features have significantly streamlined my workflow. Though it lacks a detailed product description and the initial setup can be a bit daunting, once you're up and running, it performs flawlessly. Highly recommended for anyone looking to enhance their application efficiency!

    Avatar
    user_xB8Bhm8V
    2025-04-23

    I've been using the py-az-mcp application by JCallico and I'm thoroughly impressed. The user-friendly interface and seamless functionality make it a standout product. Its integration capabilities and customizable options perfectly meet my needs. Highly recommend this to anyone looking for a reliable MCP solution.

    Avatar
    user_Rxb7lQSd
    2025-04-23

    As a dedicated user of the py-az-mcp application, I must say it has completely transformed my workflow. JCallico has done an excellent job creating this tool, making it highly reliable and user-friendly. The integration and performance are seamless, and I appreciate the attention to detail in every aspect. Highly recommended for anyone looking for an efficient MCP solution!