How microsoft/azure-devops-mcp works
Project type and purpose
• This is an open-source, Node.js/TypeScript “MCP Server” CLI plugin that exposes Azure DevOps REST APIs as a set of tools over stdio.
• It is consumed by VS Code (via GitHub Copilot Agent Mode or any stdio-based client) to enable interactive prompts and commands against Azure DevOps.
File structure
• Top-level: configuration for CI/CD (.github/workflows, .azuredevops/pipelines), linting (eslint.config.mjs), formatting (.prettierrc.json), devcontainer, and docs.
• scripts/build-validate-tools.js: build-time validation of the tool definitions.
• src/index.ts: the CLI entrypoint.
• src/prompts.ts & src/auth.ts: core orchestration of user prompts and authentication.
• src/shared: shared domain definitions and validation logic.
• src/tools/*: one file per domain (“core”, “work-items”, “pipelines”, “repositories”, “wiki”, “search”, “advanced-security”, “test-plans”, etc.). Each exports a collection of functions implementing REST calls.
• test/*: Jest tests covering each module.
README for additional insights
• Calls out architecture in prose: a “thin abstraction layer” over ADO REST APIs, organized into Domains to reduce loaded tools.
• Usage: loaded by VS Code via npx + stdio, passing an organization name and optional domain filters.
Main components and their interactions
a. Host/Client (VS Code Copilot Chat or any stdio-based client)
• Sends JSON-RPC or command prompts over stdio.
b. MCP Server (Node.js process)
• index.ts: bootstraps the server, parses arguments, loads Domains.
• prompts.ts: translates user input into tool invocations.
• auth.ts + org-tenants.ts: manage authentication tokens and tenant resolution.
• tool loader: dynamically imports the selected domain modules from src/tools.
• utils.ts & shared/: support HTTP requests, schema validation, type generation.
• useragent.ts & version.ts: handle client identification and versioning.
c. Domain modules (src/tools/*.ts)
• Each module exports a set of RPC-callable functions that wrap specific Azure DevOps REST endpoints.
d. External Service (Azure DevOps REST API)
• The ultimate target of every tool function.
e. Developer workflows (CI/CD pipelines, GitHub Actions)
• Validate, lint, build, test, version, and release the package to npm.
Relationships:
1. VS Code ⇄ stdio ⇄ MCP Server
2. MCP Server → HTTP client → Azure DevOps REST endpoints
3. Build & test pipelines (GitHub Actions, Azure DevOps pipelines) → push to npm
Architectural patterns & design principles
• Plugin/Module pattern: each “tool” is a self-contained module grouped by domain.
• Thin abstraction: no business logic beyond REST call orchestration.
• Domain-based loading: only load the requested domains to reduce tool bloat.
Essential elements to capture
• Stdio boundary and JSON-RPC interface
• Dynamic domain-based plugin loader
• Shared utilities and validation layer
• Individual tool modules grouped by domain
• Authentication flow to Azure DevOps
• CI/CD automation for build, test, and release