azure mcp
Enables natural language interaction with Azure services through Claude Desktop, supporting resource management, subscription handling, and tenant selection with secure authentication.
Enables natural language interaction with Azure services through Claude Desktop, supporting resource management, subscription handling, and tenant selection with secure authentication.
A Model Context Protocol (MCP) implementation that enables Claude Desktop to interact with Azure services. This integration allows Claude to query and manage Azure resources directly through natural language conversations.
Clone the repository:
git clone https://github.com/Streen9/azure-mcp.git
cd azure-mcp
Install dependencies:
npm install
Configure Claude Desktop:
claude_desktop_config.json
{
"mcpServers": {
"sequential-thinking": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sequential-thinking"
]
},
"azure": {
"command": "tsx",
"args": [
"C:/Users/[YourUsername]/path/to/azure-mcp/src/launcher.ts"
]
}
}
}
The server supports multiple authentication methods through DefaultAzureCredential: - Environment Variables - Managed Identity - Azure CLI - Visual Studio Code - Interactive Browser
The server will automatically try these methods in sequence until one succeeds.
You: Can you get all the available Azure accounts and subscriptions?
Claude: I'll help you list all available Azure tenants and subscriptions.
[Claude will then use the Azure MCP to fetch and display the information]
azure-mcp/
├── src/
│ ├── launcher.ts # Server entry point
│ ├── AzureServer.ts # Main MCP server implementation
│ └── LoggerService.ts # Logging utility
├── package.json
└── README.md
az login
)Verify your Azure account has necessary permissions
Connection Issues:
Ensure no other instances are running
Common Errors:
NO_TENANT
: Select a tenant using the 'select-tenant' toolNO_CLIENTS
: Ensure proper initialization and authenticationCODE_EXECUTION_FAILED
: Check Azure permissions and connectionContributions are welcome! Please feel free to submit a Pull Request.
This implementation follows Azure security best practices: - No hardcoded credentials - Secure credential chain implementation - Proper error handling and sanitization
For security concerns or vulnerabilities, please create an issue.
[
{
"description": "Run Azure code",
"inputSchema": {
"properties": {
"code": {
"description": "Your job is to answer questions about Azure environment by writing Javascript code using Azure SDK. The code must adhere to a few rules:n- Use the provided client instances: 'resourceClient' for ResourceManagementClient and 'subscriptionClient' for SubscriptionClientn- DO NOT create new client instances or import Azure SDK packagesn- Use async/await and promisesn- Think step-by-step before writing the coden- Avoid hardcoded values like Resource IDsn- Handle errors gracefullyn- Handle pagination correctly using for-await-of loopsn- Data returned must be JSON containing only the minimal amount of data neededn- Code MUST "return" a value: string, number, boolean or JSON object",
"type": "string"
},
"reasoning": {
"description": "The reasoning behind the code",
"type": "string"
},
"subscriptionId": {
"description": "Azure Subscription ID",
"type": "string"
},
"tenantId": {
"description": "Azure Tenant ID",
"type": "string"
}
},
"required": [
"reasoning",
"code"
],
"type": "object"
},
"name": "run-azure-code"
},
{
"description": "List all available Azure tenants",
"inputSchema": {
"properties": {},
"required": [],
"type": "object"
},
"name": "list-tenants"
},
{
"description": "Select Azure tenant and subscription",
"inputSchema": {
"properties": {
"subscriptionId": {
"description": "Azure Subscription ID to select",
"type": "string"
},
"tenantId": {
"description": "Azure Tenant ID to select",
"type": "string"
}
},
"required": [
"tenantId",
"subscriptionId"
],
"type": "object"
},
"name": "select-tenant"
}
]