Fix: Handle empty strings in OAuth registration response (#19144)

- The mcp package requires optional unset values to be None. If an empty string is passed, it gets validated and fails.
- Replace all empty strings with None.
This commit is contained in:
xqqp
2025-11-12 22:57:53 -05:00
committed by GitHub
parent ad17d35ac4
commit 3207998114
+4
View File
@@ -330,6 +330,10 @@ async def get_oauth_client_info_with_dynamic_client_registration(
registration_response_json = (
await oauth_client_registration_response.json()
)
# The mcp package requires optional unset values to be None. If an empty string is passed, it gets validated and fails.
# This replaces all empty strings with None.
registration_response_json = {k: (None if v == "" else v) for k, v in registration_response_json.items()}
oauth_client_info = OAuthClientInformationFull.model_validate(
{
**registration_response_json,