[Auth] OAuth proxy / DCR facade for non-DCR providers (e.g. Entra ID + Claude Code)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- csharp
- Ambito
- authentication, backend-api-design, security
Direzione di ricerca
Inizia esaminando la superficie di autenticazione in ModelContextProtocol.AspNetCore e il design collegato di FastMCP OAuthProxy/OIDCProxy. Definisci la facciata DCR, l’inoltro del callback, la factory dei token, le protezioni per State e PKCE, l’OIDC discovery e i confini di storage di IDataProtector/IDistributedCache; il lavoro è completato quando Claude Code può autenticarsi tramite il proxy senza esporre i token upstream.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
Securing an MCP server with Entra ID is not workable when the connecting client is Claude Code. Entra ID doesn't support Dynamic Client Registration, and Claude Code has no app registration and no client_metadata_document_uri to offer, so there's no client_id to present and no supported registration path. Claude Code simply can't authenticate against an Entra-backed MCP server today.
This is distinct from #648 / PR #1402, which fix the resource= parameter bug for clients that already have a pre-registered client_id. That fix is necessary but not sufficient: our problem is upstream of it.
Describe the solution you'd like
A server-side OAuth proxy / DCR facade in ModelContextProtocol.AspNetCore, similar to what FastMCP (Python) ships as OAuthProxy / OIDCProxy. At a high level it would:
- Present a DCR-compliant surface to MCP clients: handle
POST /registerand return pre-registered credentials rather than attempting real DCR against the upstream provider - Handle callback forwarding: store the MCP client's dynamic redirect URI, use the server's fixed redirect URI with the upstream provider, and forward back to the client after token exchange
- Issue its own short-lived JWTs to MCP clients rather than forwarding the upstream token (token factory pattern), preventing token passthrough
- Encrypt and store upstream tokens server-side using
IDataProtectorandIDistributedCache - Support OIDC discovery: Entra exposes
/.well-known/openid-configuration, so endpoints should be auto-discoverable rather than manually configured
Describe alternatives you've considered
- External sidecar proxy (e.g.
mcp-auth-proxy): works, but adds ops complexity with no idiomatic .NET integration - Use a DCR-capable AS (Auth0, WorkOS): viable, but forces a third-party IdP dependency on teams already standardised on Entra
- Pre-registration + surfacing
client_idin PRM: only works for clients that support pre-registration or CIMD; Claude Code supports neither
Additional context
FastMCP's implementation is a useful reference for the security design: it includes confused deputy mitigation via state cookie binding, PKCE validation at both the client-to-proxy and proxy-to-upstream legs, and a token factory that ensures upstream tokens are never exposed to MCP clients.
- Lingua principale
- C#
- Stelle
- 4.5k
- Fork
- 814
- Merge medio
- 9g 19h
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/csharp-sdk
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
modelcontextprotocol/csharp-sdk#678 · 1 commento ·
-
enhancement needs confirmation P3 ready for work
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/csharp-sdk#515 · 6 commenti · 3 reazioni ·
Tutte le issue di modelcontextprotocol/csharp-sdk
Issue simili
-
effort:S P3 refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
C#/.NET Roslyn LSP Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Suspicious code fragments Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
DotNetNext/SqlSugar#1458 ·