Repository navigation
feat(host): send a resource's scopes in the bearer challenge - #11
Merged
Merged
Conversation
buildBearerChallenge takes an optional `scopes` list and sends it as RFC 6750's `scope` attribute, space-separated, after `resource_metadata`. An empty list leaves the attribute out. The MCP authorization spec has clients take the scopes to request from the 401's `scope` first, and fall back to the protected-resource metadata's `scopes_supported` only when it is missing. A host that sends nothing leaves a client that misses the resource's metadata guessing, and on a host serving several resources it can request another resource's scopes and be refused by the authorization server with `invalid_scope`.
doistbot
reviewed
Nov 12, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
This PR updates feat(host): send a resource's scopes in the bearer challenge. No issues were flagged in the reviewed diff.
|
🎉 This PR is included in version 1.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Short description
buildBearerChallengetakes an optionalscopeslist and adds it to the challenge as RFC 6750'sscopeattribute, space-separated, afterresource_metadata:The MCP authorization spec tells servers they SHOULD send
scopeon the 401. Clients then use it first when choosing which scopes to request, and fall back to the protected-resource metadata'sscopes_supportedonly when it's missing. Today a host can't send it, so a client that never finds the resource's own metadata has to guess. On a host that serves several resources, it can end up requesting a different resource's scopes, and the authorization server then refuses it withinvalid_scope.src/host/challenge.ts: new optionalscopes?: readonly string[]onBearerChallengeOptions. An empty list leaves the attribute out, and the existing output doesn't change.scopeon its own, withresource_metadata, witherror="insufficient_scope", and with an empty list.scope, and the host example passesscopes.The change is additive (
feat:), so it releases as 1.1.0. todoist-ai-integrations will bump to it and pass each MCP resource's scopes.