ADO工作流MCP服务器
   
MCP服务器暴露 ado工作流 因为工具需要人工智能代理。使Copilot和其他MCP客户端能够发现 Azure DevOps存储库,管理拉取请求,并与PR评论交互 以及评论。
快速安装
*单击上面的徽章,一键安装,或按照手动安装 在......下面*
特性
- 存储库发现:使用Azure DevOps遥控器扫描目录中的git repos
- 公关生命周期:创建拉取请求,从URL或ID建立PR上下文
- 评论管理:检查审阅者投票,检测过时的批准,找到需要注意的PR
- 评论工作流:分析、发布、回复和批量解决PR评论线程
- 会话缓存:缓存存储库上下文以避免冗余的git CLI查找
- 错误处理:可操作的错误和建议,通过 可操作的错误
MCP工具
存储库发现
| 工具 | 说明 |
|---|---|
repository_discovery | 使用Azure DevOps remotes扫描目录中的git repos,选择最佳匹配项 |
set_repository_context | 缓存会话的存储库上下文(避免冗余的git CLI查找) |
get_repository_context_status | 检查当前缓存的上下文状态以进行调试 |
clear_repository_context | 重置缓存上下文,强制重新发现 |
拉取请求
| 工具 | 说明 |
|---|---|
establish_pr_context | 解析PR URL或将数字PR ID解析为可重用的上下文 |
create_pull_request | 使用可选的标题、描述和草稿模式从分支名称创建新的PR |
公关评论
| 工具 | 说明 |
|---|---|
get_pr_review_status | 获取审阅者投票、提交历史记录并检测过时的批准 |
analyze_pending_reviews | 在存储库中发现需要审查的PR |
PR评论
| 工具 | 说明 |
|---|---|
analyze_pr_comments | 使用作者统计信息按状态对评论线程进行分类 |
post_pr_comment | 向PR发布新的评论帖子 |
reply_to_pr_comment | 回复现有评论帖子 |
resolve_pr_comments | 批量解析注释线程(部分成功语义) |
安装
快速安装(推荐)
点击顶部的徽章之一,自动安装到VS Code中!
手动安装
cd ado-workflows-mcp
uv sync --all-extrasVS代码/副驾驶配置
添加到您的VS代码设置或 .vscode/mcp.json:
{
"mcp.servers": {
"ado-workflows": {
"command": "uvx",
"args": ["--from", "git+https://github.com/grimlor/ado-workflows-mcp", "ado-workflows-mcp"],
"description": "Azure DevOps workflow automation tools"
}
}
}服务器通过stdio使用 模型上下文协议.
认证
使用Azure DefaultAzureCredential 通过 ado工作流 图书馆。使用任何方法进行身份验证 DefaultAzureCredential 支持:
az login # Azure CLI (local dev)
az login --use-device-code # Headless / SSH托管身份、环境变量和其他凭据提供程序在托管环境中自动工作。
错误处理
所有错误均以结构化形式返回 ActionableError 对象具有:
error/suggestion--人类可读的上下文ai_guidance--机器可读恢复指令(action_required,checks,steps,command,discovery_tool)
错误以数据形式返回,从不引发错误——MCP传输保持干净。
典型工作流程
1. repository_discovery → find the ADO repo
2. set_repository_context → cache it for the session
3. establish_pr_context → resolve a PR URL or ID
4. get_pr_review_status → check approval state
5. analyze_pr_comments → see active threads
6. post_pr_comment / reply → leave feedback
7. resolve_pr_comments → mark threads as fixed发展
uv run task check # lint + type + test (all-in-one)
uv run task test # Run tests (37 BDD specs)
uv run task cov # Run tests with coverage
uv run task lint # Lint (with auto-fix)
uv run task format # Format code
uv run task type # Type check注: uv run 当通过direnv激活venv时,它是可选的。项目结构
src/ado_workflows_mcp/
├── server.py # FastMCP server entry point
├── mcp_instance.py # MCP singleton
├── tools/
│ ├── repositories.py # Repository discovery tools
│ ├── repository_context.py # Session context management
│ ├── pull_requests.py # PR lifecycle tools
│ ├── pr_review.py # Review status tools
│ ├── pr_comments.py # Comment workflow tools
│ └── _helpers.py # Shared error-handling utilities
└── py.typed # PEP 561 marker测试
10个需求类别的37个BDD规范 --按消费者需求组织, 不是代码结构。
| 需求类别 | 规格 | 覆盖范围 |
|---|---|---|
| TestRepositoryDiscovery | 3 | 成功,工作目录失败,SDK失败 |
| TestSetRepositoryContext | 3 | 有效上下文,缺少字段,SDK失败 |
| TestGetRepositoryContextStatus | 3 | 已填充、为空、错误 |
| TestClearRepositoryContext | 2 | 重置+清除状态 |
| TestEstablishPRContext | 3 | URL解析、ID解析、SDK失败 |
| TestCreatePullRequest | 3 | 成功,缺少分支,SDK失败 |
| TestGetPRReviewStatus | 3 | 成功,PR无效,SDK失败 |
| TestAnalyzePendingReviews | 3 | 结果,空,SDK失败 |
| TestAnalyzePRC评论 | 3 | 已分类,无线程,SDK失败 |
| TestPostPRComment | 3 | 有效帖子,内容为空,SDK失败 |
| TestReplyToPRComment | 3 | 有效回复,缺少线程,SDK失败 |
| TestResolvePRComments | 3 | 批量解析,空列表,SDK失败 |
文档
- 建筑 --工具层、错误传播和设计决策
相关
许可证
该项目根据 MIT许可证.
