claude-code - ✅(Solved) Fix Remote MCP OAuth: prompt=consent hardcoded on every authorize request breaks Entra tenants with user-consent disabled [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49722Fetched 2026-04-17 08:33:17
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

Claude Code 2.1.109's remote HTTP MCP transport hardcodes prompt=consent on every OAuth authorize request. This forces Microsoft Entra ID to show the consent UI on every sign-in, regardless of whether admin consent has already been granted tenant-wide.

In Entra tenants where user consent is disabled (a common enterprise policy), non-admin users are routed into the admin consent request workflow ("This app requires your admin's approval" + "Enter justification") on every connection attempt — even after an admin has explicitly granted tenant-wide consent on the app registration. There is no "Accept" button; the user is blocked.

Root Cause

Fix Action

Fix / Workaround

Any Entra tenant with user consent disabled (standard enterprise security posture) cannot use Claude Code's remote MCP transport without one of these workarounds:

PR fix notes

PR #29: docs: cross-link claude-code#49722 prompt=consent Entra blocker

Description (problem / solution / changelog)

Summary

Adds a single workaround entry in each README (en / ja) pointing at claude-code#49722. mcp-stdio already behaves correctly — _run_authorization_flow does not set the prompt= parameter on the authorize URL — so users affected by the Entra-with-user-consent-disabled block can fall back to mcp-stdio today without any code change on our side.

Verification

$ grep -n "prompt" src/mcp_stdio/oauth.py
(no matches)

The authorize params dict only sets client_id, response_type, redirect_uri, state, code_challenge, code_challenge_method, resource, and optionally scope. No prompt=consent.

Test plan

  • pytest tests/ — passes unchanged (README-only diff)
  • After merge: release-please proposes v0.5.2 (visible docs: section in our changelog config), merge opens the automated PyPI chain

🤖 Generated with Claude Code

Changed files

  • README.ja.md (modified, +1/-0)
  • README.md (modified, +1/-0)

Code Example

claude mcp add --transport http --client-id <app-reg-id> --callback-port 6274 my-server https://my-server.example.com/mcp

---

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize
  ?response_type=code
  &client_id=<app-reg-id>
  &code_challenge=<pkce>
  &code_challenge_method=S256
  &redirect_uri=http://localhost:6274/callback
  &scope=https://my-server.example.com/mcp/access_as_user+offline_access
  &prompt=consent          ← this is the problem
  &resource=https://my-server.example.com/mcp
RAW_BUFFERClick to expand / collapse

Summary

Claude Code 2.1.109's remote HTTP MCP transport hardcodes prompt=consent on every OAuth authorize request. This forces Microsoft Entra ID to show the consent UI on every sign-in, regardless of whether admin consent has already been granted tenant-wide.

In Entra tenants where user consent is disabled (a common enterprise policy), non-admin users are routed into the admin consent request workflow ("This app requires your admin's approval" + "Enter justification") on every connection attempt — even after an admin has explicitly granted tenant-wide consent on the app registration. There is no "Accept" button; the user is blocked.

Reproduction

  1. Set up a .NET MCP server with Entra JWT Bearer auth + ModelContextProtocol.AspNetCore MCP authentication scheme (RFC 9728 protected resource metadata)
  2. Create a public client Entra app registration with PKCE, access_as_user scope, admin consent granted tenant-wide
  3. Ensure the Entra tenant has Enterprise applications → Consent and permissions → User consent settings set to "Do not allow user consent" (common in enterprise/MSP tenants)
  4. Add the MCP server to Claude Code:
    claude mcp add --transport http --client-id <app-reg-id> --callback-port 6274 my-server https://my-server.example.com/mcp
  5. /mcp → Authenticate

Expected: Since admin consent is already granted, Entra should skip the consent prompt and issue tokens directly.

Actual: The authorize URL contains &prompt=consent, which forces Entra to show the consent UI. With user consent disabled at the tenant level, Entra shows the admin-approval-required form instead of an Accept button. Non-admin users are blocked indefinitely.

The authorize URL Claude generates

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize
  ?response_type=code
  &client_id=<app-reg-id>
  &code_challenge=<pkce>
  &code_challenge_method=S256
  &redirect_uri=http://localhost:6274/callback
  &scope=https://my-server.example.com/mcp/access_as_user+offline_access
  &prompt=consent          ← this is the problem
  &resource=https://my-server.example.com/mcp

Impact

Any Entra tenant with user consent disabled (standard enterprise security posture) cannot use Claude Code's remote MCP transport without one of these workarounds:

  1. Change the tenant's consent policy — flip to "Allow user consent for apps". Works but requires a Global Admin to weaken the tenant-wide policy for all apps, not just this one.
  2. Manually edit the auth URL — strip &prompt=consent from the URL Claude opens in the browser, then paste the modified URL. Per-sign-in manual step; not scalable.
  3. Sign in as a Global Admin — admins see a "Consent on behalf of organization" checkbox. Works for the admin themselves but not for regular users.

Suggested fix

Either:

  • A) Don't send prompt=consent at all — let Entra decide whether to show the prompt based on the existing consent state. If consent hasn't been granted yet, Entra will prompt automatically on first sign-in.
  • B) Send prompt=consent only on the first sign-in for a given server (when no cached tokens exist), not on reconnections or token refreshes.
  • C) Make prompt=consent configurable — e.g. a --no-prompt-consent flag on claude mcp add, or an MCP server config option.

Option A is the simplest and matches the behavior of other OAuth clients (Azure CLI, VS Code, etc.) that work fine with Entra tenants that have user consent disabled.

Environment

  • Claude Code: v2.1.109
  • OS: Ubuntu 22.04 (WSL2)
  • Identity provider: Microsoft Entra ID (Azure AD), single-tenant
  • MCP SDK: ModelContextProtocol.AspNetCore 1.2.0
  • Server: ASP.NET Core .NET 10

References

extent analysis

TL;DR

The most likely fix is to remove the hardcoded prompt=consent parameter from the OAuth authorize request in Claude Code's remote HTTP MCP transport.

Guidance

  • Identify the code responsible for generating the authorize URL in Claude Code and remove the prompt=consent parameter to allow Entra to decide whether to show the consent prompt based on the existing consent state.
  • Consider implementing a configurable option to send prompt=consent only on the first sign-in for a given server or make it a configurable flag.
  • Verify that the fix works by testing the MCP server with a user account in an Entra tenant where user consent is disabled and checking that the consent prompt is not shown after admin consent has been granted.

Example

No code snippet is provided as the issue does not contain enough information about the codebase.

Notes

The suggested fix assumes that removing the prompt=consent parameter will allow Entra to handle the consent flow correctly. However, this may not be the case if there are other issues with the authorization flow.

Recommendation

Apply workaround by removing the hardcoded prompt=consent parameter, as it is the simplest solution and matches the behavior of other OAuth clients that work fine with Entra tenants that have user consent disabled.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - ✅(Solved) Fix Remote MCP OAuth: prompt=consent hardcoded on every authorize request breaks Entra tenants with user-consent disabled [1 pull requests, 1 comments, 2 participants]