Skip to content

ms-zhenhua/azurerm-reviewer-mcp

Repository files navigation

Azure Resource Manager Reviewer MCP

An AI-powered code review assistant for AzureRM Terraform Provider using the Model Context Protocol.

Overview

This tool provides automated code review capabilities for new resources of AzureRM Terraform Provider. It integrates with Visual Studio Code through the Model Context Protocol to analyze pull requests or local files for common issues and best practices based on the AzureRM Provider Contributor Guides.

⚠️ Important Limitations

  • This is an auxiliary tool that supplements, but does not replace, manual code review
  • This tool only reviews newly added files in a pull request
  • May produce false positives or miss certain types of errors
  • Should be used in conjunction with human review and testing

Prerequisites

Before getting started, ensure you have the following installed:

  1. Visual Studio Code - The primary development environment
  2. UV Package Manager - For dependency management
  3. GitHub Personal Access Token - For accessing GitHub repositories

Installation and Setup

1. Clone the Repository

git clone https://github.com/ms-zhenhua/azurerm-reviewer-mcp
cd azurerm-reviewer-mcp

2. Enable MCP Support in VS Code

Follow the official documentation to enable MCP support in VS Code.

3. Configure MCP Server

Create a .vscode/mcp.json file in your workspace following the MCP server configuration guide.

Configuration Template

Use the template below and replace the placeholder values:

File: .vscode/mcp.json

📋 Reference: See example configuration for a complete example.

Configuration Parameters

Parameter Description
<replace_with_your_absolute_path> The absolute path to your cloned azurerm-reviewer-mcp repository
MAX_TOKENS Maximum token limit for the LLM (e.g., 200000)
RESULT_DIRECTORY Directory path where review results will be stored. Make sure this directory can be accessed by both the MCP client and MCP server
MAX_RULE_LENGTH_PER_PROMPT (Optional) Maximum character limit for rules included in each prompt (e.g., 10000). Smaller values improve LLM accuracy by reducing context complexity but require more prompt calls to process all rules. Defaults to half of the MAX_TOKENS value
{
    "inputs": [
        {
            "type": "promptString",
            "id": "github-token",
            "description": "GitHub token for azurerm code reviewer MCP",
            "password": true
        }
    ],
    "servers": {
        "azurerm-code-reviewer-mcp": {
            "type": "stdio",
            "command": "uv",
            "args": [
                "--directory",
                "<replace_with_your_absolute_path>/azurerm-reviewer-mcp",
                "run",
                "server.py"
            ],
            "env": {
                "GITHUB_TOKEN": "${input:github-token}",
                "MAX_TOKENS": "<replace_with_your_max_token>",
                "RESULT_DIRECTORY": "${workspaceFolder}/<replace_with_your_result_directory>"
            }
        }
    }
}

4. Start the MCP Server

  1. Open .vscode/mcp.json in VS Code and start the azurerm-code-reviewer-mcp server

    Start Server

  2. Enter your GitHub Personal Access Token when prompted

    Input GitHub Token

Usage

The tool provides two main review capabilities:

🔍 Review Pull Requests

Analyze entire pull requests from GitHub repositories.

  1. Open Copilot Chat: Type / in the copilot chatbox

  2. Select Command: Choose mcp.azurerm-code-reviewer-mcp.review_pull_request

    Start PR Prompt

  3. Enter PR URL: Input the GitHub pull request link

    Input PR Link

  4. Start Review: Send the prompt to begin the automated review until the final result is generated in review_result.md.

    Run PR Review

📁 Review Local Files

Analyze individual files on your local system.

  1. Open Copilot Chat: Type / in the copilot chatbox

  2. Select Command: Choose mcp.azurerm-code-reviewer-mcp.review_file

    Start File Prompt

  3. Enter File Path: Input the absolute path to the file you want to review

    Input File Path

  4. Start Review: Send the prompt to begin the file analysis until the final result is generated in review_result.md.

    Run File Review

Contributing

We welcome contributions to improve the azurerm-reviewer-mcp tool. Please feel free to:

  • Report issues
  • Suggest new features
  • Submit pull requests
  • Improve documentation

License

This project is licensed under the terms specified in the LICENSE file.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages