Back to MCP directory
publicPublicdnsLocal runtime

azure-resource-graph-mcp-server

Azure资源查询MCP服务器,提供跨订阅的Azure资源图查询功能

article

README

🚀 MCP 服务器演示

本项目是一个 Model Context Protocol (MCP) 服务器,可提供对 Azure 资源图查询的访问。借助该服务器,你能够使用资源图查询跨订阅检索 Azure 资源信息,为 Azure 资源管理提供便利。

MCP 服务器演示

🚀 快速开始

先决条件

  • 已安装 Node.js
  • 拥有 Azure 订阅
  • 已安装并登录 Azure CLI,或配置了其他 Azure 凭据

运行 MCP 服务器

你可以通过 Cursor IDE 或 Visual Studio Code 运行 MCP 服务器。

选项 1:Cursor IDE 集成

要将 MCP 服务器集成到 Cursor IDE 中,可按以下步骤操作:

  1. 将此仓库克隆到本地计算机(例如 C:\YOUR_WORKSPACE\azure-resource-graph-mcp-server
  2. 构建项目:
    npm install
    npm run build
    
  3. 打开 Cursor 设置 (JSON) 并添加以下配置:
    {
      "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"
          },
        }
      }
    }
    
  4. 根据需要调整 SUBSCRIPTION_ID 的值。

选项 2:Visual Studio Code 集成

要将 MCP 服务器集成到 Visual Studio Code 中,可按以下步骤操作:

  1. 按照与 Cursor IDE 相同的步骤进行配置。
  2. 确保设置文件路径正确无误。

使用说明

  1. 克隆仓库并安装依赖项:
    git clone https://github.com/yourusername/azure-resource-graph-mcp-server.git
    cd azure-resource-graph-mcp-server
    npm install
    
  2. 构建项目:
    npm run build
    
  3. 启动服务器:
    npm start
    

环境设置

  1. 配置环境变量 SUBSCRIPTION_ID,例如在 .env 文件中添加:
    SUBSCRIPTION_ID=your-subscription-id
    
  2. 确保已安装并登录 Azure CLI。

✨ 主要特性

  • 使用资源图查询 Azure 资源
  • 默认查询返回资源 ID、名称、类型和位置
  • 支持自定义资源图查询
  • 使用 DefaultAzureCredential 进行身份验证

🔧 技术细节

  • 项目使用 Node.js 和 Express 框架开发。
  • 代码结构清晰,易于扩展和维护。

💻 使用示例

基础用法

以下是使用该 MCP 服务器的基本步骤:

  1. 克隆仓库并安装依赖项:
    git clone https://github.com/yourusername/azure-resource-graph-mcp-server.git
    cd azure-resource-graph-mcp-server
    npm install
    
  2. 构建项目:
    npm run build
    
  3. 启动服务器:
    npm start
    

🚫 错误处理

  • 如果出现身份验证错误,请检查 SUBSCRIPTION_ID 是否正确。
  • 如果构建失败,请确保所有依赖项都已正确安装。

📄 许可证

本项目遵循 MIT 许可证。更多细节请参阅 LICENSE 文件。

流程

请求流程

Azure 资源图 MCP 服务器

这是一个 Model Context Protocol (MCP) 服务器,提供对 Azure 资源图查询的访问。它允许您使用资源图查询跨订阅检索 Azure 资源信息。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client