AZ

Azure DevOps MCP Server with Directory-Based Authentication

Manage Azure DevOps with an MCP server that supports directory-based auth switching, work items, repositories, builds, pipelines and multi-project local conf...

Quick Install
npx -y @wangkanai/devops-mcp

Overview

This MCP (Model Context Protocol) server provides a lightweight HTTP gateway to manage Azure DevOps artifacts using a consistent, directory-aware API. It centralizes common operations — work items, repositories, builds and pipelines — and adds a simple way to switch authentication contexts by directory (organization/team project). That makes local development and multi-project automation easier when you work across multiple Azure DevOps organizations or projects.

The server is intended for developers and automation scripts that need programmatic access to DevOps resources without embedding organization-specific logic in every consumer. You configure directory mappings and credentials locally, then call the MCP endpoints to operate on the appropriate Azure DevOps context. This enables local multi-project configuration, quick environment switching, and simplified integration with tools like scripts, dashboards or CI helpers.

Features

  • Directory-based authentication switching (map an incoming request to an Azure DevOps organization and token)
  • CRUD-style endpoints for work items, repositories, builds and pipelines
  • Multi-project local configuration for per-project tokens and defaults
  • Lightweight HTTP API compatible with MCP client patterns
  • Designed for local development, automation scripts, and integration adapters
  • Simple JSON-based configuration files for credentials and project mappings

Installation / Configuration

Prerequisites:

  • .NET 6+ SDK (if the server is a .NET project)
  • An Azure DevOps Personal Access Token (PAT) per organization or service principal with appropriate permissions

Quick start:

  1. Clone the repository:
git clone https://github.com/wangkanai/devops-mcp.git
cd devops-mcp
  1. Run the server (typical .NET commands — path may vary depending on project layout):
dotnet restore
dotnet run --project src/DevOps.Mcp.Server
  1. Create a local multi-project configuration file (example: mcp.local.json) and place it next to the running server or in a configured config directory.

Example mcp.local.json:

{
  "Directories": {
    "acme-corp": {
      "Organization": "acmeorg",
      "DefaultProject": "frontend",
      "Pat": "<PERSONAL_ACCESS_TOKEN>"
    },
    "contoso": {
      "Organization": "contoso-org",
      "DefaultProject": "backend",
      "Pat": "<PERSONAL_ACCESS_TOKEN>"
    }
  }
}

Environment-based configuration (appsettings.json snippet):

{
  "MCP": {
    "BasePath": "/mcp",
    "DefaultDirectory": "acme-corp",
    "Listen": "http://localhost:5000"
  }
}

Security note: store PATs securely (use OS secret stores or CI/CD secrets for production). The local config pattern is intended for developer machines; do not commit secrets to source control.

Available Resources

The server exposes a small set of HTTP endpoints (paths and parameters may vary; consult the repository README for exact routes). Typical endpoints include:

ResourceExample EndpointDescription
Work itemsGET /mcp/{dir}/workitemsList or query work items within the directory/project
RepositoriesGET /mcp/{dir}/reposList repositories in the mapped organization/project
BuildsGET /mcp/{dir}/buildsRetrieve build definitions and recent runs
PipelinesPOST /mcp/{dir}/pipelines/{id}/runQueue a pipeline run

Sample curl — list repositories from the “acme-corp” directory:

curl http://localhost:5000/mcp/acme-corp/repos

Sample curl — queue a pipeline run:

curl -X POST http://localhost:5000/mcp/acme-corp/pipelines/42/run \
  -H "Content-Type: application/json" \
  -d '{"parameters":{"env":"staging"}}'

If the server supports directory selection via header instead of path, use:

curl -H "X-MCP-Directory: contoso" http://localhost:5000/mcp/repos

Use Cases

  • Multi-organization development: Switch quickly between Azure DevOps organizations without changing client code — map directories to organization + PAT in mcp.local.json and call the same endpoint path for different contexts.
  • Local automation scripts: Write scripts that operate on work items, repos or pipelines for multiple projects. Use the directory parameter to avoid embedding tokens or org names in the script.
  • Troubleshooting CI/CD: Trigger builds or replay pipeline runs against different projects while preserving a consistent API surface for tooling and dashboards.
  • Migration and bulk operations: Iterate over repositories and work items across projects to perform bulk changes (rename, move, update policies) using a single gateway that handles authentication per-directory.

Troubleshooting & Notes

  • Ensure PATs have the right scopes (Work Items, Code, Build and Release or Pipelines) for the actions you perform.
  • Run the server locally behind an authenticated developer proxy if you need additional access controls.
  • For production or shared environments, replace file-based PAT storage with a secure secret store and limit exposure of the server to trusted networks.
  • Repository: https://github.com/wangkanai/devops-mcp
  • Consult the repo README for exact endpoint names, route variations and implementation details.