A Python-based implementation of the Azure Model Context Protocol (MCP) server. Provides Azure resource access and management tools through a lightweight, async JSON-RPC interface compatible with the MCP specification — no Node.js or npm required.
- ✅ Pure Python Implementation: Built with asyncio and the official MCP Python SDK
- ✅ Azure Authentication: Uses
azure.identity.DefaultAzureCredentialfor flexible authentication - ✅ JSON-RPC over stdio: Standard MCP stdio transport for maximum compatibility
- ✅ Azure Management Tools: Access Azure subscriptions, resources, and storage accounts
- ✅ Async/Await: Modern async Python for efficient I/O operations
- Python 3.10 or higher
- Azure subscription and appropriate credentials
git clone https://github.com/dkuwcreator/azure-mcp-python.git
cd azure-mcp-python
pip install -e .pip install -e ".[dev]"The server uses Azure's DefaultAzureCredential, which supports multiple authentication methods in this order:
- Environment Variables:
AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_CLIENT_SECRET - Managed Identity: When running in Azure (VM, App Service, etc.)
- Azure CLI:
az logincredentials - Azure PowerShell:
Connect-AzAccountcredentials - Interactive Browser: As a fallback
For local development, the easiest method is:
az loginStart the MCP server with stdio transport:
python -m azure_mcp.serverOr using the installed script:
azure-mcpThe server exposes the following Azure management tools:
List all Azure subscriptions accessible to the authenticated user.
Parameters: None
Example Response:
Found 2 subscription(s):
- My Dev Subscription (12345678-1234-1234-1234-123456789012) - Enabled
- My Prod Subscription (87654321-4321-4321-4321-210987654321) - Enabled
Get detailed information about a specific Azure subscription.
Parameters:
subscription_id(required): Azure subscription ID
Example:
{
"subscription_id": "12345678-1234-1234-1234-123456789012"
}List all resource groups in an Azure subscription.
Parameters:
subscription_id(required): Azure subscription ID
Example Response:
Found 3 resource group(s):
- rg-webapp-dev (Location: eastus)
- rg-storage-prod (Location: westus2)
- rg-networking (Location: centralus)
List all resources in an Azure subscription or resource group.
Parameters:
subscription_id(required): Azure subscription IDresource_group(optional): Filter by resource group name
Example:
{
"subscription_id": "12345678-1234-1234-1234-123456789012",
"resource_group": "rg-webapp-dev"
}List all storage accounts in an Azure subscription.
Parameters:
subscription_id(required): Azure subscription IDresource_group(optional): Filter by resource group name
Example Response:
Found 2 storage account(s) in subscription:
- mystorageaccount (Standard_LRS, StorageV2) in eastus
- backupstorage (Standard_GRS, StorageV2) in westus2
To use this server with an MCP client (like Claude Desktop), add it to your MCP settings configuration:
Edit your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Add the server configuration:
{
"mcpServers": {
"azure": {
"command": "python",
"args": ["-m", "azure_mcp.server"]
}
}
}The server follows the MCP specification and implements:
- JSON-RPC 2.0: All messages are JSON-RPC compliant
- stdio Transport: Communicates via standard input/output
- Async Operations: Built on asyncio for efficient Azure API calls
- Error Handling: Graceful error handling with informative messages
azure-mcp-python/
├── src/
│ └── azure_mcp/
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Module entry point
│ └── server.py # Main MCP server implementation
├── pyproject.toml # Project configuration and dependencies
├── README.md # This file
└── .gitignore # Git ignore rules
pytestblack src/ruff check src/- mcp: Official Model Context Protocol SDK
- azure-identity: Azure authentication library
- azure-mgmt-resource: Azure Resource Management client
- azure-mgmt-storage: Azure Storage Management client
- azure-mgmt-subscription: Azure Subscription Management client
- click: Command-line interface framework
- anyio: Async I/O library
This Python implementation follows the same design principles as the official Azure MCP server (@azure/mcp):
- ✅ Uses Azure SDK for authentication and resource management
- ✅ Implements MCP specification with stdio transport
- ✅ Provides similar Azure management tools
- ✅ Supports the same authentication methods via DefaultAzureCredential
Key Differences:
- Written in Python instead of TypeScript/Node.js
- Uses Python's async/await instead of JavaScript Promises
- No npm or Node.js runtime required
- Lighter weight and easier to embed in Python applications
If you encounter authentication errors:
- Verify you're logged in:
az login - Check your subscription access:
az account list - Ensure proper RBAC permissions (Reader role minimum)
- Verify the server starts correctly:
python -m azure_mcp.server start - Check stderr for log messages (stdout is reserved for MCP protocol)
- Ensure your MCP client configuration is correct
If you get module import errors:
pip install -e .Contributions are welcome! Please feel free to submit pull requests or open issues.
This project is provided as-is for educational and development purposes.