npm package: @mcp-packages/azure-devops-server
Description: MCP server for self-hosted Azure DevOps Server instances — code search and repository browsing via the Model Context Protocol
Latest version: 0.2.0

# Azure DevOps MCP Server

MCP server for self-hosted Azure DevOps Server instances. Provides code search, repository browsing, pull request management, and pipeline tools for AI assistants like Cursor and Claude Code.

## Prerequisites

- Node.js 18+
- A self-hosted Azure DevOps Server 2019+ instance
- A Personal Access Token (PAT) with **Code (Read/Write)** and **Build (Read/Execute)** scopes
- The **Code Search** extension installed on your Azure DevOps instance (required for `search_code`)

## Quick Start

No cloning or building required. Add the server directly to your AI tool's MCP configuration:

### Cursor

Add to `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "azure-devops": {
      "command": "npx",
      "args": ["-y", "@mcp-packages/azure-devops-server"],
      "env": {
        "AZURE_DEVOPS_ORG_URL": "https://devops.company.com/DefaultCollection",
        "AZURE_DEVOPS_PAT": "your-pat-here"
      }
    }
  }
}
```

### Claude Code

```json
{
  "mcpServers": {
    "azure-devops": {
      "command": "npx",
      "args": ["-y", "@mcp-packages/azure-devops-server"],
      "env": {
        "AZURE_DEVOPS_ORG_URL": "https://devops.company.com/DefaultCollection",
        "AZURE_DEVOPS_PAT": "your-pat-here"
      }
    }
  }
}
```

### Global Install (alternative)

If you prefer a persistent install over `npx`:

```bash
npm install -g @mcp-packages/azure-devops-server
```

Then use `"command": "azure-devops-mcp"` instead of the `npx` command in your MCP config.

## Environment Variables

| Variable | Required | Description |
|---|---|---|
| `AZURE_DEVOPS_ORG_URL` | Yes | Collection URL (e.g., `https://devops.company.com/DefaultCollection`) |
| `AZURE_DEVOPS_PAT` | Yes | Personal Access Token with Code (Read/Write) and Build (Read/Execute) scopes |

## Available Tools

### Code & Repository Browsing

| Tool | Description |
|---|---|
| `search_code` | Full-text code search across repositories |
| `list_projects` | List all accessible projects |
| `list_repositories` | List repositories in a project |
| `get_file_content` | Read file contents from a repository |
| `get_directory_tree` | Browse directory structure |
| `list_branches` | List branches for a repository |

### Pull Request Management

| Tool | Description |
|---|---|
| `list_pull_requests` | List PRs with filters for status, creator, reviewer |
| `get_pull_request` | Get full PR details (description, reviewers, merge status, labels) |
| `create_pull_request` | Create a new PR with title, branches, description, and reviewers |
| `update_pull_request` | Update PR title, description, or status (active/abandoned/completed) |
| `get_pr_threads` | Get all comment threads on a PR with file context |
| `create_pr_comment` | Create a comment thread or reply to an existing thread |

### Pipelines & Builds

| Tool | Description |
|---|---|
| `list_pipelines` | List pipeline definitions in a project |
| `list_pipeline_runs` | List recent builds with status/result filters |
| `get_pipeline_run` | Get build details with full stage/job/task timeline |
| `get_build_log` | Get build log output (defaults to last 200 lines) |
| `trigger_pipeline` | Queue a new build for a pipeline definition |

## Development

If you want to contribute or run from source:

```bash
git clone <repo-url>
cd mcp-servers
npm install
npm run build -w @mcp-packages/azure-devops-server
```

Then point your MCP config to the local build:

```json
{
  "command": "node",
  "args": ["<path-to-repo>/packages/azure-devops-server/dist/index.js"]
}
```