Skip to content

Commit 4de352f

Browse files
viamusclaude
andcommitted
docs: update README with all tools, fix PAT scopes, and add .env.example
- Add create_pull_request and get_pull_request_by_id to PR tools table - Fix PAT Code scope to Read & Write (required for creating PRs) - Add .env.example template with all docker-compose variables - Add .env.example exception to .gitignore (.env.* was blocking it) - Update Quick Start to show .env file approach for Docker users - Add PR creation usage examples - Update Docker section to instruct cp .env.example .env - Update Project Structure to include new files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dca5f70 commit 4de352f

3 files changed

Lines changed: 95 additions & 11 deletions

File tree

.env.example

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# ============================================
2+
# MCP Azure DevOps Server - Environment Variables
3+
# ============================================
4+
# Copy this file to .env and fill in your values:
5+
# cp .env.example .env
6+
#
7+
# This file is used by docker-compose.yml to configure the server.
8+
# IMPORTANT: Never commit the .env file to version control!
9+
# Add .env to your .gitignore if it isn't already.
10+
# ============================================
11+
12+
# --------------------------------------------
13+
# REQUIRED: Azure DevOps Organization URL
14+
# --------------------------------------------
15+
# Format: https://dev.azure.com/{organization}
16+
# Example: https://dev.azure.com/contoso
17+
#
18+
AZURE_DEVOPS_ORG_URL=https://dev.azure.com/your-organization
19+
20+
# --------------------------------------------
21+
# REQUIRED: Personal Access Token (PAT)
22+
# --------------------------------------------
23+
# Create at: https://dev.azure.com/{organization}/_usersSettings/tokens
24+
#
25+
# Required scopes:
26+
# - Work Items: Read & Write (get, create, update, add comments)
27+
# - Code: Read & Write (repos, branches, files, pull requests — Write required to create PRs)
28+
# - Build: Read (pipelines and builds)
29+
#
30+
# How to generate:
31+
# 1. Go to https://dev.azure.com/{your-org}
32+
# 2. Click User Settings (gear icon) > Personal Access Tokens
33+
# 3. Click + New Token
34+
# 4. Select the scopes above and set an expiration date
35+
# 5. Copy the token immediately — it won't be shown again
36+
#
37+
AZURE_DEVOPS_PAT=your-personal-access-token
38+
39+
# --------------------------------------------
40+
# OPTIONAL: Default Project
41+
# --------------------------------------------
42+
# When set, this project is used automatically when no project is specified
43+
# in a tool call. Must match the exact project name in Azure DevOps.
44+
#
45+
AZURE_DEVOPS_DEFAULT_PROJECT=your-project-name
46+
47+
# --------------------------------------------
48+
# OPTIONAL: API Key Authentication
49+
# --------------------------------------------
50+
# Protects the MCP server endpoints with an API key.
51+
# When MCP_REQUIRE_API_KEY=true, all requests (except /health) must include:
52+
# X-API-Key: <your-key>
53+
#
54+
# Generate a secure key:
55+
# openssl rand -base64 32
56+
# [Convert]::ToBase64String([Security.Cryptography.RandomNumberGenerator]::GetBytes(32)) # PowerShell
57+
#
58+
MCP_API_KEY=your-secure-api-key
59+
MCP_REQUIRE_API_KEY=false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Desktop.ini
109109
docker-compose.override.yml
110110
.env
111111
.env.*
112+
!.env.example
112113

113114
##############################
114115
# Publish / Artifacts

