GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): stop forcing a consent prompt on MCP OAuth login by rekram1-node · Pull Request #50519 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Sep 22, 2026

Copy link
Copy Markdown
Member

Issue for this PR

Closes #46361

Type of change

  • Bug fix

What does this PR do?

@modelcontextprotocol/client does two things on every authorization request:

  1. If the authorization server advertises offline_access in scopes_supported, it appends offline_access to the requested scope (SEP-2207).
  2. If the scope now contains offline_access, it appends prompt=consent to the authorization URL.

Step 2 forces the identity provider to show the consent screen on every login, even when consent is already on file. Identity providers that let an administrator grant consent for the whole tenant and disable per-user consent (Microsoft Entra ID with /.default scopes is the reported case) cannot honor a forced prompt from a user who is not allowed to consent, so they return an "Approval required" page and login never completes. The reporter confirmed that removing only prompt=consent from the URL lets the flow finish with both an access token and a refresh token.

OpenID Connect Core section 11 requires prompt=consent for offline_access only "unless other conditions for processing the request permitting offline access to the requested resources are in place". A tenant-wide administrator grant is exactly such a condition, so the unconditional prompt is stricter than the spec asks for.

This extends the existing patch for @modelcontextprotocol/[email protected] to drop the appended prompt in both dist/index.mjs and dist/index.cjs. Step 1 is unchanged: offline_access is still requested. The authorization server decides whether to show a consent screen and whether to issue a refresh token, the same way it does for every other scope.

Impact on existing servers

Only servers whose authorization server advertises offline_access see any difference at all, because the prompt was only ever added in that case. I probed the metadata of 33 remote MCP servers:

  • 30 do not advertise offline_access (Sentry, PostHog, Linear, Notion, Atlassian, Cloudflare, Supabase, Neon, Slack, Dropbox, Figma, HubSpot, Intercom, Asana, Zapier, Box, Postman, Canva, Square, Webflow, PayPal, Hugging Face, Jam, Prisma, and others). Nothing changes for them; their authorization URL was never given prompt=consent.
  • 3 advertise it: GitHub, Vercel, Netlify.
    • GitHub's docs: requesting offline_access returns a refresh token, and "will not cause additional prompts to appear if used"; users who already authorized the app skip the authorization page.
    • Vercel's docs: refresh token is "present if offline_access scope is requested"; "users only see the consent page the first time they authorize your app", and prompt=consent exists specifically to force it again.
    • Netlify runs a custom authorization server with refresh_token in grant_types_supported; the change removes the forced re-consent, refresh token issuance follows the scope.

In all three, offline_access alone is what drives refresh-token issuance. The forced prompt only made returning users click through the consent screen again on each login.

How did you verify your code works?

  • New test in packages/core/test/mcp-oauth.test.ts: authorization server advertises offline_access; asserts the authorization URL scope is read offline_access and carries no prompt parameter. With the upstream line restored, the test fails with Expected: false, Received: true.
  • bun test test/mcp-oauth.test.ts in packages/core: 19/19.
  • Fresh bun install --frozen-lockfile applies the patch cleanly; both hunks (the existing url.search removal and the new one) are in effect in the installed dist.
  • bun typecheck in packages/core: 0 errors. Prettier clean.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
fix(core): stop forcing a consent prompt on MCP OAuth login
90f3e49
The MCP client SDK appends prompt=consent to every authorization
request whose scope includes offline_access, and it adds offline_access
itself whenever the authorization server advertises it. That forces the
consent screen on every login even when consent is already on file.

Identity providers that let an administrator grant consent for the
whole tenant and disable per-user consent reject the forced prompt with
an approval-required page, so login never completes. OpenID Connect
Core 11 requires prompt=consent only when no other condition already
permits offline access, so the unconditional prompt is not required.

Patch the appended prompt out. offline_access is still requested; the
authorization server decides whether a consent screen is needed and
whether to issue a refresh token, as it does for every other scope.

Closes #46361
@rekram1-node
rekram1-node merged commit 19e1357 into v2 Sep 22, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the mcp-oauth-consent branch September 22, 2026 05:25
@rekram1-node rekram1-node mentioned this pull request Sep 22, 2026
MCP OAuth client hardcodes prompt=consent, bypassing tenant-wide admin consent (Microsoft Entra) #46361
Closed
This was referenced Oct 28, 2026
mcp: OAuth authorization never requests offline access, so Google issues no refresh token #59820
Open
fix(mcp): request offline access so OAuth servers issue refresh tokens #59821
Open
@rekram1-node rekram1-node mentioned this pull request Nov 9, 2026
chore(core): update MCP SDK to 2.4.0 #62982
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.