Skip to content

Commit 2cf1136

Browse files
authored
Merge branch 'main' into main
2 parents 8fe2605 + fb99215 commit 2cf1136

20 files changed

+1503
-84
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
trigger: none
2+
3+
schedules:
4+
- cron: "0 22 * * *" # Runs every day at 22:00 UTC
5+
displayName: Nightly Pre-release
6+
branches:
7+
include:
8+
- main
9+
10+
variables:
11+
- group: npm-credentials
12+
- name: nightlyVersion
13+
value: $[counter(format('{0:yyyy}{0:MM}{0:dd}', pipeline.startTime), 1)]
14+
15+
jobs:
16+
- job: PreReleaseNightly
17+
pool:
18+
vmImage: "windows-latest"
19+
20+
steps:
21+
- task: UseNode@1
22+
inputs:
23+
version: "20"
24+
checkLatest: false
25+
retryCountOnDownloadFails: 2
26+
27+
- task: npmAuthenticate@0
28+
inputs:
29+
workingFile: .npmrc
30+
customEndpoint: "npmjs-service-connection"
31+
displayName: Authenticate with npm registry
32+
33+
- task: PowerShell@2
34+
displayName: Create .npmrc with auth token
35+
inputs:
36+
targetType: "inline"
37+
script: |
38+
"//registry.npmjs.org/:_authToken=$(NPM_TOKEN)" | Out-File -FilePath ".npmrc" -Encoding utf8
39+
"@azure-devops:registry=https://registry.npmjs.org/" | Add-Content -Path ".npmrc"
40+
41+
- task: Npm@1
42+
inputs:
43+
command: "ci"
44+
displayName: Install clean dependencies
45+
46+
- task: PowerShell@2
47+
displayName: Update package version for nightly release
48+
inputs:
49+
targetType: "inline"
50+
script: |
51+
# Read version.ts to get base version
52+
$versionTs = Get-Content "src/version.ts"
53+
$baseVersionLine = $versionTs | Where-Object { $_ -match 'export const packageVersion = "(.+)"' }
54+
$baseVersion = $Matches[1]
55+
56+
# Generate date suffix (YYYYMMDD format)
57+
$dateString = Get-Date -Format "yyyyMMdd"
58+
59+
$packageJson = Get-Content "package.json" | ConvertFrom-Json
60+
$nightlyVersion = "$baseVersion-nightly.$dateString"
61+
$packageJson.version = $nightlyVersion
62+
$packageJson | ConvertTo-Json -Depth 100 | Set-Content "package.json"
63+
Write-Host "Updated version to: $nightlyVersion"
64+
65+
- task: Npm@1
66+
inputs:
67+
command: "custom"
68+
customCommand: "run build"
69+
displayName: Build the project
70+
71+
- task: Npm@1
72+
inputs:
73+
command: "custom"
74+
customCommand: "publish --access public --registry=https://registry.npmjs.org/ --tag nightly --tag pre-release"
75+
displayName: Publish nightly package to npmjs under @azure-devops org scope

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
run: |
115115
git diff --exit-code ./src/version.ts
116116
if (!$?) {
117-
Write-Host "Version mismatch detected. Please run 'npm run build' to update version.ts and add changes to the commit."
117+
Write-Host "Version mismatch detected. Please ensure that the version information in version.ts is up to date with package.json."
118118
exit 1
119119
}
120120
git diff --exit-code ./package-lock.json

.github/workflows/pre-release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Nightly Pre-release
2+
3+
permissions:
4+
contents: read
5+
id-token: write # Required for OIDC
6+
7+
on:
8+
schedule:
9+
- cron: "0 22 * * *" # Runs every day at 22:00 UTC (midnight CEST during daylight saving time)
10+
workflow_dispatch:
11+
12+
jobs:
13+
pre-release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
registry-url: "https://registry.npmjs.org"
25+
26+
# npm 11.5.1 or later is required for OIDC integration
27+
- name: Update npm
28+
run: npm install -g npm@latest
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Build the project
34+
run: npm run build --if-present
35+
36+
- name: Run tests
37+
run: npm test
38+
39+
- name: Publish to npm with nightly version
40+
run: |
41+
DATE_STRING=$(date +%Y%m%d)
42+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
43+
npm version "$CURRENT_VERSION-nightly.$DATE_STRING" --no-git-tag-version
44+
npm publish --access public --tag nightly --tag pre-release --provenance

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
id-token: write # Required for OIDC
11+
contents: read
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: "20"
22+
registry-url: "https://registry.npmjs.org"
23+
24+
# Ensure npm 11.5.1 or later is installed
25+
- name: Update npm
26+
run: npm install -g npm@latest
27+
- run: npm ci
28+
- run: npm run build --if-present
29+
- run: npm test
30+
- run: npm publish --provenance