README.md

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ git clone https://github.com/viamus/mcp-azure-devops.git
2020
cd mcp-azure-devops
2121
```
2222

23+
**Option A — `.env` file (recommended for Docker):**
24+
25+
```bash
26+
cp .env.example .env
27+
# Edit .env with your Azure DevOps credentials
28+
```
29+
30+
**Option B — `appsettings.json` (for .NET CLI):**
31+
2332
Edit `src/Viamus.Azure.Devops.Mcp.Server/appsettings.json` with your Azure DevOps credentials:
2433

2534
```json
@@ -133,10 +142,12 @@ This project implements an MCP server that exposes tools for querying and managi
133142
| Tool | Description |
134143
|------|-------------|
135144
| `get_pull_requests` | Lists pull requests with optional filters (status, creator, reviewer, branches) |
136-
| `get_pull_request` | Gets details of a specific pull request by ID |
145+
| `get_pull_request` | Gets details of a specific pull request by ID within a repository |
146+
| `get_pull_request_by_id` | Gets details of a pull request by ID only, searching across all repositories in the project |
137147
| `get_pull_request_threads` | Gets comment threads for a pull request |
138148
| `search_pull_requests` | Searches pull requests by text in title or description |
139149
| `query_pull_requests` | Advanced query with multiple combined filters |
150+
| `create_pull_request` | Creates a new pull request with title, description, source/target branches, draft flag, reviewers, and linked work items |
140151

141152
### Pipeline/Build Tools
142153

@@ -208,9 +219,9 @@ Items are classified by urgency based on:
208219

209220
| Scope | Permission | Required for |
210221
|-------|------------|--------------|
211-
| Work Items | Read & Write | Work item operations |
212-
| Code | Read | Git repositories and Pull Requests |
213-
| Build | Read | Pipelines and Builds |
222+
| Work Items | Read & Write | Get, query, create, update work items and add comments |
223+
| Code | Read & Write | Git repositories, branches, files, and pull requests (Write required to create PRs) |
224+
| Build | Read | Pipelines and builds |
214225

215226
5. Click **Create** and **copy the token immediately** (you won't see it again!)
216227

@@ -222,9 +233,16 @@ Items are classified by urgency based on:
222233

223234
Best for: Production use, quick setup without .NET installed
224235

225-
```bash
226-
docker compose up -d
227-
```
236+
1. Create your `.env` file from the template:
237+
```bash
238+
cp .env.example .env
239+
# Edit .env with your Azure DevOps credentials
240+
```
241+
242+
2. Start the server:
243+
```bash
244+
docker compose up -d
245+
```
228246

229247
Server URL: `http://localhost:8080` (internal)
230248

@@ -311,11 +329,11 @@ Or via environment variables:
311329
# .NET CLI
312330
ServerSecurity__ApiKey=your-secret-key ServerSecurity__RequireApiKey=true dotnet run
313331

314-
# Docker
315-
docker compose up -d # Configure in .env file
332+
# Docker — configure in .env file (see .env.example)
333+
docker compose up -d
316334
```
317335

318-
For Docker, add to your `.env` file:
336+
For Docker, add to your `.env` file (see `.env.example` for the full template):
319337
```bash
320338
MCP_API_KEY=your-secret-api-key
321339
MCP_REQUIRE_API_KEY=true
@@ -397,10 +415,14 @@ After configuring the MCP client, you can ask questions like:
397415

398416
- "Show me all active pull requests in the 'my-repo' repository"
399417
- "Get details of pull request #123"
418+
- "Find pull request #456 anywhere in the project"
400419
- "What comments are on PR #456?"
401420
- "Search for pull requests related to 'authentication'"
402421
- "Show me PRs targeting the 'main' branch"
403422
- "List PRs created by user@email.com"
423+
- "Create a pull request from 'feature/login' to 'main' titled 'Add login page'"
424+
- "Open a draft PR from my branch to main with a description of the changes"
425+
- "Create a PR and link it to work items #123 and #456"
404426

405427
### Pipelines and Builds
406428

@@ -538,8 +560,10 @@ mcp-azure-devops/
538560
│ ├── Middleware/ # Middleware tests
539561
│ ├── Models/ # DTO tests
540562
│ └── Tools/ # Tool behavior tests
541-
├── .github/ # GitHub templates
563+
├── .github/ # GitHub templates and workflows
564+
├── .env.example # Environment variable template (copy to .env)
542565
├── docker-compose.yml # Docker orchestration
566+
├── install-mcp-azure-devops.ps1 # Windows automated installer
543567
├── CONTRIBUTING.md # Contributor guide
544568
├── CODE_OF_CONDUCT.md # Community guidelines
545569
├── SECURITY.md # Security policy

0 commit comments

Comments
 (0)