Skip to main content
Glama

azure-devops-cli-mcp

A local MCP server that bridges Claude Desktop / Cowork to the local Azure DevOps CLI. Through it, Claude can fully use az devops, az repos, az boards, az pipelines, az artifacts.

Prerequisites

  • Node.js >= 20

  • Azure CLI (with the azure-devops extension): az extension add --name azure-devops

  • az login completed

  • No need for az devops configure --defaults: the server automatically supplies default organization / project / repository (see "Startup parameters" below).

Related MCP server: Azure DevOps MCP Server

Installation (team members)

npm install -g git+https://github.com/A016098Tony/azure-devops-cli-mcp.git

The repo already contains a compiled dist/, so no compilation is needed at install time. To update to a new version, just re-run the same command.

Note: the script is deliberately not named build/prepare — when npm 11 installs a git package globally, any build/prepare/prepack/install script in package.json triggers compilation on the installing side, which fails because npm_config_global leaks into the inner npm. Naming it compile lets the install flow skip compilation entirely.

Claude Desktop configuration

Open claude_desktop_config.json (full Windows path: C:\Users\<你的帳號>\AppData\Roaming\Claude\claude_desktop_config.json; you can also open it from Claude Desktop → Settings → Developer → Edit Config) and add to mcpServers:

{
  "mcpServers": {
    "azure-devops-cli": {
      "command": "npx",
      "args": ["azure-devops-cli-mcp", "--project", "MS", "--repository", "MS-Web"]
    }
  }
}

This config file shares the same format between Claude Desktop (including Cowork) and Claude Code. The claude.ai web version does not support local stdio MCP servers.

Startup parameters

All three parameters are optional; built-in defaults are used when not specified:

Parameter

Default value

Description

--organization

https://dev.azure.com/SKMHHIS

A short name (e.g. SKMHHIS) is enough; the full URL is filled in automatically

--project

MS

Default project

--repository

MS-Web

Only applies to repos pr commands

When a command does not specify --org / --project (or repos pr does not specify --repository), the server automatically fills in these defaults; when a command explicitly specifies them, the command wins. If an az subcommand does not accept a filled-in parameter, the server automatically removes that parameter and retries once.

Windows + nvm note: the PATH inherited by desktop applications (GUI processes) may differ from the terminal's. If you see "npx not found", change command to the absolute path of npx.cmd (find it with (Get-Command npx.cmd).Source, e.g. C:\nvm4w\nodejs\npx.cmd); args stays unchanged.

You must fully quit and restart Claude Desktop (closing the tab is not enough; quit entirely and reopen) for it to load. After startup, you can see azure-devops-cli and its tools under the "+" → Connectors in the bottom-left of the chat box.

Tools

Tool

Purpose

az_devops

Run any DevOps family command, e.g. repos pr list --status active. Uses JSON automatically when no output format is specified.

az_devops_help

Look up command syntax; equivalent to az <command> --help.

az_workitem_attach

Upload a local file as a work item attachment and create a link (text and binary both supported, up to 100MB). For example, attach a code review report or error screenshot to a work item.

az_pr_show

Get full PR information (REST), including source/target branch and status.

az_pr_changes

Get the list of files changed in a PR (REST iterations/changes), automatically using the latest iteration.

az_pr_workitems

Get the list of work items linked to a PR (REST).

az_workitem_relations

Get a work item including relations (REST, $expand=relations); can check for duplicate attachment names.

az_pr_comment

Post a comment in a PR discussion thread or reply to an existing thread (REST).

az_workitem_update

