Azure / Azure/CosmosDBShell

M7. MCP authorization (OAuth code flow)

Aperta
#159 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
agentic enhancement P1
Lingua principale
C#
Stelle
3
Fork
7
Merge medio
1g 12h
PR unite (30g)
14

Descrizione

## 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._

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da docs/mcp.md e docs/agentic-roadmap.md, in particolare dall'elemento M7 della roadmap, quindi traccia il trasporto HTTP e il percorso esistente delle credenziali Entra/RBAC. Il lavoro è completato quando le richieste remote non autenticate vengono rifiutate, l'autorizzazione tramite bearer token funziona, l'identità raggiunge le credenziali Cosmos/ARM, l'assenza di autenticazione su localhost rimane controllata da un flag e il threat model e la documentazione vengono aggiornati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
azure, csharp
Ambito
authentication, authorization, cli, security
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.