デモ
流れ
Azure リソース グラフ MCP サーバー
これは、Azure Resource Graph クエリへのアクセスを提供するモデルコンテキストプロトコル (MCP) サーバーです。これにより、Resource Graph クエリを使用して、サブスクリプション全体の Azure リソースに関する情報を取得できます。
特徴
- Resource Graph クエリを使用して Azure リソースをクエリする
- デフォルトのクエリはリソースID、名前、タイプ、場所を返します
- カスタムリソースグラフクエリをサポート
- 認証にはAzure DefaultAzureCredentialを使用します
前提条件
- Node.jsがインストールされている
- Azureサブスクリプション
- Azure CLI がインストールされログインしているか、その他の Azure 資格情報が構成されている
MCPサーバーの実行
MCP サーバーは、Cursor IDE または Visual Studio Code を使用して実行できます。
オプション1: カーソルIDE統合
MCP サーバーを Cursor IDE と統合するには:
- このリポジトリをローカル マシンにクローンします (例:
C:\YOUR_WORKSPACE\azure-resource-graph-mcp-server
) - プロジェクトをビルドします。
- カーソル設定 (JSON) を開き、次の構成を追加します。
注: ローカル リポジトリの場所と一致するようにパスを更新してください。
- 変更を適用するには、カーソル IDE を再起動します。
オプション2: VS Code統合
MCP サーバーを Visual Studio Code と統合するには:
- このリポジトリをローカルマシンにクローンします
- プロジェクトをビルドします。
Ctrl+Shift+P
を押して VS Code 設定 (JSON) を開き、「設定 (JSON)」と入力して、「設定: ユーザー設定 (JSON) を開く」を選択します。- 次の構成を追加します。
注: ローカル リポジトリの場所と一致するようにパスを更新してください。
- 設定.jsonファイルを保存する
- 変更を適用するにはVS Codeを再起動してください。
MCP サーバーは、カーソル統合により VS Code 内で使用できるようになります。
使用法
サーバーは次のツールを提供します。
クエリリソース
Azure Resource Graph からリソースとその詳細を取得します。
パラメータ:
subscriptionId
(オプション): Azure サブスクリプション ID (デフォルトは構成された ID)query
(オプション): カスタム リソース グラフ クエリ (デフォルトは「リソース | プロジェクト ID、名前、タイプ、場所」)
環境設定
- まず、次のコマンドを実行して、Azure CLI にログインしていることを確認します。DefaultAzureCredential によって Azure CLI 資格情報が自動的に使用されるため、この手順はローカル開発にとって重要です。
- 環境変数を設定します。
.env.example
を.env
にコピーする.env
のAZURE_SUBSCRIPTION_ID
実際のサブスクリプション ID に更新します。- Azure CLI 認証を使用する場合、その他の変数 (
AZURE_TENANT_ID
、AZURE_CLIENT_ID
、AZURE_CLIENT_SECRET
) はオプションです。
- 適切なAzure認証情報が設定されていることを確認してください。サーバーはDefaultAzureCredentialを使用しており、以下をサポートしています。
- Azure CLI
- マネージドID
- Visual Studio Code の資格情報
- 環境変数
- 環境変数を使用する場合は、以下を設定します。
- AZURE_サブスクリプション_ID
- AZURE_テナント_ID
- AZURE_クライアントID
- AZURE_クライアント_シークレット
エラー処理
サーバーには、次の堅牢なエラー処理機能が含まれています。
- Azure クライアントの初期化エラー
- クエリ実行エラー
- 無効なクエリまたはパラメータ
発達
このプロジェクトに取り組むには:
src
ディレクトリに変更を加えるnpm run build
を使用してビルドする- サーバーを実行して変更をテストします
ライセンス
このプロジェクトはMITライセンスの下で提供されています。詳細はLICENSEファイルをご覧ください。
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
Azure Resource Graph を使用して Azure リソースを大規模にクエリおよび分析し、AI アシスタントが Azure インフラストラクチャを探索および監視できるようにするモデル コンテキスト プロトコル サーバー。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityThis 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 DevOpsLast updated -9636TypeScriptMIT License
- AsecurityAlicenseAqualityA 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 -15950257TypeScriptMIT License
- -securityFlicense-qualityA 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 -3TypeScript
- AsecurityAlicenseAqualityA 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 -950PythonMIT License