|
| 1 | +# Azure DevOps MCP Server |
| 2 | + |
| 3 | +A Model Context Protocol (MCP) server implementation for Azure DevOps, allowing AI assistants to interact with Azure DevOps APIs through a standardized protocol. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This server implements the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) for Azure DevOps, enabling AI assistants like Claude to interact with Azure DevOps resources securely. The server acts as a bridge between AI models and Azure DevOps APIs, providing a standardized way to: |
| 8 | + |
| 9 | +- Access and manage projects, work items, repositories, and more |
| 10 | +- Create and update work items, branches, and pull requests |
| 11 | +- Execute common DevOps workflows through natural language |
| 12 | +- Access repository content via standardized resource URIs |
| 13 | +- Safely authenticate and interact with Azure DevOps resources |
| 14 | + |
| 15 | +## Server Structure |
| 16 | + |
| 17 | +The server is structured around the Model Context Protocol (MCP) for communicating with AI assistants. It provides tools for interacting with Azure DevOps resources including: |
| 18 | + |
| 19 | +- Projects |
| 20 | +- Work Items |
| 21 | +- Repositories |
| 22 | +- Pull Requests |
| 23 | +- Branches |
| 24 | +- Pipelines |
| 25 | + |
| 26 | +### Core Components |
| 27 | + |
| 28 | +- **AzureDevOpsServer**: Main server class that initializes the MCP server and registers tools |
| 29 | +- **Tool Handlers**: Modular functions for each Azure DevOps operation |
| 30 | +- **Configuration**: Environment-based configuration for organization URL, PAT, etc. |
| 31 | + |
| 32 | +## Getting Started |
| 33 | + |
| 34 | +### Prerequisites |
| 35 | + |
| 36 | +- Node.js (v16+) |
| 37 | +- npm or yarn |
| 38 | +- Azure DevOps account with appropriate access |
| 39 | +- Authentication credentials (see [Authentication Guide](docs/authentication.md) for details): |
| 40 | + - Personal Access Token (PAT), or |
| 41 | + - Azure Identity credentials, or |
| 42 | + - Azure CLI login |
| 43 | + |
| 44 | +### Running with NPX |
| 45 | + |
| 46 | +### Usage with Claude Desktop/Cursor AI |
| 47 | + |
| 48 | +To integrate with Claude Desktop or Cursor AI, add one of the following configurations to your configuration file. |
| 49 | + |
| 50 | +#### Azure Identity Authentication |
| 51 | + |
| 52 | +Be sure you are logged in to Azure CLI with `az login` then add the following: |
| 53 | + |
| 54 | +```json |
| 55 | +{ |
| 56 | + "mcpServers": { |
| 57 | + "azureDevOps": { |
| 58 | + "command": "npx", |
| 59 | + "args": ["-y", "@tiberriver256/mcp-server-azure-devops"], |
| 60 | + "env": { |
| 61 | + "AZURE_DEVOPS_ORG_URL": "https://dev.azure.com/your-organization", |
| 62 | + "AZURE_DEVOPS_AUTH_METHOD": "azure-identity", |
| 63 | + "AZURE_DEVOPS_DEFAULT_PROJECT": "your-project-name" |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +#### Personal Access Token (PAT) Authentication |
| 71 | + |
| 72 | +```json |
| 73 | +{ |
| 74 | + "mcpServers": { |
| 75 | + "azureDevOps": { |
| 76 | + "command": "npx", |
| 77 | + "args": ["-y", "@tiberriver256/mcp-server-azure-devops"], |
| 78 | + "env": { |
| 79 | + "AZURE_DEVOPS_ORG_URL": "https://dev.azure.com/your-organization", |
| 80 | + "AZURE_DEVOPS_AUTH_METHOD": "pat", |
| 81 | + "AZURE_DEVOPS_PAT": "<YOUR_PAT>", |
| 82 | + "AZURE_DEVOPS_DEFAULT_PROJECT": "your-project-name" |
| 83 | + } |
| 84 | + } |
| 85 | + } |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +For detailed configuration instructions and more authentication options, see the [Authentication Guide](docs/authentication.md). |
| 90 | + |
| 91 | +## Authentication Methods |
| 92 | + |
| 93 | +This server supports multiple authentication methods for connecting to Azure DevOps APIs. For detailed setup instructions, configuration examples, and troubleshooting tips, see the [Authentication Guide](docs/authentication.md). |
| 94 | + |
| 95 | +### Supported Authentication Methods |
| 96 | + |
| 97 | +1. **Personal Access Token (PAT)** - Simple token-based authentication |
| 98 | +2. **Azure Identity (DefaultAzureCredential)** - Flexible authentication using the Azure Identity SDK |
| 99 | +3. **Azure CLI** - Authentication using your Azure CLI login |
| 100 | + |
| 101 | +Example configuration files for each authentication method are available in the [examples directory](docs/examples/). |
| 102 | + |
| 103 | +## Environment Variables |
| 104 | + |
| 105 | +For a complete list of environment variables and their descriptions, see the [Authentication Guide](docs/authentication.md#configuration-reference). |
| 106 | + |
| 107 | +Key environment variables include: |
| 108 | + |
| 109 | +| Variable | Description | Required | Default | |
| 110 | +| ------------------------------ | ---------------------------------------------------------------------------------- | ---------------------------- | ---------------- | |
| 111 | +| `AZURE_DEVOPS_AUTH_METHOD` | Authentication method (`pat`, `azure-identity`, or `azure-cli`) - case-insensitive | No | `azure-identity` | |
| 112 | +| `AZURE_DEVOPS_ORG_URL` | Full URL to your Azure DevOps organization | Yes | - | |
| 113 | +| `AZURE_DEVOPS_PAT` | Personal Access Token (for PAT auth) | Only with PAT auth | - | |
| 114 | +| `AZURE_DEVOPS_DEFAULT_PROJECT` | Default project if none specified | No | - | |
| 115 | +| `AZURE_DEVOPS_API_VERSION` | API version to use | No | Latest | |
| 116 | +| `AZURE_TENANT_ID` | Azure AD tenant ID (for service principals) | Only with service principals | - | |
| 117 | +| `AZURE_CLIENT_ID` | Azure AD application ID (for service principals) | Only with service principals | - | |
| 118 | +| `AZURE_CLIENT_SECRET` | Azure AD client secret (for service principals) | Only with service principals | - | |
| 119 | +| `LOG_LEVEL` | Logging level (debug, info, warn, error) | No | info | |
| 120 | + |
| 121 | +## Troubleshooting Authentication |
| 122 | + |
| 123 | +For detailed troubleshooting information for each authentication method, see the [Authentication Guide](docs/authentication.md#troubleshooting-authentication-issues). |
| 124 | + |
| 125 | +Common issues include: |
| 126 | + |
| 127 | +- Invalid or expired credentials |
| 128 | +- Insufficient permissions |
| 129 | +- Network connectivity problems |
| 130 | +- Configuration errors |
| 131 | + |
| 132 | +## Authentication Implementation Details |
| 133 | + |
| 134 | +For technical details about how authentication is implemented in the Azure DevOps MCP server, see the [Authentication Guide](docs/authentication.md) and the source code in the `src/auth` directory. |
| 135 | + |
| 136 | +## Available Tools |
| 137 | + |
| 138 | +The Azure DevOps MCP server provides a variety of tools for interacting with Azure DevOps resources. For detailed documentation on each tool, please refer to the corresponding documentation. |
| 139 | + |
| 140 | +### User Tools |
| 141 | + |
| 142 | +- `get_me`: Get details of the authenticated user (id, displayName, email) |
| 143 | + |
| 144 | +### Organization Tools |
| 145 | + |
| 146 | +- `list_organizations`: List all accessible organizations |
| 147 | + |
| 148 | +### Project Tools |
| 149 | + |
| 150 | +- `list_projects`: List all projects in an organization |
| 151 | +- `get_project`: Get details of a specific project |
| 152 | +- `get_project_details`: Get comprehensive details of a project including process, work item types, and teams |
| 153 | + |
| 154 | +### Repository Tools |
| 155 | + |
| 156 | +- `list_repositories`: List all repositories in a project |
| 157 | +- `get_repository`: Get details of a specific repository |
| 158 | +- `get_repository_details`: Get detailed information about a repository including statistics and refs |
| 159 | +- `get_file_content`: Get content of a file or directory from a repository |
| 160 | + |
| 161 | +### Work Item Tools |
| 162 | + |
| 163 | +- `get_work_item`: Retrieve a work item by ID |
| 164 | +- `create_work_item`: Create a new work item |
| 165 | +- `update_work_item`: Update an existing work item |
| 166 | +- `list_work_items`: List work items in a project |
| 167 | +- `manage_work_item_link`: Add, remove, or update links between work items |
| 168 | + |
| 169 | +### Search Tools |
| 170 | + |
| 171 | +- `search_code`: Search for code across repositories in a project |
| 172 | +- `search_wiki`: Search for content across wiki pages in a project |
| 173 | +- `search_work_items`: Search for work items across projects in Azure DevOps |
| 174 | + |
| 175 | +### Pipelines Tools |
| 176 | + |
| 177 | +- `list_pipelines`: List pipelines in a project |
| 178 | +- `get_pipeline`: Get details of a specific pipeline |
| 179 | +- `trigger_pipeline`: Trigger a pipeline run with customizable parameters |
| 180 | + |
| 181 | +### Wiki Tools |
| 182 | + |
| 183 | +- `get_wikis`: List all wikis in a project |
| 184 | +- `get_wiki_page`: Get content of a specific wiki page as plain text |
| 185 | + |
| 186 | +### Pull Requests Tools |
| 187 | + |
| 188 | +- `create_pull_request`: Create a new pull request between branches in a repository |
| 189 | +- `list_pull_requests`: List and filter pull requests in a project or repository |
| 190 | +- `get_pull_request_comments`: Get comments and comment threads from a specific pull request |
| 191 | +- `add_pull_request_comment`: Add a comment to a pull request (reply to existing comments or create new threads) |
| 192 | + |
| 193 | +For comprehensive documentation on all tools, see the [Tools Documentation](docs/tools/). |
| 194 | + |
| 195 | +## Contributing |
| 196 | + |
| 197 | +Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines. |
| 198 | + |
| 199 | +## Star History |
| 200 | + |
| 201 | +[](https://www.star-history.com/#tiberriver256/mcp-server-azure-devops&Date) |
| 202 | + |
| 203 | +## License |
| 204 | + |
| 205 | +MIT |
0 commit comments