Update work item fields / write to Discussion (REST json-patch, only /fields/* allowed).

az_rest

Generic Azure DevOps REST calls (GET/POST/PATCH) for endpoints not covered.

az_git_fetch

Run git fetch (read-only) on a local repo on the host. Alternative path when fetch inside the Cowork sandbox is blocked by the proxy (403); after fetch completes, local git operations on origin/<branch> work inside the sandbox.

az_git_ls_remote

Query remote refs on the host (git ls-remote, without downloading objects); can confirm a remote branch exists first.

REST tools use the same authentication as az_workitem_attach: the AZURE_DEVOPS_EXT_PAT environment variable takes priority, otherwise the az login credentials are used. All REST URLs are locked to the default organization; requests cannot be sent to other hosts.

Only the five command groups devops, repos, boards, pipelines, and artifacts are allowed; all other az commands (e.g. vm, account) are rejected. Authentication relies on the local az login (az_workitem_attach internally runs az account get-access-token to obtain a token; if the AZURE_DEVOPS_EXT_PAT environment variable is set, that PAT takes priority). The server stores no credentials.

Security protection

Commands are executed via a shell, so commands containing shell control characters outside double quotes (& | ; < > ( ) \ ^or newlines) or with unmatched double quotes are rejected, to prevent concatenations likerepos list & <任意命令>from bypassing the group restrictions and running arbitrary local commands. Parameter values containing special characters (e.g. WIQL or JMESPath expressions for--query) work fine when wrapped in double quotes, for example: boards query --wiql "SELECT [System.Id] FROM WorkItems WHERE [System.State] <> 'Closed'"`.

Git tools

az_git_fetch / az_git_ls_remote perform read-only git network operations on the host; repoPath must be an absolute path on the host. az_git_ls_remote's patterns accepts multiple patterns; refs matching any of them are listed (same as native git ls-remote). Parameters are strictly validated: remote accepts only a name (not a URL), and refspec/patterns must not start with - (blocking dangerous options like --upload-pack). No push, pull, or any write operations are provided. Authentication uses the host's git credentials (e.g. Git Credential Manager).

Development

git clone https://github.com/A016098Tony/azure-devops-cli-mcp.git
npm install
npm test              # vitest 單元 + 整合測試(不需要 az)
node scripts/smoke.mjs  # 實機煙霧測試(需要 az login)

After changing src/, be sure to run npm run compile and commit dist/ along with it — the installing side uses the dist/ in the repo directly, and forgetting to recompile will give users the old behavior.

Available Tools

12 tools
az_devopsAzure DevOps CLIA

執行 Azure DevOps CLI 命令(az 前綴由 server 自動加上,command 請勿包含)。允許的命令群組:devops、repos、boards、pipelines、artifacts。預設 organization 為 https://dev.azure.com/SKMHHIS、project 為 MS,repos pr 命令預設 repository 為 MS-Web(未指定時 server 會自動補上,通常不需要帶 --org/--project/--repository)。未指定 -o/--output 時自動使用 --output json。範例:"repos pr list --status active"、"boards work-item show --id 123"。不確定語法時,先用 az_devops_help 查詢。

Inputs: command (required), timeout.

az_devops_helpAzure DevOps CLI 說明查詢A

查詢 Azure DevOps CLI 命令的官方說明(等同 az --help)。在不確定子命令或參數語法時先用這個工具,再用 az_devops 執行。範例:command 傳 "boards work-item update" 會回傳該命令的完整參數說明。

Inputs: command (required).

az_git_fetchGit Fetch (host-side)A

在主機端對本機 repo 執行 git fetch(唯讀網路操作,不動工作目錄)。典型情境:Cowork sandbox 內 git fetch 被 proxy 擋下(403)時,用此工具在主機端代跑;完成後 sandbox 內即可用本機 git 操作 origin/。不提供 push/pull 等寫入操作。

Inputs: repoPath (required), prune, remote, refspec, +1 more.

az_git_ls_remoteGit Ls-Remote (host-side)A

在主機端查詢本機 repo 的遠端 refs(git ls-remote,不下載物件)。適合在 fetch 前快速確認遠端分支是否存在,例如確認 releases/s116/rc-092 存在於 origin。

Inputs: repoPath (required), tags, heads, remote, +2 more.

az_pr_changesList Pull Request ChangesA

以 REST API 取得 PR 的異動檔案清單(iteration changes)。未指定 iterationId 時自動使用最新 iteration,並在輸出開頭註明。預設 organization/project/repository 同 az_pr_show。

Inputs: prNumber (required), project, repository, iterationId.

az_pr_commentCreate Pull Request CommentA

在 PR 上留言。未指定 threadId 時建立新的討論串(可用 filePath/line 錨定到檔案行);指定 threadId 時回覆該討論串(此時忽略 filePath/line/status)。預設 organization/project/repository 同 az_pr_show。

Inputs: content (required), prNumber (required), line, status, +4 more.

az_pr_showShow Pull RequestB

以 REST API 取得 PR 完整資訊(title、sourceRefName、targetRefName、status 等)。預設 organization 為 https://dev.azure.com/SKMHHIS、project 為 MS、repository 為 MS-Web。

Inputs: prNumber (required), project, repository.

az_pr_workitemsList Pull Request Work ItemsB

以 REST API 取得 PR 關聯的 work item 清單(id 與 url)。預設 organization/project/repository 同 az_pr_show。

Inputs: prNumber (required), project, repository.

az_restAzure DevOps REST (generic)A

對 Azure DevOps 發送任意 REST 請求(GET/POST/PATCH)。優先使用專用工具(az_pr_show、az_pr_changes、az_pr_workitems、az_workitem_relations、az_pr_comment、az_workitem_update、az_workitem_attach);此工具僅供未涵蓋的端點使用。path 為 organization(https://dev.azure.com/SKMHHIS)之後的相對路徑,未帶 api-version 時自動補 7.1。

Inputs: path (required), method (required), body, timeout, +1 more.

az_workitem_attachAttach File to Work ItemA

將本機檔案上傳為 Azure DevOps work item 附件並建立連結(純文字與 binary 檔皆可,上限 100MB)。預設 organization 為 https://dev.azure.com/SKMHHIS、project 為 MS。認證優先使用 AZURE_DEVOPS_EXT_PAT 環境變數,否則使用 az login 的憑證。

Inputs: filePath (required), workItemId (required), comment, fileName.

az_workitem_relationsShow Work Item RelationsB

以 REST API 取得 work item 的完整資訊含 relations($expand=relations),可用於檢查附件(AttachedFile 的 attributes.name)是否已存在。預設 organization 為 https://dev.azure.com/SKMHHIS。

Inputs: workItemId (required).

az_workitem_updateUpdate Work Item FieldsA

以 REST API 更新 work item 欄位(json-patch 由 server 組裝,僅允許 /fields/*)。fields 的 key 為欄位參考名稱,例如 {"System.State": "Resolved"};historyComment 會寫入 System.History(等同在 Discussion 留言)。fields 與 historyComment 至少要提供一個。預設 organization 為 https://dev.azure.com/SKMHHIS。

Inputs: workItemId (required), fields, historyComment.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 12 tools

    Disambiguation4/5

    Tools are mostly distinct: the dedicated az_pr_* and az_workitem_* tools target specific resources and are clearly differentiated from the generic az_devops CLI passthrough and az_rest fallback. Minor ambiguity exists between az_devops (which can also run PR/workitem commands) and the dedicated REST tools, though the descriptions explicitly advise using the dedicated tools first. The az_git_fetch vs az_git_ls_remote pair is well-separated by read-only scope.

    Naming Consistency3/5

    There are two conventions mixed: a non-prefixed 'az_devops'/'az_devops_help' pair and a prefixed 'az_rest', 'az_git_fetch', 'az_git_ls_remote', plus camelCase-free hyphenated domain tools (az_pr_show, az_workitem_attach). The az_* prefix is consistent but the grouping/casing is inconsistent—some use domain_verb (az_pr_show), some use verb placement like az_git_fetch. Not chaotic, but not a single predictable pattern.

    Tool Count4/5

    12 tools for an Azure DevOps MCP server is reasonable. Each dedicated tool earns its place by covering a commonly-needed operation with the REST API, while the generic az_devops passthrough and az_rest fallbacks consolidate the remaining surface. Slightly on the higher end but justified by the breadth of Azure DevOps domains covered.

    Completeness4/5

    The tool surface covers a broad set of Azure DevOps operations: CLI passthrough for the main command groups, help lookup, PR inspection (show/changes/workitems/comment), work item management (attach/update/relations), generic REST passthrough, and git helpers. Notable gaps: no dedicated tool for creating a PR (relies on az_devops CLI), and the git tools are read-only helpers rather than full git coverage, but these are reasonable trade-offs given the generic az_devops passthrough and az_rest fallback.

    Related MCP Connectors

    Related MCP Servers