Repository navigation
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
HugoRCD
force-pushed
the
v1-09-oauth-challenges
branch
from
November 25, 2026 13:51
23a79cb to
3df6edb
Compare
This branch was successfully deployed
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.
Testing the 1.0 OAuth path in a real consumer (nuxt/nuxt.com#2567) turned up three gaps against the MCP 2025-11-25 authorization spec. The
401challenge never named any scopes, so clients fell back to requesting everything. A call refused for a missing scope returned a403with noWWW-Authenticate, so clients could not step up; the official TypeScript SDK client just failed the call. And there was no supported way to accept a static token for a non-interactive caller (an agent, a cron job) next to OAuth tokens:authandoauthcannot coexist, andjwtandverifymust both pass. This PR addsscopeto the401challenge, sends RFC 6750'sinsufficient_scopechallenge when a scoped definition refuses a modern request, and addscreateMcpOAuth({ serviceTokens }).To try it, use the snippet below with the PR build (
npm i https://pkg.pr.new/nitro-mcp-toolkit@421, available once the preview job publishes):Before and after
The same two modern
tools/callrequests to the same handler (scopesSupported: ['todos:read', 'todos:write'], tool scoped totodos:write), first without a token, then with a token holding onlytodos:read. Before is #420's head987571d.The
insufficient_scopechallenge asks for the scopes the token already holds plus the ones the call needs, the spec's recommended approach, so a client does not lose access it had. A denial fromauthorizestays a bare403, since asking for more scopes cannot fix it. Legacy requests are unchanged: they report the same JSON-RPC-32003inside a200stream, which has nowhere to carry a challenge.Service tokens are read on each request, so they can come from private runtime configuration; an empty value matches nothing. They are compared in constant time, skip
jwtandverify, and set fixed claims onevent.context.oauth, soscopesandauthorizestill apply. An entry withoutclaims.subthrows when the OAuth instance is created. The docs recommend OAuth for people, since a service token never expires.Removing the
403challenge or the service-token match each makes one of the new tests intest/oauth-runtime.test.tsfail (checked by hand). The flow has not been run against Claude, Cursor or VS Code with this build; the nuxt.com consumer will switch toserviceTokensonce this preview publishes.ELI5
When an app knocks on an MCP server without the right key, the server now says exactly which permissions to ask for, instead of just saying "no". It also lets a trusted robot use a fixed password while people keep signing in normally.