.github/workflows/version-update.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Update Package Version
22

33
permissions:
4-
contents: read
4+
contents: write # Changed from 'read' to 'write' to allow pushing commits
55
pull-requests: write
66
packages: write
77

@@ -27,7 +27,9 @@ jobs:
2727
- name: Determine version type
2828
id: version_type
2929
run: |
30-
if ($env:GITHUB_EVENT_PULL_REQUEST_LABELS -contains "minor") {
30+
if ($env:GITHUB_EVENT_PULL_REQUEST_LABELS -contains "major") {
31+
$env:VERSION_TYPE = "major"
32+
} elseif ($env:GITHUB_EVENT_PULL_REQUEST_LABELS -contains "minor") {
3133
$env:VERSION_TYPE = "minor"
3234
} elseif ($env:GITHUB_EVENT_PULL_REQUEST_LABELS -contains "patch") {
3335
$env:VERSION_TYPE = "patch"
@@ -37,25 +39,54 @@ jobs:
3739
shell: pwsh
3840

3941
- name: Checkout code
40-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
uses: actions/checkout@v4
43+
with:
44+
token: ${{ secrets.GITHUB_TOKEN }} # Added token for push permissions
4145

4246
- name: Set up Node.js
43-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
47+
uses: actions/setup-node@v4
4448
with:
4549
node-version: 20
4650

51+
- name: Configure Git
52+
run: |
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
shell: pwsh
56+
4757
- name: Update package version and push tag
4858
if: env.VERSION_TYPE != ''
4959
run: |
60+
# Get current version from package.json
61+
$packageJson = Get-Content "package.json" | ConvertFrom-Json
62+
$currentVersion = $packageJson.version
63+
Write-Host "Current version: $currentVersion"
64+
65+
# Update package.json version and create git tag
5066
$newVersion = npm version $env:VERSION_TYPE
51-
git tag "v$newVersion"
52-
git push origin "v$newVersion"
67+
$newVersionString = $newVersion.TrimStart('v')
68+
Write-Host "New version: $newVersionString"
69+
70+
# Update version.ts file
71+
$versionTs = Get-Content "src/version.ts"
72+
$updatedVersionTs = $versionTs -replace 'export const packageVersion = ".*"', "export const packageVersion = `"$newVersionString`""
73+
$updatedVersionTs | Set-Content "src/version.ts"
74+
Write-Host "Updated version.ts"
75+
76+
# Show git status for debugging
77+
git status
78+
79+
# Add version.ts to the commit
80+
git add src/version.ts
81+
git commit --amend --no-edit
82+
Write-Host "Updated commit with version.ts"
83+
5384
shell: pwsh
85+
env:
86+
VERSION_TYPE: ${{ env.VERSION_TYPE }}
5487

5588
- name: Push changes
5689
if: env.VERSION_TYPE != ''
5790
run: |
58-
git config user.name "github-actions[bot]"
59-
git config user.email "github-actions[bot]@users.noreply.github.com"
6091
git push origin HEAD:main
6192
shell: pwsh

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ Click "Select Tools" and choose the available tools.
208208

209209
Open GitHub Copilot Chat and try a prompt like `List ADO projects`.
210210

211-
> 💥 We strongly recommend creating a `.github\copilot-instructions.md` in your project and copying the contents from this [copilot-instructions.md](./.github/copilot-instructions.md) file. This will enhance your experience using the Azure DevOps MCP Server with GitHub Copilot Chat.
211+
> 💥 We strongly recommend creating a `.github\copilot-instructions.md` in your project. This will enhance your experience using the Azure DevOps MCP Server with GitHub Copilot Chat.
212+
> To start, just include "`This project uses Azure DevOps. Always check to see if the Azure DevOps MCP server has a tool relevant to the user's request`" in your copilot instructions file.
212213
213214
See the [getting started documentation](./docs/GETTINGSTARTED.md) to use our MCP Server with other tools such as Visual Studio 2022, Claude Code, and Cursor.
214215

docs/TROUBLESHOOTING.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,35 @@ The MCP server may be authenticating with a different tenant than your Azure Dev
7171

7272
Look for the `tenantId` field in the output for the desired tenant (for guest accounts this will be the tenant of your organization and may be different than the Azure Devops Organization tenant).
7373

74-
2. **Configure the MCP server with the tenant ID** by updating your `.vscode/mcp.json`:
74+
2. **Configure the MCP server with the tenant ID** by updating your `.vscode/mcp.json`.
75+
76+
🧨 Installation from Public Feed Configuration:
77+
78+
```json
79+
{
80+
"inputs": [
81+
{
82+
"id": "ado_org",
83+
"type": "promptString",
84+
"description": "Azure DevOps organization name (e.g. 'contoso')"
85+
},
86+
{
87+
"id": "ado_tenant",
88+
"type": "promptString",
89+
"description": "Azure tenant ID (required for multi-tenant scenarios)"
90+
}
91+
],
92+
"servers": {
93+
"ado": {
94+
"type": "stdio",
95+
"command": "npx",
96+
"args": ["-y", "@azure-devops/mcp", "${input:ado_org}", "--tenant", "${input:ado_tenant}"]
97+
}
98+
}
99+
}
100+
```
101+
102+
🛠️ Installation from Source Configuration:
75103

76104
```json
77105
{
@@ -102,3 +130,44 @@ The MCP server may be authenticating with a different tenant than your Azure Dev
102130
4. **When prompted**, enter:
103131
- Your Azure DevOps organization name
104132
- The tenant ID from step 1
133+
134+
### Dev Container and WSL Authentication Issues
135+
136+
If the tenant configuration solution above doesn't resolve your authentication issues, and you're working in a **Dev Container** or **WSL (Windows Subsystem for Linux)** environment, the root cause may be different.
137+
138+
#### Symptoms
139+
140+
- Same authorization errors as above (`TF400813: The user 'xxx' is not authorized to access this resource`)
141+
- Tenant ID configuration didn't resolve the issue
142+
- You're using VS Code with Dev Containers or WSL
143+
- MCP server is configured in User Settings (global) rather than workspace settings
144+
145+
#### Root Cause
146+
147+
When MCP servers are configured in **User Settings** (global configuration), they inherit the environment context from the **host machine**, including `az login` authentication settings. In Dev Container or WSL scenarios, this means:
148+
149+
- The MCP server uses the host machine's Azure authentication
150+
- Any `az login` performed inside the Dev Container or WSL environment is ignored
151+
- There may be a mismatch between the authentication context the MCP server expects and your development environment
152+
153+
#### Solution
154+
155+
1. **Verify your MCP configuration location**:
156+
- Check if your MCP server is configured in User Settings (global) vs Workspace Settings
157+
- User Settings: Run `MCP: Open User Configuration` from Command Palette
158+
- Workspace Settings: Check for `.vscode/mcp.json` in your project
159+
160+
2. **For User Settings (Global) MCP configuration**:
161+
- Ensure you are logged into Azure from the **host machine** (not inside the Dev Container/WSL)
162+
- Run `az login` on the host Windows machine (outside of WSL/Dev Container)
163+
- Do NOT run `az login` inside the Dev Container or WSL environment
164+
- Restart VS Code completely
165+
166+
3. **Alternative: Use Workspace Settings instead**:
167+
- Move your MCP server configuration from User Settings to Workspace Settings
168+
- Create/update `.vscode/mcp.json` in your project
169+
- This allows the MCP server to use the authentication context from within the Dev Container/WSL environment
170+
171+
4. **For Dev Containers specifically**:
172+
- Consider configuring MCP servers directly in your `devcontainer.json` file using the `customizations.vscode.mcp` section
173+
- This ensures the MCP server runs within the containerized environment with the correct context

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure-devops/mcp",
3-
"version": "1.2.1",
3+
"version": "1.3.1",
44
"description": "MCP server for interacting with Azure DevOps",
55
"license": "MIT",
66
"author": "Microsoft Corporation",

src/tools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import { configureWorkTools } from "./tools/work.js";
1717
import { configureWorkItemTools } from "./tools/workitems.js";
1818

1919
function configureAllTools(server: McpServer, tokenProvider: () => Promise<AccessToken>, connectionProvider: () => Promise<WebApi>, userAgentProvider: () => string) {
20-
configureCoreTools(server, tokenProvider, connectionProvider);
20+
configureCoreTools(server, tokenProvider, connectionProvider, userAgentProvider);
2121
configureWorkTools(server, tokenProvider, connectionProvider);
22-
configureBuildTools(server, tokenProvider, connectionProvider);
23-
configureRepoTools(server, tokenProvider, connectionProvider);
22+
configureBuildTools(server, tokenProvider, connectionProvider, userAgentProvider);
23+
configureRepoTools(server, tokenProvider, connectionProvider, userAgentProvider);
2424
configureWorkItemTools(server, tokenProvider, connectionProvider, userAgentProvider);
2525
configureReleaseTools(server, tokenProvider, connectionProvider);
2626
configureWikiTools(server, tokenProvider, connectionProvider);

0 commit comments

Comments
 (0)