fix(auth): accept empty optional OAuth client metadata URLs#2076
fix(auth): accept empty optional OAuth client metadata URLs#2076mrutunjay-kinagi wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
|
Follow-up pushed in e9a78ec to fix the pre-commit failure by validating the empty-URI fixture via (runtime path) instead of passing empty strings directly to typed constructor params. |
|
Follow-up pushed in Change made:
|
|
All checks are now passing on the latest commit ( Ready for maintainer review when you have bandwidth. Thanks! |
|
Where in the RFC it says that empty is not valid? |
|
Good question. The RFC language we based this on is RFC 7591 §2 for these fields (
Examples from §2:
So this change is not treating |
|
Link please. |
|
Absolutely — here are the direct references:
In that section, for these optional fields ( |
|
I don't think this needs any fixing. The client side sending empty string in a field is the wrong behavior. |
Summary
OAuthClientMetadatatoNonebefore URL validationclient_uri/logo_uri/tos_uri/policy_uri/jwks_uriinputsWhy
Fixes validation failures when auth servers emit empty strings for optional client metadata URL fields.
Closes #1665
Validation
pytest -q tests/client/test_auth.py -k "empty_optional_uris"ruff check src/mcp/shared/auth.py tests/client/test_auth.pyruff format --check src/mcp/shared/auth.py tests/client/test_auth.py