[Auth] OAuth proxy / DCR facade for non-DCR providers (e.g. Entra ID + Claude Code)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp
- Domain
- authentication, backend-api-design, security
Research direction
Start by reviewing the authentication surface in ModelContextProtocol.AspNetCore and the linked FastMCP OAuthProxy/OIDCProxy design. Define the DCR facade, callback forwarding, token factory, state and PKCE protections, OIDC discovery, and IDataProtector/IDistributedCache storage boundaries; done means Claude Code can authenticate through the proxy without exposing upstream tokens.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/csharp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comment ·
-
enhancement needs confirmation P3 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comments · 3 reactions ·
All issues in modelcontextprotocol/csharp-sdk
Similar issues
-
effort:S P3 refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
C#/.NET Roslyn LSP Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
DotNetNext/SqlSugar#1458 ·