fix(mcp): handle provider OAuth interoperability gaps - #2853
Merged
reachjalil merged 2 commits intoJul 16, 2026
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
|
@reachjalil is attempting to deploy a commit to the Different AI Team on Vercel. A member of the Team first needs to authorize it. |
reachjalil
force-pushed
the
feature/mcp-provider-oauth-fixes
branch
from
July 16, 2026 19:16
2f190c3 to
8a42366
Compare
reachjalil
marked this pull request as ready for review
July 16, 2026 21:13
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this fixes
This is a focused follow-up to #2810 for OAuth interoperability gaps found against live remote MCP providers. The implementation is provider-neutral and applies to Den-managed OpenWork Connect.
Resource discovery aliases
Some protected-resource metadata identifies a resource as an origin with a trailing
/, while advertising the same origin without/as its OAuth discovery alias. OpenWork previously rejected that constrained equivalence and then incorrectly fell back to asking for a pre-registered client ID and secret.This PR accepts only HTTP(S) root-origin equivalence for a resource-scoped discovery alias. The authorization-server metadata issuer remains canonical, and authorization-response issuer validation remains exact.
For
https://mcp.vercel.com, discovery now resolves the advertised dynamic-registration flow without asking the administrator for a client ID or secret.Deferred OAuth challenges
Some MCP servers allow unauthenticated
initializeand challenge only ontools/list. OpenWork previously treated initialize alone as a usable connection, closed the authorization window, and left the connection without credentials.This PR requests one bounded tool page before returning
connected, both during initial connection and after the OAuth callback. A late challenge now starts the normal OAuth flow. If token exchange succeeds but initialize or tool discovery then fails, the newly exchanged credential is invalidated through the existing cleanup path.For
https://api.descript.com/v2/mcp, this means the OAuth challenge raised at tool discovery is no longer missed.Connection handoff screen
The shared OAuth popup immediately renders a small OpenWork-styled Preparing your connection screen while Den performs discovery. It provides an accessible live status, subtle animation, and a reduced-motion fallback before the same window navigates to the provider.
Callback compatibility and rollout
Relationship to #2851
Visual walkthrough
Add the Vercel MCP server
Entering
https://mcp.vercel.comcompletes OAuth discovery automatically. The form shows provider-advertised permissions and does not ask for a client ID or secret.Start the OAuth handoff
Clicking Connect opens this lightweight status screen immediately, then navigates the same popup to the provider.
Security boundaries
tools/listrequest because tool access is the capability OpenWork exposes and where compliant servers may issue the OAuth challenge.Validation
Branch head:
8a42366c, rebased onto currentupstream/devat55033420.@openwork/enterprise-mcp-client: typecheck passed.@openwork/enterprise-mcp-client: build passed.@openwork/enterprise-mcp-client: 40 passed, including post-callback rollback when initialize succeeds but tool discovery fails.git diff --checkpassedhttps://mcp.vercel.com: ready; issuerhttps://vercel.com; dynamic registration; no warnings.https://api.descript.com/v2/mcp: ready; issuerhttps://api.descript.com; client-metadata registration; no warnings.Not run / external limits
Review map
packages/enterprise-mcp-client/src/enterprise-mcp-client.tspackages/enterprise-mcp-client/src/oauth-resource-alias.tspackages/enterprise-mcp-client/src/requirements-discovery.tsandoauth-discovery-binding.tsee/apps/den-api/src/routes/org/mcp-connections.tsee/apps/den-web/app/(den)/dashboard/_components/mcp-authorization-url.ts