Azure Resource Graph MCP Server

Integrations

  • Uses environment variables loaded from .env files to configure the Azure Resource Graph MCP server, particularly for setting up authentication credentials.

  • Serves as the runtime environment for the Azure Resource Graph MCP server, allowing it to execute Azure Resource Graph queries from within Cursor IDE or VS Code.

  • Used for package management and build process for the Azure Resource Graph MCP server.

Demo

Flow

Azure Resource Graph MCP Server

This is a Model Context Protocol (MCP) server that provides access to Azure Resource Graph queries. It allows you to retrieve information about Azure resources across your subscriptions using Resource Graph queries.

Features

  • Query Azure resources using Resource Graph queries
  • Default query returns resource ID, name, type, and location
  • Supports custom Resource Graph queries
  • Uses Azure DefaultAzureCredential for authentication

Prerequisites

  • Node.js installed
  • Azure subscription
  • Azure CLI installed and logged in, or other Azure credentials configured

Running the MCP Server

You can run the MCP server using either Cursor IDE or Visual Studio Code.

Option 1: Cursor IDE Integration

To integrate the MCP server with Cursor IDE:

  1. Clone this repository to your local machine (e.g., C:\YOUR_WORKSPACE\azure-resource-graph-mcp-server)
  2. Build the project:
npm install npm run build
  1. Open Cursor Settings (JSON) and add the following configuration:
{ "mcpServers": { "azure-resource-graph-mcp-server": { "command": "node", "args": [ "C:\\YOUR_WORKSPACE\\azure-resource-graph-mcp-server\\build\\index.js" ], "env": { "SUBSCRIPTION_ID": "xxxxxx-xx-xx-xx-xxxxxx" }, } } }

Note: Make sure to update the path to match your local repository location.

  1. Restart Cursor IDE to apply the changes

Option 2: VS Code Integration

To integrate the MCP server with Visual Studio Code:

  1. Clone this repository to your local machine
  2. Build the project:
npm install npm run build
  1. Open VS Code Settings (JSON) by pressing Ctrl+Shift+P, type "Settings (JSON)" and select "Preferences: Open User Settings (JSON)"
  2. Add the following configuration:
{ "mcp": { "servers": { "azure-resource-graph": { "type": "stdio", "command": "node", "args": [ "C:\\YOUR_WORKSPACE\\azure-resource-graph-mcp-server\\build\\index.js" ], "env": { "SUBSCRIPTION_ID": "xxxxxx-xx-xx-xx-xxxxxx" }, } } } }

Note: Make sure to update the path to match your local repository location.

  1. Save the settings.json file
  2. Restart VS Code to apply the changes

The MCP server will now be available to use within VS Code with cursor integration.

Usage

The server provides the following tool:

query-resources

Retrieves resources and their details from Azure Resource Graph.

Parameters:

  • subscriptionId (optional): Azure subscription ID (defaults to configured ID)
  • query (optional): Custom Resource Graph query (defaults to "Resources | project id, name, type, location")

Environment Setup

  1. First, make sure you're logged in to Azure CLI by running:
    az login
    This step is crucial for local development as the DefaultAzureCredential will automatically use your Azure CLI credentials.
  2. Set up your environment variables:
    • Copy .env.example to .env
    • Update AZURE_SUBSCRIPTION_ID in .env with your actual subscription ID
    • Other variables (AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET) are optional when using Azure CLI authentication
  3. Make sure you have proper Azure credentials configured. The server uses DefaultAzureCredential which supports:
    • Azure CLI
    • Managed Identity
    • Visual Studio Code credentials
    • Environment variables
  4. If using environment variables, set up:
    • AZURE_SUBSCRIPTION_ID
    • AZURE_TENANT_ID
    • AZURE_CLIENT_ID
    • AZURE_CLIENT_SECRET

Error Handling

The server includes robust error handling for:

  • Azure client initialization failures
  • Query execution errors
  • Invalid queries or parameters

Development

To work on this project:

  1. Make changes in the src directory
  2. Build using npm run build
  3. Test your changes by running the server

License

This project is licensed under the MIT License. See the LICENSE file for details.

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

A Model Context Protocol server for querying and analyzing Azure resources at scale using Azure Resource Graph, enabling AI assistants to explore and monitor Azure infrastructure.

  1. Flow
    1. Azure Resource Graph MCP Server
      1. Features
      2. Prerequisites
      3. Running the MCP Server
      4. Usage
      5. Environment Setup
      6. Error Handling
      7. Development
      8. License

    Related MCP Servers

    • A
      security
      A
      license
      A
      quality
      This server provides a convenient API for interacting with Azure DevOps services, enabling AI assistants and other tools to manage work items, code repositories, boards, sprints, and more. Built with the Model Context Protocol, it provides a standardized interface for communicating with Azure DevOps
      Last updated -
      96
      10
      TypeScript
      MIT License
    • A
      security
      A
      license
      A
      quality
      A Model Context Protocol server that enables AI assistants to interact with Azure DevOps resources including projects, work items, repositories, pull requests, branches, and pipelines through a standardized protocol.
      Last updated -
      15
      650
      112
      TypeScript
      MIT License
      • Linux
      • Apple
    • -
      security
      F
      license
      -
      quality
      A reference server implementation for the Model Context Protocol that enables AI assistants to interact with Azure DevOps resources and perform operations such as project management, work item tracking, repository operations, and code search programmatically.
      Last updated -
      3
      TypeScript
    • A
      security
      A
      license
      A
      quality
      A Model Context Protocol server that enables AI assistants to interact with Azure DevOps services, allowing users to query work items with plans to support creating/updating items, managing pipelines, handling pull requests, and administering sprints and branch policies.
      Last updated -
      9
      16
      Python
      MIT License
      • Linux
      • Apple

    View all related MCP servers

    ID: 94rcudrvyv