mcpField
A
azure-devops-skill

azure-devops-skill

github.com/julianobarbosaクラウド・DevOps1461 回インストール2 日前に更新
リポジトリ

azure-devops-skill について

azure-devops-skillは、Azure DevOps REST API v7.2を扱う開発者やチーム向けのリファレンススキルです。作業項目、パイプライン、リポジトリ、テスト、Wiki、検索のAPI操作や認証、クエリ、MCPツール名を説明します。

主な機能

  1. 01作業項目の検索と更新
  2. 02パイプラインとビルドの操作
  3. 03リポジトリ、ブランチ、プルリクエストの管理
  4. 04テスト計画とテストケースの管理
  5. 05Wikiとコードの検索操作
  6. 06認証とAPIのガイド

活用シーン

  1. 01担当作業項目の確認や更新
  2. 02パイプラインの実行とビルドログの確認
  3. 03リポジトリ、ブランチ、プルリクエストの確認
  4. 04テストケースの管理とプロジェクト情報の検索

MCP 対応

作業項目、パイプライン、リポジトリ、テスト計画、Wiki、検索などのAzure DevOps MCPツール名を掲載し、利用時のリファレンスとして機能します。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/julianobarbosa/claude-code-skills --skill azure-devops-skill

インストール後、Claude Code で/azure-devops-skillを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
git-repos-reference.md
pipelines-reference.md
test-plans-reference.md
wiki-search-reference.md
work-items-reference.md
scripts/
ado-cli.sh
pipelines.py
pull-requests.py
work-items.py

詳細

Azure DevOps REST API スキル

作業項目、パイプライン、リポジトリ、テスト計画、Wiki、検索機能など、Azure DevOps REST API v7.2 の操作に関する包括的なガイドです。

クイックリファレンス

領域ベース URLMCP ツールのプレフィックス
コアdev.azure.com/{org}/_apis/mcp__ado__core_*
作業項目dev.azure.com/{org}/{project}/_apis/wit/mcp__ado__wit_*
パイプラインdev.azure.com/{org}/{project}/_apis/pipelines/mcp__ado__pipelines_*
Git/リポジトリdev.azure.com/{org}/{project}/_apis/git/mcp__ado__repo_*
テスト計画dev.azure.com/{org}/{project}/_apis/testplan/mcp__ado__testplan_*
Wikidev.azure.com/{org}/{project}/_apis/wiki/mcp__ado__wiki_*
検索almsearch.dev.azure.com/{org}/_apis/search/mcp__ado__search_*

認証方法

個人用アクセストークン(PAT)
# Base64 encode empty username with PAT
AUTH=$(echo -n ":${PAT}" | base64)
curl -H "Authorization: Basic ${AUTH}" https://dev.azure.com/{org}/_apis/projects
OAuth 2.0 スコープ
スコープアクセスレベル
vso.work作業項目の読み取り
vso.work_write作業項目の作成/更新
vso.codeソースコードの読み取り
vso.code_writeブランチ、PR の作成
vso.build_executeパイプラインの実行
vso.testテスト計画の読み取り
vso.wikiWiki の読み取り

API のバージョン管理

形式:{major}.{minor}[-{stage}[.{resource-version}]]

  • 現在のバージョン:7.2-preview.3
  • 例:api-version=7.2-preview.3

1. 作業項目の操作

利用可能な MCP ツール
mcp__ado__wit_get_work_item          - Get single work item
mcp__ado__wit_get_work_items_batch_by_ids - Get multiple work items
mcp__ado__wit_my_work_items          - Get items assigned to me
mcp__ado__wit_create_work_item       - Create new work item
mcp__ado__wit_update_work_item       - Update work item fields
mcp__ado__wit_update_work_items_batch - Bulk update work items
mcp__ado__wit_add_work_item_comment  - Add comment to work item
mcp__ado__wit_list_work_item_comments - List work item comments
mcp__ado__wit_add_child_work_items   - Create child work items
mcp__ado__wit_work_items_link        - Link work items together
mcp__ado__wit_work_item_unlink       - Remove work item links
mcp__ado__wit_link_work_item_to_pull_request - Link to PR
mcp__ado__wit_add_artifact_link      - Add artifact links (branch, commit, build)
mcp__ado__wit_get_work_item_type     - Get work item type definition
mcp__ado__wit_list_backlogs          - List team backlogs
mcp__ado__wit_list_backlog_work_items - Get backlog items
mcp__ado__wit_get_work_items_for_iteration - Get sprint items
mcp__ado__wit_get_query              - Get saved query
mcp__ado__wit_get_query_results_by_id - Execute saved query
WIQL クエリ構文
基本構造
SELECT [Fields]
FROM workitems
WHERE [Conditions]
ORDER BY [Fields]
ASOF [DateTime]
よく使われるマクロ
マクロ説明
@Me現在のユーザー
@project現在のプロジェクト
@Today今日の日付
@Today - NN 日前
@CurrentIteration現在のスプリント
@StartOfMonth月の初日
クエリの例
-- Active tasks assigned to me
SELECT [System.Id], [System.Title], [System.State]
FROM workitems
WHERE [System.TeamProject] = @project
  AND [System.WorkItemType] = 'Task'
  AND [System.State] = 'Active'
  AND [System.AssignedTo] = @Me
