Claude Code can't authenticate to an Entra ID-protected .NET MCP server — workarounds?
I'm securing a .NET MCP server built on modelcontextprotocol/csharp-sdk with Microsoft Entra ID, but Claude Code can't complete the OAuth handshake: Entra ID doesn't support Dynamic Client Registration and Claude Code presents no client_id or client_metadata_document_uri, so there is no registration path. Is there a working way to make this work today without waiting for the ASP.NET Core MCP SDK to grow a DCR facade?
Originally asked on GitHub: https://github.com/modelcontextprotocol/csharp-sdk/issues/1446
5 answers
Status: still open — as of August 2026 the csharp-sdk has no built-in DCR facade, so an external proxy is currently required.
The working path posted in the thread is the open-source project Profility-be/mcp-server-dotnet-entra-id. It is an OAuth 2.1 proxy between MCP clients and Entra ID, built on .NET 10 and MCP C# SDK 2.2.0, and the author reports it was tested with Claude AI. It implements RFC 7591 Dynamic Client Registration, separate PKCE flows on the client-to-proxy and proxy-to-Entra legs, proxy-issued short-lived JWTs (so the upstream Entra token is never exposed to the MCP client), persistent stores for client registrations and token mappings, and OAuth authorization-server/protected-resource metadata. A later commenter reviewed the exchange path and confirmed that the split-PKCE and proxy-token design closes the confused-deputy problem raised in the issue.
Alternatives mentioned in the thread: an external sidecar such as sigbit/mcp-auth-proxy works but adds operations complexity with no idiomatic .NET integration, and pre-registering a client_id only helps clients that support pre-registration or CIMD — Claude Code supports neither. Microsoft's Azure DevOps team says Entra-side DCR support for tools like Claude Code is "coming soon"; at the time only Visual Studio and VS Code were supported, so that path was not usable yet.
Security note: keep upstream Entra tokens server-side and issue short-lived first-party JWTs to clients; if you build your own facade, plan for key rotation of the encrypted token store and log the minted token's subject, scopes, client_id, and jti.
Did this work for you?What @RonnyVDS tried on GitHub (Worked)
Adopted or referenced the open-source OAuth 2.1 proxy Profility-be/mcp-server-dotnet-entra-id (RFC 7591 DCR, split PKCE on both legs, proxy-issued tokens, .NET 10, MCP C# SDK 2.2.0); the author reports it was tested with Claude AI.
Did this work for you?What a GitHub user tried on GitHub (Worked)
Evaluated an external sidecar proxy (sigbit/mcp-auth-proxy): the issue author states it works but adds operations complexity and lacks idiomatic .NET integration.
Source: https://github.com/modelcontextprotocol/csharp-sdk/issues/1446 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Evaluated pre-registering a client_id and surfacing it to the client: only works for clients that support pre-registration or CIMD, and Claude Code supports neither.
Source: https://github.com/modelcontextprotocol/csharp-sdk/issues/1446 (opens external site)
Did this work for you?What @hansmbakker tried on GitHub (Didn't work)
Checked whether Microsoft/Entra had already enabled DCR for Claude tools: the Azure DevOps announcement supported only Visual Studio and VS Code, with Claude Code listed as coming soon, so it was not usable at the time.
Did this work for you?
Related questions
- Does the C# MCP SDK implement the Streamable HTTP transport (2025-03-26 spec)?
- How to use HTTP Streamable transport for MCP server and client in .NET csharp-sdk?
- How to pass HttpContext/bearer token from /message endpoint to MCP tool handler in csharp-sdk?
- Why is there no MCP Streamable HTTP server support on .NET Framework?
- C# MCP SDK: decouple StructuredContent from Content in McpServerTool results?