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.