pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/modelcontextprotocol/python-sdk/pull/2368

78641c0a1f3e0.css" /> fix: handle None required_scopes in validate_scope by IgnazioDS · Pull Request #2368 · modelcontextprotocol/python-sdk · GitHub
Skip to content

fix: handle None required_scopes in validate_scope#2368

Open
IgnazioDS wants to merge 1 commit intomodelcontextprotocol:mainfrom
IgnazioDS:fix/validate-scope-none-handling
Open

fix: handle None required_scopes in validate_scope#2368
IgnazioDS wants to merge 1 commit intomodelcontextprotocol:mainfrom
IgnazioDS:fix/validate-scope-none-handling

Conversation

@IgnazioDS
Copy link
Copy Markdown

Summary

  • Add early return in validate_scope() when self.scope is None
  • None means "no scope restrictions" per the OAuth spec, so all client-requested scopes should be accepted
  • Previously, None was treated as an empty allowed set, rejecting all scopes with InvalidScopeError

Problem

When an MCP server does not specify required scopes (None), clients cannot authenticate because all requested scopes are rejected. See #2216.

Test plan

  • Verify validate_scope("read write admin") accepts all scopes when scope=None
  • Verify validate_scope("read write") still rejects unauthorized scopes when scope="read"
  • Verify validate_scope(None) returns None
  • Verify validate_scope("read write") accepts when scope="read write"

Fixes #2216

When required_scopes is None (meaning no restrictions), skip
validation entirely instead of treating it as an empty set of
allowed scopes which rejects all client-requested scopes.

Github-Issue: modelcontextprotocol#2216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: validate_scope rejects client scopes when required scopes in None

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy