M7. MCP authorization (OAuth code flow)
- Lenguaje dominante
- C#
- Estrellas
- 3
- Forks
- 7
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 14
Descripción
## Why
Today the MCP server relies solely on **origin-header validation** and localhost binding — safe for a single-user local machine, but there is **no authorization layer**. Any **remote, hosted, or shared** agent deployment (team agent, CI runner, cloud-hosted assistant) currently has no supported way to authenticate a caller. The MCP spec defines an **OAuth 2.1 authorization-code flow** for exactly this; adopting it unlocks hosted/agentic scenarios without falling back to master keys.
This is the natural companion to confirmation/elicitation (item M3): authorization answers *"who is allowed to call,"* M3 answers *"what may they do."*
## Proposed behavior
- Implement the MCP **authorization-code flow** for the HTTP transport: advertise the authorization server, validate bearer tokens on each request, and map the authenticated identity onto the shell's existing Entra/RBAC connection so tool calls run with **least-privilege, per-caller** credentials rather than a shared session.
- Keep localhost/no-auth as an explicit opt-in for the current single-user experience.
## Acceptance criteria
- Unauthenticated remote requests are rejected.
- A client can complete the authorization-code flow and call tools with a bearer token.
- Identity flows to the Cosmos/ARM credential.
- Localhost no-auth mode preserved behind a flag.
- Threat model + `docs/mcp.md` updated.
---
_Filed from the Agentic & Automation Roadmap (`docs/agentic-roadmap.md`), item **M7**, Wave 2. Priority P1._
Guía de contribución
Línea de trabajo
Comienza con docs/mcp.md y docs/agentic-roadmap.md, especialmente con el elemento M7 de la hoja de ruta, y luego sigue el transporte HTTP y la ruta existente de credenciales de Entra/RBAC. Se considera terminado cuando se rechazan las solicitudes remotas no autenticadas, funciona la autorización mediante bearer token, la identidad llega a las credenciales de Cosmos/ARM, la ausencia de autenticación en localhost sigue estando controlada por un flag y se actualizan el modelo de amenazas y la documentación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- azure, csharp
- Área
- authentication, authorization, cli, security
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100