modelcontextprotocol / modelcontextprotocol/python-sdk

Bug: validate_scope rejects client scopes when required scopes in None

Open Beginner friendly
#2,216 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auth bug P2 ready for work
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 1h
Merged PRs (30d)
31

Description

Initial Checks
Description

The validate_scope() function in the Python SDK incorrectly handles cases where there are no required scopes from the client. Instead of treating None as no restrictions, it interprets it as an empty list of allowed scopes. This causes scopes in the token to be rejected with InvalidScopeError, even if the client should be allowed to request them.

Example Code

Python & MCP Python SDK
1.26.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate validate_scope in the Python SDK and trace how required scopes are handled when the value is None. Reproduce the case with client scopes absent and token scopes present, then verify that valid scopes are no longer rejected with InvalidScopeError and add coverage for the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, authorization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.