Skip to main content
Glama
MalinduDilshan

Azure DevOps PR Reviewer MCP Server

Azure DevOps PR Reviewer MCP Server

License: MIT

A Model Context Protocol (MCP) server for automated code reviews on Azure DevOps Pull Requests. This server enables AI assistants like Claude and Kiro to review PRs, validate requirements, post inline comments, and manage the review workflow automatically.

Features

  • Get PR Information: Fetch complete PR details including changed files with full content

  • Validate PRs: Run comprehensive validation checks (status, reviewers, checklist, work items)

  • Post Findings: Create inline comments on specific lines in PR files

  • Set Review Votes: Approve, reject, or request changes on PRs

  • List PRs: Browse open pull requests in repositories

Related MCP server: pr-mcp-server

Installation

Prerequisites

  • Python 3.10 or higher

  • Azure DevOps Personal Access Token (PAT) with Code (Read & Write) permissions

  • Git installed on your system

Setup

  1. Clone this repository:

git clone https://github.com/MalinduDilshan/azdo-code-review-mcp.git
cd azdo-code-review-mcp
  1. Install dependencies:

pip install -r requirements.txt
  1. Create a .env file in the project root:

# Azure DevOps Configuration
AZURE_DEVOPS_ORG=your-organization
AZURE_DEVOPS_PROJECT=your-project
AZURE_DEVOPS_PAT=your-personal-access-token
AZURE_DEVOPS_URL=https://dev.azure.com
AZURE_DEVOPS_USER_DISPLAY_NAME=Your Name
AZURE_DEVOPS_USER_EMAIL=your.email@example.com

# Optional: Skip specific reviewer groups
SKIP_REVIEWER_GROUPS=Group1,Group2

# Optional: Skip validations and jump directly to code review
SKIP_VALIDATIONS=false

Usage

With Kiro AI Assistant

Add to your .kiro/settings/mcp.json:

{
  "mcpServers": {
    "azure-devops-reviewer": {
      "command": "python",
      "args": ["-m", "mcp.server"],
      "cwd": "/path/to/azdo-code-review-mcp",
      "env": {
        "AZURE_DEVOPS_ORG": "your-org",
        "AZURE_DEVOPS_PROJECT": "your-project",
        "AZURE_DEVOPS_PAT": "your-pat"
      }
    }
  }
}

With Claude Desktop

Add to your Claude Desktop configuration:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "azure-devops-reviewer": {
      "command": "python",
      "args": ["-m", "src.mcp.server"],
      "cwd": "/path/to/azdo-code-review-mcp",
      "env": {
        "AZURE_DEVOPS_ORG": "your-org",
        "AZURE_DEVOPS_PROJECT": "your-project",
        "AZURE_DEVOPS_PAT": "your-pat"
      }
    }
  }
}

Standalone Usage

from src.azure_devops import AzureDevOpsConnector

# Initialize connector
connector = AzureDevOpsConnector(
    organization="my-org",
    project="my-project",
    pat="my-personal-access-token"
)

# Get PR information
pr_info = connector.get_pr_info(pr_number=123, repo_name="my-repo")

# Post a comment
connector.post_inline_comment(
    pr_number=123,
    repo_name="my-repo",
    file_path="/src/main.py",
    line_number=42,
    comment_text="Consider adding error handling here"
)

# Set review vote
connector.set_pr_review_vote(
    pr_number=123,
    repo_name="my-repo",
    vote=10  # 10 = Approved, -5 = Waiting for Author
)

Available Tools

get_pr

Fetch PR information and all changed files with content in one call.

Parameters:

  • pr_url (optional): Full Azure DevOps PR URL

  • organization, project, repository, pr_number (alternative to pr_url)

validate_pr

Run comprehensive PR validation checks including status, reviewers, checklist items, and linked work items.

Parameters:

  • Same as get_pr

post_findings

Post code review findings as inline comments on specific lines.

Parameters:

  • PR identification (same as get_pr)

  • findings: Array of objects with:

    • file_path: Path to file in PR

    • line_number: Line number for comment

    • comment: Review comment text

    • severity: (optional) "error", "warning", or "info"

set_vote

Set your review vote on the PR.

Parameters:

  • PR identification (same as get_pr)

  • vote: -10 (Rejected), -5 (Waiting for Author), 0 (No Vote), 5 (Approved with Suggestions), 10 (Approved)

list_prs

List open pull requests in a repository.

Parameters:

  • organization, project, repository

Configuration Options

Environment Variable

Required

Default

Description

AZURE_DEVOPS_ORG

Yes

-

Your Azure DevOps organization name

AZURE_DEVOPS_PROJECT

Yes

-

Default project name

AZURE_DEVOPS_PAT

Yes

-

Personal Access Token with Code (Read & Write) permissions

AZURE_DEVOPS_URL

No

https://dev.azure.com

Base URL for Azure DevOps

AZURE_DEVOPS_USER_DISPLAY_NAME

No

-

Display name for review comments

AZURE_DEVOPS_USER_EMAIL

No

-

Email for review comments

SKIP_REVIEWER_GROUPS

No

-

Comma-separated list of reviewer groups to skip

SKIP_VALIDATIONS

No

false

Skip validation checks and go directly to review

Creating an Azure DevOps PAT

  1. Go to your Azure DevOps organization

  2. Click on User Settings (top right) → Personal Access Tokens

  3. Click "New Token"

  4. Set a name and expiration

  5. Under "Scopes", select:

    • Code: Read & Write

    • Work Items: Read (if using work item validation)

  6. Click "Create" and copy the token immediately

Project Structure

azdo-code-review-mcp/
├── src/
│   ├── azure_devops/      # Core Azure DevOps integration
│   │   ├── base.py        # Base connector with auth
│   │   ├── connector.py   # Main connector class
│   │   ├── models.py      # Data models
│   │   ├── pr_info.py     # PR information retrieval
│   │   ├── pr_diff.py     # Diff analysis
│   │   ├── pr_comments.py # Comment posting
│   │   └── pr_review.py   # Review and voting
│   ├── mcp/               # MCP server implementation
│   │   ├── server.py      # Main MCP server
│   │   ├── schemas.py     # Tool schemas
│   │   └── tools/         # Tool handlers
│   │       ├── get_pr.py
│   │       ├── validate_pr.py
│   │       ├── post_findings.py
│   │       ├── set_vote.py
│   │       └── list_prs.py
│   └── config.py          # Configuration management
├── tests/
│   └── test_server.py     # Component tests
├── .github/               # GitHub Actions and templates
├── .env.example           # Example environment file
├── requirements.txt       # Python dependencies
└── README.md             # This file

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/AmazingFeature)

  3. Commit your changes (git commit -m 'Add some AmazingFeature')

  4. Push to the branch (git push origin feature/AmazingFeature)

  5. Open a Pull Request

License

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

Troubleshooting

Common Issues

"Authentication failed"

  • Verify your PAT is correct and hasn't expired

  • Ensure the PAT has Code (Read & Write) permissions

  • Check that the organization and project names are correct

"Line number out of range"

  • The server validates line numbers against the actual diff

  • Ensure you're commenting on lines that were actually changed in the PR

"Cannot find PR"

  • Verify the PR number, repository name, and project are correct

  • Check that the PR exists and is accessible with your PAT

Support

For issues, questions, or contributions, please use the GitHub Issues page.

Acknowledgments

Built with the Model Context Protocol by Anthropic.

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MalinduDilshan/azdo-code-review-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server