
Azure DevOps
STDIO通过AI助手与Azure DevOps交互的MCP服务器
通过AI助手与Azure DevOps交互的MCP服务器
This MCP (Model Context Protocol) server provides tools for interacting with Azure DevOps services through AI assistants.
The server follows an entity-based architecture that groups operations by resource type rather than exposing many atomic tools. This approach provides several benefits:
flowchart TB Client[AI Assistant] -->|MCP Request| Server[MCP Server] Server -->|MCP Response| Client subgraph "Azure DevOps MCP Server" Server --> RequestHandler[Request Handler] RequestHandler --> ToolRegistry[Tool Registry] ToolRegistry --> EntityTools[Entity Tools] EntityTools --> ApiClient[API Client] ApiClient --> ErrorUtils[Error Utilities] ApiClient --> PaginationUtils[Pagination Utilities] ApiClient -->|HTTP Request| AzureDevOps[Azure DevOps API] AzureDevOps -->|HTTP Response| ApiClient ConfigManager[Configuration Manager] --> ApiClient end classDef primary fill:#4285F4,stroke:#0D47A1,color:white classDef secondary fill:#34A853,stroke:#0D652D,color:white classDef utility fill:#FBBC05,stroke:#866A00,color:white classDef external fill:#EA4335,stroke:#980905,color:white class Server,RequestHandler primary class ToolRegistry,EntityTools,ApiClient secondary class ErrorUtils,PaginationUtils,ConfigManager utility class Client,AzureDevOps external
classDiagram class EntityTool { +name: string +description: string +operations: Record~string, Function~ +schemas: Record~string, ZodSchema~ +getDefinition(): ToolDefinition +execute(args: unknown): Promise~any~ #registerOperation(operation, handler, schema, description) } class ADOApiClient { +config: ADOApiConfig +connection: WebApi +getCoreApi() +getWorkItemTrackingApi() +getGitApi() +getPipelineApi() +handleError(error, context) } class ToolRegistry { +registerTool(tool: Tool) +getTool(name: string): Tool +getToolDefinitions(): ToolDefinition[] } class ErrorUtils { +createError(code, message, context) +handleApiError(error, source, operation) } class PaginationUtils { +normalizePaginationParams(params) +createPaginationResult(items, totalCount, continuationToken) +encodeContinuationToken(data) +decodeContinuationToken(token) } EntityTool --> ADOApiClient : uses EntityTool --> ErrorUtils : uses EntityTool --> PaginationUtils : uses ToolRegistry --> EntityTool : registers
The server now includes a comprehensive error handling system that provides:
flowchart LR Error[API Error] --> Handler[Error Handler] Handler --> Category{Categorize} Category -->|Authentication| AuthError[Authentication Error] Category -->|Authorization| AuthzError[Authorization Error] Category -->|Not Found| NotFoundError[Not Found Error] Category -->|Validation| ValidationError[Validation Error] Category -->|Rate Limit| RateLimitError[Rate Limit Error] Category -->|Service| ServiceError[Service Error] Category -->|Unknown| UnknownError[Unknown Error] AuthError & AuthzError & NotFoundError & ValidationError & RateLimitError & ServiceError & UnknownError --> Format[Format User Message] Format --> McpError[MCP Error Response] classDef error fill:#EA4335,stroke:#980905,color:white classDef process fill:#4285F4,stroke:#0D47A1,color:white classDef result fill:#34A853,stroke:#0D652D,color:white class Error,AuthError,AuthzError,NotFoundError,ValidationError,RateLimitError,ServiceError,UnknownError error class Handler,Category,Format process class McpError result
All list operations now support cursor-based pagination with:
sequenceDiagram participant Client as AI Assistant participant Server as MCP Server participant API as Azure DevOps API Client->>Server: List request (maxResults=10) Server->>API: API request (top=10, skip=0) API->>Server: Response with items Note over Server: Create continuation token Server->>Client: Response with items and token Client->>Server: List request with token Note over Server: Decode token to get position Server->>API: API request (top=10, skip=10) API->>Server: Response with more items Server->>Client: Response with items and new token
Each tool and operation now includes:
Manages Azure DevOps projects.
Operations:
list
: List all projects in the organization with pagination supportget
: Get detailed information about a specific projectManages Git repositories.
Operations:
list
: List all Git repositories in a project with pagination supportget
: Get detailed information about a specific Git repositorylistBranches
: List all branches in a Git repository with pagination supportManages work items (bugs, tasks, user stories, etc.).
Operations:
get
: Get detailed information about a specific work itemcreate
: Create a new work item in a projectManages pull requests in repositories.
Operations:
list
: List pull requests in a repository with filtering and pagination supportget
: Get detailed information about a specific pull requestManages CI/CD pipelines.
Operations:
list
: List all pipelines in a project with pagination supportget
: Get detailed information about a specific pipeline{ "operation": "list", "listParams": { "maxResults": 10, "continuationToken": "optional-token-from-previous-request" } }
{ "operation": "get", "getParams": { "projectId": "my-project", "includeCapabilities": true } }
{ "operation": "list", "listParams": { "projectId": "my-project", "maxResults": 20 } }
{ "operation": "listBranches", "listBranchesParams": { "projectId": "my-project", "repositoryId": "my-repo", "maxResults": 15 } }
{ "operation": "get", "getParams": { "id": 123, "expand": "Relations" } }
{ "operation": "create", "createParams": { "projectId": "my-project", "type": "Task", "title": "Implement new feature", "description": "This task involves implementing the new feature XYZ", "assignedTo": "[email protected]" } }
{ "operation": "list", "listParams": { "projectId": "my-project", "repositoryId": "my-repo", "status": "Active", "maxResults": 10 } }
The server can be configured using environment variables or a configuration file.
ADO_ORGANIZATION
: Azure DevOps organization name (required)ADO_PROJECT
: Default project name (optional)ADO_PAT
: Personal Access Token for authentication (required)ADO_API_URL
: Base URL for the API (optional, defaults to https://dev.azure.com)ADO_API_VERSION
: API version (optional, defaults to 7.0)ADO_API_MAX_RETRIES
: Maximum number of retries for API calls (optional, defaults to 3)ADO_API_DELAY_MS
: Delay between retries in milliseconds (optional, defaults to 1000)ADO_API_BACKOFF_FACTOR
: Backoff factor for retries (optional, defaults to 2)Alternatively, you can create a config/azuredevops.json
file with the following structure:
{ "organization": "your-organization", "project": "your-project", "credentials": { "pat": "your-personal-access-token" }, "api": { "baseUrl": "https://dev.azure.com", "version": "7.0", "retry": { "maxRetries": 3, "delayMs": 1000, "backoffFactor": 2 } } }
npm run build
node build/index.js
docker build -t azure-devops-mcp:local . docker run -i --rm -e ADO_ORGANIZATION=your-org -e ADO_PAT=your-pat azure-devops-mcp:local ## License MIT License © 2025 Aaron Bockelie <[email protected]>