ORDER BY [System.Priority] ASC

-- Bugs created in last 30 days
SELECT [System.Id], [System.Title], [System.CreatedDate]
FROM workitems
WHERE [System.TeamProject] = @project
  AND [System.WorkItemType] = 'Bug'
  AND [System.CreatedDate] >= @Today - 30

-- Parent-child hierarchy
SELECT [Source].[System.Id], [Target].[System.Id]
FROM workitemLinks
WHERE [Source].[System.TeamProject] = @project
  AND [System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward'
MODE (Recursive)
JSON Patch 操作
[
  {"op": "add", "path": "/fields/System.Title", "value": "New Title"},
  {"op": "replace", "path": "/fields/System.State", "value": "Active"},
  {"op": "add", "path": "/relations/-", "value": {
    "rel": "System.LinkTypes.Related",
    "url": "https://dev.azure.com/{org}/_apis/wit/workItems/{id}"
  }}
]
リンクタイプのリファレンス
タイプRel 名
親System.LinkTypes.Hierarchy-Reverse
子System.LinkTypes.Hierarchy-Forward
関連System.LinkTypes.Related
先行System.LinkTypes.Dependency-Reverse
後続System.LinkTypes.Dependency-Forward

2. パイプラインの操作

利用可能な MCP ツール
mcp__ado__pipelines_get_build_definitions - List pipeline definitions
mcp__ado__pipelines_get_build_definition_revisions - Get definition history
mcp__ado__pipelines_get_builds         - List builds
mcp__ado__pipelines_get_build_status   - Get build status
mcp__ado__pipelines_get_build_log      - Get build logs
mcp__ado__pipelines_get_build_log_by_id - Get specific log
mcp__ado__pipelines_get_build_changes  - Get commits in build
mcp__ado__pipelines_run_pipeline       - Trigger pipeline run
mcp__ado__pipelines_get_run            - Get pipeline run details
mcp__ado__pipelines_list_runs          - List pipeline runs
mcp__ado__pipelines_update_build_stage - Retry/cancel stage
パイプラインのトリガー例
{
  "resources": {
    "repositories": {
      "self": {"refName": "refs/heads/feature-branch"}
    }
  },
  "templateParameters": {
    "environment": "staging"
  },
  "variables": {
    "customVar": {"value": "custom-value", "isSecret": false}
  }
}
ビルドのステータス値
ステータス説明
none未開始
inProgress実行中
completed完了
cancellingキャンセル中
postponed延期
notStartedキューに登録済み
ビルド結果の値
結果説明
succeededすべてのタスクが成功
partiallySucceeded一部のタスクが失敗
failedビルドに失敗
canceledユーザーがキャンセル

3. リポジトリの操作

利用可能な MCP ツール
mcp__ado__repo_list_repos_by_project   - List repositories
mcp__ado__repo_get_repo_by_name_or_id  - Get repository details
mcp__ado__repo_list_branches_by_repo   - List branches
mcp__ado__repo_list_my_branches_by_repo - List my branches
mcp__ado__repo_get_branch_by_name      - Get branch details
mcp__ado__repo_create_branch           - Create new branch
mcp__ado__repo_search_commits          - Search commit history
mcp__ado__repo_list_pull_requests_by_repo_or_project - List PRs
mcp__ado__repo_get_pull_request_by_id  - Get PR details
mcp__ado__repo_create_pull_request     - Create PR
mcp__ado__repo_update_pull_request     - Update PR (autocomplete, status)
mcp__ado__repo_update_pull_request_reviewers - Add/remove reviewers
mcp__ado__repo_list_pull_request_threads - List PR comments
mcp__ado__repo_list_pull_request_thread_comments - Get thread comments
mcp__ado__repo_create_pull_request_thread - Create comment thread
mcp__ado__repo_reply_to_comment        - Reply to comment
mcp__ado__repo_resolve_comment         - Resolve thread
mcp__ado__repo_list_pull_requests_by_commits - Find PR by commit
PR のステータス値
ステータス説明
activeレビュー待ち
abandonedマージせずにクローズ
completedマージ済み
マージ戦略
戦略説明
noFastForwardマージコミット(デフォルト)
squashコミットをスカッシュ
rebaseリベースしてファストフォワード
rebaseMergeリベースしてマージコミットを作成

4. テスト計画の操作

利用可能な MCP ツール
mcp__ado__testplan_list_test_plans     - List test plans
mcp__ado__testplan_create_test_plan    - Create test plan
mcp__ado__testplan_create_test_suite   - Create test suite
mcp__ado__testplan_list_test_cases     - List test cases in suite
mcp__ado__testplan_create_test_case    - Create test case
mcp__ado__testplan_update_test_case_steps - Update test steps
mcp__ado__testplan_add_test_cases_to_suite - Add cases to suite
mcp__ado__testplan_show_test_results_from_build_id - Get test results
テストケースのステップ形式
1. Navigate to login page|Login page displayed
2. Enter username|Username field populated
3. Enter password|Password field populated
4. Click login button|User is logged in successfully
テストスイートのタイプ
タイプ説明
staticTestSuite手動で構成する階層
dynamicTestSuiteクエリベース
requirementTestSuite要件にリンク
テスト結果の値
結果説明
Passedテストに合格
Failedテストに失敗
Blocked実行できない
NotExecuted未実行
Inconclusive明確な結果なし

5. Wiki の操作

利用可能な MCP ツール
mcp__ado__wiki_list_wikis              - List wikis
mcp__ado__wiki_get_wiki                - Get wiki details
mcp__ado__wiki_list_pages              - List wiki pages
mcp__ado__wiki_get_page                - Get page metadata
mcp__ado__wiki_get_page_content        - Get page content
mcp__ado__wiki_create_or_update_page   - Create/update page
Wiki のタイプ
タイプ説明
projectWikiプロジェクトスコープの Wiki
codeWikiGit 管理の Wiki
ページパスの形式
  • ルート:/
  • サブページ:/Parent/Child
  • スペース:/My%20Page

6. 検索操作

利用可能な MCP ツール
mcp__ado__search_code                  - Search source code
mcp__ado__search_workitem              - Search work items
mcp__ado__search_wiki                  - Search wiki pages
コード検索フィルター
{
  "Project": ["project-name"],
  "Repository": ["repo-name"],
  "Path": ["/src"],
  "Branch": ["main"],
  "CodeElement": ["class", "def", "function"]
}

###作業項目検索フィルター

{
  "System.TeamProject": ["project-name"],
  "System.WorkItemType": ["Bug", "Task"],
  "System.State": ["Active", "New"],
  "System.AssignedTo": ["[email protected]"]
}

7. コア操作

利用可能な MCP ツール
mcp__ado__core_list_projects           - List projects
mcp__ado__core_list_project_teams      - List teams
mcp__ado__core_get_identity_ids        - Get user identity
mcp__ado__work_list_team_iterations    - List iterations
mcp__ado__work_list_iterations         - List all iterations
mcp__ado__work_create_iterations       - Create iterations
mcp__ado__work_assign_iterations       - Assign to team
mcp__ado__work_get_team_capacity       - Get team capacity
mcp__ado__work_update_team_capacity    - Update capacity
mcp__ado__work_get_iteration_capacities - Get iteration capacity

8. 高度なセキュリティ操作

利用可能な MCP ツール
mcp__ado__advsec_get_alerts            - Get security alerts
mcp__ado__advsec_get_alert_details     - Get alert details
アラートの種類
種類説明
Dependency脆弱な依存関係
Secret漏えいしたシークレット
Codeコードの脆弱性

レート制限

TSTU(スループット単位)の上限
  • 匿名:200 TSTU/分
  • 認証済み:1200 TSTU/分
レスポンスヘッダー
X-RateLimit-Resource: core
X-RateLimit-Delay: 500
X-RateLimit-Limit: 1200
X-RateLimit-Remaining: 847
X-RateLimit-Reset: 1609459200
Retry-After: 30
レート制限への対処
import time
import requests

def api_call_with_retry(url, headers, max_retries=3):
    for attempt in range(max_retries):
        response = requests.get(url, headers=headers)
        if response.status_code == 429:
            retry_after = int(response.headers.get('Retry-After', 30))
            time.sleep(retry_after)
            continue
        return response
    raise Exception("Rate limit exceeded after retries")

エラー処理

HTTP ステータスコード
コード意味
200成功
201作成済み
204コンテンツなし(DELETE)
400不正なリクエスト
401認証されていません
403禁止されています
404見つかりません
409競合(バージョン)
429レート制限
500サーバーエラー
エラーレスポンスの形式
{
  "$id": "1",
  "innerException": null,
  "message": "Error description",
  "typeName": "Microsoft.VisualStudio.Services.WebApi.VssServiceException",
  "typeKey": "VssServiceException",
  "errorCode": 0
}

共通フィールドのリファレンス

システムフィールド
フィールド参照名
IDSystem.Id
タイトルSystem.Title
状態System.State
担当者System.AssignedTo
エリアパスSystem.AreaPath
イテレーションパスSystem.IterationPath
作業項目の種類System.WorkItemType
作成日System.CreatedDate
変更日System.ChangedDate
タグSystem.Tags
説明System.Description
スケジュールフィールド
フィールド参照名
ストーリーポイントMicrosoft.VSTS.Scheduling.Effort
残作業Microsoft.VSTS.Scheduling.RemainingWork
当初の見積もりMicrosoft.VSTS.Scheduling.OriginalEstimate
完了した作業Microsoft.VSTS.Scheduling.CompletedWork

複数リポジトリでの作業項目の分離

1 つの Azure DevOps プロジェクトに複数のリポジトリが含まれている場合は、主な分離に エリアパス を使用し、リポジトリ単位のスプリント/エピックの追跡には 階層型イテレーションパス を使用します。

目標の構造
Area Paths:                          Iteration Paths:
project\                             project\Iteration\
├── repo-a           (per-repo)      ├── Sprint 1        (shared across repos)
├── repo-b           (per-repo)      ├── Sprint 2        (shared across repos)
└── repo-c           (per-repo)      ├── repo-a\         (repo-scoped container)
                                     │   ├── epic-1-...  (auto-created by sync)
                                     │   └── epic-2-...
                                     └── repo-b\         (repo-scoped container)
パス形式の違い(重要)

Azure DevOps では、イテレーションに 異なる 2 種類のパス形式が使用されます。

操作形式例
az boards iteration project create --path\Project\Iteration\Parent(「Iteration」セグメントが文字どおり必要)\devops-team\Iteration\azure-quota-automation
az boards work-item update --iterationProject\Parent\Child(「Iteration」セグメントなし、先頭の \ なし)devops-team\azure-quota-automation\epic-1-slug
新しいリポジトリのセットアップコマンド
# 1. Create area path (if not exists)
az boards area project create --name "<repo-name>" --path "\<project>"

# 2. Create iteration container
az boards iteration project create --name "<repo-name>" --path "\<project>\Iteration"

# 3. Configure BMAD sync (devops-sync-config.yaml)
# areaPath: "<project>\\<repo-name>"
# iterationRootPath: "<repo-name>"
イテレーションの移動(ネイティブの移動機能なし)

Azure DevOps CLI には、イテレーションを移動する move コマンドがありません。再構成するには、次の手順を実行します。

  1. 作業項目が割り当てられていないことを確認します:az boards query --wiql "... WHERE [System.IterationPath] = '...'"
  2. 削除します:az boards iteration project delete --path "\project\Iteration\old-path" --yes
  3. 新しい親の下に再作成します:az boards iteration project create --name "name" --path "\project\Iteration\new-parent"
  4. 状態ファイルを新しいイテレーション ID で更新します
よくあるエラー:TF401347

TF401347: The iteration path does not exist — 誤ったパス形式を使用した場合に発生します。次を確認してください。

  • 作業項目の --iteration では Project\Parent\Child を使用します(「Iteration」セグメントなし)
  • イテレーション作成の --path では \Project\Iteration\Parent を使用します(「Iteration」セグメントあり)

ベストプラクティス

1. バッチ操作を使用する
  • 複数の単一呼び出しではなく、mcp__ado__wit_get_work_items_batch_by_ids を使用します
  • 1 回のバッチリクエストで指定できる項目は最大 200 件です
2. フィールド選択を最小限にする
  • 必要なフィールドのみをリクエストします:fields=System.Id,System.Title,System.State
  • レスポンスサイズと API 負荷を軽減できます
3. ページネーションを処理する
  • 大きな結果セットには $top と $skip を使用します
  • 継続トークンが提供された場合は、それに従います
4. バージョン管理
  • 楽観的同時実行制御には、JSON Patch の test 操作を使用します
  • 更新する前に、必ず rev フィールドを確認します
5. エラー復旧
  • レート制限に対して指数バックオフを実装します
  • レスポンスヘッダーの相関 ID をログに記録します

参考資料

コメント