Azure DevOps Bug Tracker for GitHub Copilot Agent (MCP)

Azure DevOps Bug Tracker for GitHub Copilot Agent (MCP)

Integrates GitHub Copilot Agent with Azure DevOps to fetch, analyze, and report bug data, allowing you to query bugs, generate dashboards, and export reports via natural language.

Category
访问服务器

README

Azure DevOps Bug Tracker for GitHub Copilot Agent (MCP)

A complete solution that integrates GitHub Copilot Agent with Azure DevOps to fetch, analyze, and report bug data using the Model Context Protocol (MCP).

📁 Project Structure

azure-devops-copilot-bugs/
├── .vscode/
│   └── mcp.json                    # MCP server config for Copilot Agent
├── .github/
│   └── copilot-instructions.md     # Copilot Agent instructions
├── src/
│   ├── __init__.py
│   ├── config.py                   # Configuration & env management
│   ├── azure_devops_client.py      # REST API client with retry
│   └── bug_report_generator.py     # Multi-format report generator
├── output/                         # Generated reports
├── main.py                         # CLI entry point
├── requirements.txt                # Python dependencies
├── .env.example                    # Environment variable template
└── README.md                       # This file

🚀 Installation

Prerequisites

  • Python 3.10+
  • Node.js 18+ (for MCP server)
  • VS Code with GitHub Copilot extension
  • Azure DevOps account with PAT token

Step 1: Clone and Install

cd azure-devops-copilot-bugs
pip install -r requirements.txt

Step 2: Configure Environment Variables

# Copy the example env file
cp .env.example .env

# Edit .env with your values

Required variables:

Variable Description Example
AZURE_DEVOPS_ORG_URL Organization URL https://dev.azure.com/myorg
AZURE_DEVOPS_PAT Personal Access Token xxxxxxxxxxxxxxxxxxxxx
AZURE_DEVOPS_PROJECT Project name MyProject

Step 3: Create Azure DevOps PAT

  1. Go to Azure DevOps → User Settings → Personal Access Tokens
  2. Click "New Token"
  3. Set the following scopes:
    • Work Items: Read
    • Project and Team: Read
  4. Copy the generated token to your .env file

Step 4: Configure MCP Server (for Copilot Agent)

The .vscode/mcp.json file is pre-configured. Set environment variables in your system or VS Code settings:

Option A: System Environment Variables (Recommended for production)

[System.Environment]::SetEnvironmentVariable("AZURE_DEVOPS_ORG_URL", "https://dev.azure.com/yourorg", "User")
[System.Environment]::SetEnvironmentVariable("AZURE_DEVOPS_PAT", "your-pat-token", "User")
[System.Environment]::SetEnvironmentVariable("AZURE_DEVOPS_PROJECT", "your-project", "User")

Option B: VS Code Settings Add to your .vscode/settings.json:

{
  "github.copilot.chat.mcpServers.env": {
    "AZURE_DEVOPS_ORG_URL": "https://dev.azure.com/yourorg",
    "AZURE_DEVOPS_PAT": "your-pat-token",
    "AZURE_DEVOPS_PROJECT": "your-project"
  }
}

🖥️ CLI Usage

# Fetch active bugs
python main.py --active

# Fetch P1 and P2 bugs
python main.py --p1p2

# Fetch my bugs
python main.py --my-bugs

# Fetch current sprint bugs
python main.py --sprint

# Fetch specific sprint bugs
python main.py --sprint "MyProject\\Sprint 15"

# Show bug statistics
python main.py --stats

# List saved queries
python main.py --saved-queries

# Export all bugs to all formats
python main.py --all --export all

# Export active bugs to HTML dashboard
python main.py --active --export html

# Export P1/P2 bugs to Excel
python main.py --p1p2 --export excel

🤖 GitHub Copilot Agent Prompts

Use these prompts in VS Code Copilot Chat (Agent Mode):

Basic Queries

@workspace Show me all active bugs in Azure DevOps
@workspace List all P1 and P2 bugs with their assignees
@workspace What bugs are assigned to me?
@workspace Show bugs in the current sprint

Dashboard & Reports

@workspace Generate a daily bug dashboard with statistics
@workspace Create a summary of sprint defects grouped by priority
@workspace Show bug trends by severity for the last 3 sprints

Analysis

@workspace List all blocker bugs that are unassigned
@workspace Which team member has the most open bugs?
@workspace Show me the bug resolution rate for this sprint
@workspace Compare P1 bugs between current and previous sprint

Reporting

@workspace Export all active bugs to an Excel file with priority highlighting
@workspace Generate an HTML bug dashboard for the team standup
@workspace Create a CSV of all bugs created this week

🔧 Troubleshooting

Common Issues

Issue Solution
401 Unauthorized Check PAT token is valid and has correct scopes
404 Not Found Verify organization URL and project name
Connection timeout Check network/VPN connectivity to Azure DevOps
MCP server not starting Ensure Node.js 18+ is installed, run npx -y @anthropic/azure-devops-mcp-server manually to test
No bugs found Verify WIQL query syntax and project has bug work items

Verify PAT Token

curl -u :YOUR_PAT_TOKEN "https://dev.azure.com/yourorg/yourproject/_apis/wit/wiql?api-version=7.1" -H "Content-Type: application/json" -d "{\"query\": \"SELECT [System.Id] FROM WorkItems WHERE [System.WorkItemType] = 'Bug' AND [System.State] = 'Active'\"}"

Debug Logging

Set LOG_LEVEL=DEBUG in your .env file for verbose output:

LOG_LEVEL=DEBUG python main.py --active

MCP Server Debugging

Test the MCP server connection:

npx -y @anthropic/azure-devops-mcp-server --help

Check VS Code Output panel → "GitHub Copilot Chat" for MCP connection logs.

📊 Report Outputs

Format Description Use Case
CSV Comma-separated values Data import, spreadsheets
Excel Formatted .xlsx with colors Stakeholder reports
HTML Interactive dashboard Team standup, sharing
JSON Structured data API integration, automation

🔐 Security Notes

  • Never commit .env files or PAT tokens to source control
  • Use environment variables or Azure Key Vault for production
  • PAT tokens should have minimum required scopes (Work Items: Read)
  • Rotate PAT tokens regularly (recommended: every 90 days)
  • The .gitignore excludes sensitive files

📝 License

MIT License

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选