SuperAPI AI Directory

azure-resource-graph-mcp-server

/🏠 - Query, analyze and monitor Azure resources at scale using Azure Resource Graph.

Open website

About this tool

Purpose

This is a Model Context Protocol (MCP) server whose core purpose is to provide access to Azure Resource Graph queries. With this server, users can retrieve detailed information about Azure resources across Azure subscriptions, such as resource ID, name, type, and location. It is suitable for scenarios that require quickly querying and monitoring Azure resources in a development environment.

Main Capabilities

  • Query Azure resources using Resource Graph.
  • The default query returns resource ID, name, type, and location.
  • Supports custom Resource Graph queries.
  • Uses Azure DefaultAzureCredential for authentication.
  • Provides the tool query-resources: retrieves resources and their details from Azure Resource Graph. This tool accepts two optional parameters:
    • subscriptionId(optional): Azure subscription ID, defaults to the configured ID.
    • query(optional): custom Resource Graph query, defaults to Resources | project id, name, type, location.

Usage

Environment Requirements

  • Node.js is installed.
  • An Azure subscription is available.
  • Azure CLI is installed and signed in, or other Azure credentials are configured.

Running the MCP Server

The MCP server can be run through Cursor IDE or Visual Studio Code.

Option 1: Cursor IDE Integration

  1. Clone the repository to your local machine (for example C:\YOUR_WORKSPACE\azure-resource-graph-mcp-server).
  2. Build the project.
  3. Open Cursor settings (JSON) and add the corresponding configuration (make sure to update the path to match the local repository location).
  4. Restart Cursor IDE to apply the changes.

Option 2: VS Code Integration

  1. Clone the repository to your local machine.
  2. Press Ctrl+Shift+P, type "Settings (JSON)" and select "Preferences: Open User Settings (JSON)" to open VS Code settings (JSON).
  3. Add the corresponding configuration.
  4. Save the settings.json file.
  5. Restart VS Code to apply the changes.

The MCP server can then be used in VS Code through the cursor integration.

Environment Setup

  1. First make sure you are signed in to Azure CLI by running az login . This step is critical for local development because DefaultAzureCredential will automatically use Azure CLI credentials.
  2. Set environment variables:
    • Copy .env.example to .env.
    • Update .env in AZURE_SUBSCRIPTION_IDwith the actual subscription ID.
    • Other variables (AZURE_TENANT_ID、AZURE_CLIENT_ID、AZURE_CLIENT_SECRET) are optional when using Azure CLI authentication.
  3. Make sure the correct Azure credentials are configured. The server uses DefaultAzureCredential, which supports:
    • Azure CLI
    • Managed Identity
    • Visual Studio Code credentials
    • Environment variables

If using environment variables, set:

  • AZURE_SUBSCRIPTION_ID
  • AZURE_TENANT_ID
  • AZURE_CLIENT_ID
  • AZURE_CLIENT_SECRET

Development

  • Make changes in the src directory.
  • Build with npm run build .
  • Test changes by running the server.

Applicable Scenarios

  • Query Azure resources across subscriptions in Cursor IDE or VS Code.
  • Need to quickly obtain Azure resource inventories and properties in the development workflow.
  • Perform more granular resource retrieval through custom Resource Graph queries.

Limitations

  • Requires a Node.js environment, an Azure subscription, and valid Azure credentials.
  • The server includes robust error handling for the following situations: Azure client initialization failure, query execution errors, invalid queries or parameters.
  • This project uses the MIT license; for details, please refer to the LICENSE file.

Regarding the specific build commands, configuration JSON content, and installation steps, complete details are not provided in the materials, so they are not provided here.