Skip to content

Commit 002f556

Browse files
nebrassdanhellem
andauthored
Add guidance for WSL2/headless/SSH environments (#1128)
## Summary - Adds a new troubleshooting section for headless environments (WSL2, SSH, Docker, CI runners) - Documents the silent OAuth failure where the server reports "Connected" but all tool calls return `network_error: fetch failed` - Provides two workaround options: `envvar` auth with PAT, and `azcli` auth with `az login` - Includes Claude Code-specific configuration example ## Motivation The default OAuth interactive authentication requires a browser. In headless environments, the browser redirect fails silently, and users see only a generic `fetch failed` error with no actionable guidance. This has been reported in #209, #398, #1104, and now #1127, but the troubleshooting documentation does not cover this scenario. ## Changes - `docs/TROUBLESHOOTING.md`: New section "WSL2, SSH, Docker, and Other Headless Environments" under "Authentication Issues", placed between the existing "GitHub Codespaces" and "OAuth" sections Fixes #1127 Co-authored-by: Dan Hellem <dahellem@microsoft.com>
1 parent 1d6bf31 commit 002f556

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

docs/TROUBLESHOOTING.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,69 @@ in the terminal before using MCP tools.
123123

124124
And in case there are authorization/access errors when using the tools please check the [Multi-Tenant Authentication Problems guide](#multi-tenant-authentication-problems-when-using-azcli)
125125

126+
### WSL2, SSH, Docker, and Other Headless Environments
127+
128+
The default OAuth interactive authentication requires a browser to complete the login redirect. In headless environments — such as **WSL2**, **remote SSH sessions**, **Docker containers**, and **CI runners** — no browser is available, causing token acquisition to fail silently.
129+
130+
#### Symptoms
131+
132+
- The MCP server starts successfully and reports as "Connected"
133+
- All tool calls fail with:
134+
135+
```
136+
network_error: Network request failed: fetch failed
137+
```
138+
139+
- Direct Azure DevOps REST API calls (e.g. via `az devops project list`) work on the same machine with the same credentials
140+
141+
#### Root Cause
142+
143+
The server defaults to `--authentication interactive`, which opens a browser for the OAuth redirect callback. In headless environments the browser redirect has nowhere to go. The token acquisition fails silently, and downstream API calls surface a generic `fetch failed` error instead of a clear authentication failure.
144+
145+
#### Solution
146+
147+
Use one of the non-interactive authentication methods:
148+
149+
**Option 1: Environment variable with a Personal Access Token (recommended for headless)**
150+
151+
1. Create a [Personal Access Token](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate) with the required scopes.
152+
153+
2. Set the token in the `ADO_MCP_AUTH_TOKEN` environment variable:
154+
155+
```bash
156+
export ADO_MCP_AUTH_TOKEN="your-azure-devops-pat"
157+
```
158+
159+
3. Start the server with `--authentication envvar`:
160+
161+
```bash
162+
npx -y @azure-devops/mcp myorg --authentication envvar
163+
```
164+
165+
For Claude Code:
166+
167+
```bash
168+
claude mcp add azure-devops -s user \
169+
-e ADO_MCP_AUTH_TOKEN="your-azure-devops-pat" \
170+
-- npx -y @azure-devops/mcp myorg --authentication envvar
171+
```
172+
173+
**Option 2: Azure CLI authentication**
174+
175+
1. Install [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) and log in:
176+
177+
```bash
178+
az login
179+
```
180+
181+
2. Start the server with `--authentication azcli`:
182+
183+
```bash
184+
npx -y @azure-devops/mcp myorg --authentication azcli
185+
```
186+
187+
> **Note:** If your Azure DevOps organization is in a different tenant than your default `az` CLI tenant, you must also pass `--tenant <tenant-id>`. See the [Multi-Tenant Authentication Problems](#multi-tenant-authentication-problems-when-using-azcli) section below.
188+
126189
### OAuth
127190

128191
Recent switch to OAuth flow is supposed to simplify authentication against ADO APIs and remove additional software dependency.

0 commit comments

Comments
 (0)