Token导航 LogoToken导航TokenDH.com
Azure Devops Pullrequest MCP Server logo
运维云端未说明官方级别未说明来源级核验

Azure Devops Pullrequest MCP Server

MCP Server

一个基于Model Context Protocol的服务器实现,专注于Azure DevOps拉取请求的交互,提供拉取请求详情获取、评论管理等功能。

工具数

3

提示词数

0

GitHub Stars

1

资源数

0
Azure DevOps代码审查C#开发工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

oshvartz

提供方

oshvartz

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

Azure DevOps拉取请求MCP服务器

一个专注于Azure DevOps拉取请求交互的模型上下文协议(MCP)服务器实现。此服务器提供用于访问和操纵Azure DevOps拉取请求的工具,这些工具使用ModelContextProtocol NuGet包构建。

概述

此MCP服务器被设计为一个学习项目,旨在通过模型上下文协议演示与Azure DevOps拉取请求API的集成。它提供了以下工具:

  • 正在检索拉取请求详细信息
  • 获取拉取请求线程/注释
  • 在特定代码位置创建新的注释线程

项目状态

免责声明:该项目仍在进行中(WIP)

即将推出的功能

  • \[\]将服务器打包为一个.NET工具,以便于安装和使用
  • \[\]增强的线程支持:

- \[\]能够响应现有线程 - \[\]向现有线程添加注释 - \[\]更好的线程管理功能

使用示例

PR审查工作流程

要执行拉取请求审核,您可以使用以下提示模板:

I want us to review together PR https://dev.azure.com/org/project/_git/repo/pullrequest/123 
First let's have high level review of the PR context and then let's drill down to changed files 
and what was changed there - please share if you have any suggestions or you notice any issues. 
Please verify you are in the local folder of the repo we are doing PR on and switch to the PR 
branch to be able to look at files.

这将触发以下工作流程:

  1. 使用GetPrDetails工具检索PR详细信息
  2. 分析公关背景和范围
  3. 查看本地仓库中更改的文件
  4. 使用CreatePrThread工具提供建议

创建新线程

var input = new AdoCreateThreadInput 
{
    PrUrl = "https://dev.azure.com/org/project/_git/repo/pullrequest/123",
    Content = "Consider using a more descriptive variable name",
    Context = new ThreadContext 
    {
        FilePath = "src/file.cs",
        StartLine = 10,
        EndLine = 10
    }
};

示例复习环节

Prompts you can use during the review:

1. Get PR Overview:
"Let's review PR https://dev.azure.com/org/project/_git/repo/pullrequest/123"

2. Focus on Specific File:
"Can you analyze the changes in src/file.cs?"

3. Add Comment:
"Please add a comment on line 45 of src/file.cs suggesting to use async/await"

4. Get Existing Comments:
"Show me all the review comments in this PR"

这些提示中的每一个都将使用适当的MCP工具:

  • 获取PR信息的详细信息
  • GetPrThreads用于现有评论
  • CreatePrThread用于添加新评论

需求

  • .NET 8.0 SDK
  • 以下身份验证方法之一:

1. 推荐:Azure身份验证

- 使用Azure中的DefaultAzureCredentials。身份 - 更安全,因为它支持托管身份和其他Azure身份验证方法 - 无需PAT

1. 传统:个人访问令牌(PAT)

- 出于安全原因不建议使用 - 如果必须使用PAT,则需要以下范围: - Code (Read & Write) - Pull Request Threads (Read & Write)

构建和安装MCP服务器

  1. 克隆此存储库
  2. 构建项目:
dotnet build -c Release
  1. 通过修改MCP设置JSON文件,将MCP服务器添加到VSCode设置中。

将以下配置添加到 mcpServers 配置文件中的对象:

{
  "mcpServers": {
    "azure-devops-pr": {
      "autoApprove": [],
      "disabled": false,
      "timeout": 60,
      "command": "dotnet",
      "args": ["path/to/bin/Release/net8.0/AzureDevopsPullrequestMcpServer.dll"],
      "env": {
        // Optional: Only needed if using PAT authentication (not recommended)
        // "AZURE_DEVOPS_PAT": "your-pat-token"
        // If AZURE_DEVOPS_PAT is not set, DefaultAzureCredential will be used
      },
      "transportType": "stdio"
    }
  }
}

替换:

  • path/to 包含构建DLL的实际路径
  • your-pat-token 使用Azure DevOps个人访问令牌(仅当使用PAT身份验证时)

注意:如果配置中未提供AZURE_DEVOPS_PAT,服务器将自动使用DefaultAzureCredential进行身份验证,这是推荐的方法。

配置选项:

  • timeout:操作超时(秒)(默认值:60)
  • transportType:通信协议(使用“stdio”)
  • disabled:服务器是否已禁用
  • autoApprove:不需要明确批准的操作列表

服务器将在“已连接的MCP服务器”部分显示为:

azure-devops-pr (dotnet path/to/AzureDevopsPullrequestMcpServer.dll)

使用以下可用工具:

  • GetPr详情
  • GetPrThreads
  • 创建线程

用法

该应用程序支持两种身份验证方法:

  1. 使用Azure身份(推荐)
# DefaultAzureCredential will be used automatically if PAT is not provided
dotnet run -- --pr-url 
  1. 使用个人访问令牌(传统)
# Not recommended for security reasons
dotnet run -- --pat  --pr-url 

例子:

# Using Azure Identity (Recommended)
dotnet run -- --pr-url https://dev.azure.com/org/project/_git/repo/pullrequest/123

# Using PAT (Not Recommended)
dotnet run -- --pat abc123... --pr-url https://dev.azure.com/org/project/_git/repo/pullrequest/123

可用工具

GetPr详情

检索特定拉取请求的详细信息。

输入架构:

{
  "prUrl": "string",
  "includeStatuses": ["string"] | null,
  "excludeStatuses": ["string"] | null
}

GetPrThreads

从pull请求中获取注释线程。

输入架构:

{
  "prUrl": "string",
  "includeStatuses": ["string"] | null,
  "excludeStatuses": ["string"] | null
}

创建线程

在代码中的特定位置创建新的注释线程。

输入架构:

{
  "prUrl": "string",
  "content": "string",
  "context": {
    "filePath": "string",
    "startLine": number | null,
    "startOffset": number | null,
    "endLine": number | null,
    "endOffset": number | null
  }
}

发展

内置:

  • C网
  • ModelContextProtocol NuGet包
  • Azure DevOps REST API

项目结构

  • src/Models/ -拉取请求和线程的数据模型

- PullRequestDetails.cs -PR数据结构 - PullRequestThread.cs -线程和评论模型 - AdoCreateThreadInput.cs -线程创建输入模型

  • src/Services/

- AdoPullRequestTool.cs -核心API通信服务

  • src/Utils/

- IUrlParser.cs -URL处理实用程序

贡献

这是一个演示MCP服务器实现的学习项目。您可以将其用作构建自己的MCP服务器或扩展其功能的参考。

许可证

MIT许可证

目录标签

目录标签

Azure DevOps代码审查C#开发工具AzureDevOps本地部署拉取请求MCP服务器

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明token部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP