---
title: "ADO MCP Gateway — case study"
description: "Multi-tenant MCP server that gives Microsoft Copilot Studio agents read-only, policy-enforced access to many Azure DevOps organizations from a single App Service deployment, with credentials in Key Vault."
url: "https://nishantxrana.com/projects/ado-mcp-gateway"
updated: "2026-11-10T00:00:00.000Z"
---

# ADO MCP Gateway

Multi-tenant MCP server that gives Microsoft Copilot Studio agents read-only, policy-enforced access to many Azure DevOps organizations from a single App Service deployment, with credentials in Key Vault.

- **Role:** Solo engineer · architecture, security, delivery
- **Year:** 2026
- **Status:** Open source
- **Stack:** TypeScript, Express 5, MCP SDK, Azure App Service, Azure Key Vault, Managed Identity, Copilot Studio, Vitest
- **Source:** https://github.com/nishantxrana/AzureMcpGateway

## Highlights

- Default-deny tool policy; only reviewed tools and actions are reachable, even after upstream upgrades
- Every tool call spawns an isolated child process holding only that organization's credentials
- Uniform 401s with constant-time comparison and failed-auth throttling before the key check

## Architecture

```mermaid
flowchart LR
  agent["Copilot Studio<br/>agent per org"]
  gw["Gateway<br/>Express 5 · stateless"]
  policy["Tool policy<br/>default-deny"]
  kv["Key Vault<br/>managed identity"]
  child["ADO MCP child<br/>spawned per call"]
  ado["Azure DevOps<br/>dev.azure.com/org"]
  agent -->|"POST /mcp/alias"| gw
  gw --> policy
  gw --> kv
  gw -->|"stdio"| child
  child -->|"HTTPS"| ado
```

## The problem

Copilot Studio agents are far more useful when they can read Azure DevOps: work items, repositories, pipelines, wikis. But wiring each agent straight to the upstream ADO MCP server hands it the full, write-capable tool surface and a raw credential. Doing that safely across many client organizations multiplies the risk.

## What I built

One gateway instance fronts every organization. Each org gets its own alias (`/mcp/<alias>`), API keys, ADO credentials (PAT or Entra service principal), allowed domains and rate limits, all defined in a Zod-validated registry. Nothing about one organization is ever visible on another's request path.

## Key decisions

**Default-deny over default-allow.** Only tools and *actions* explicitly listed in the policy file are reachable. Anything new that appears after an `@azure-devops/mcp` upgrade is rejected until someone reviews it, and actions that match mutation verbs are refused outright.

**Spawn-per-call isolation.** Each `tools/call` runs in a fresh child process whose environment contains only that organization's credentials, behind a concurrency pool and a hard timeout. A crash or a leak can't cross tenants.

**Auth that leaks nothing.** An unknown alias, a missing key and a wrong key all return the same 401 body. Keys are compared as SHA-256 digests with `timingSafeEqual`, including a dummy comparison for unknown aliases, and failed attempts are throttled per alias and IP *before* the key check.

**Key Vault in production, by force.** Secrets resolve through a pluggable provider: Key Vault with managed identity (5-minute cache) is mandatory in production, and the environment-variable provider refuses to start outside development and test.

**Shaped responses.** Results are stripped of ADO noise (`_links`, avatars, plan internals), keep the `UNTRUSTED` envelope that marks model-facing text, and are size-capped before they reach the agent.

## Delivery

A Vitest unit and integration suite, plus verification scripts that check live tool drift, secret leakage, auth and throttle behaviour, and Azure readiness before every deploy to App Service.

---

Canonical: https://nishantxrana.com/projects/ado-mcp-gateway · Index for agents: https://nishantxrana.com/llms.txt · Contact: nishantxrana@gmail.com
