René's URL Explorer Experiment


Title: [v1.x] fix(auth): coerce empty-string optional URL fields to None in OAuthClientMetadata by felixweinberger · Pull Request #2405 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: [v1.x] fix(auth): coerce empty-string optional URL fields to None in OAuthClientMetadata by felixweinberger · Pull Request #2405 · modelcontextprotocol/python-sdk

X Title: [v1.x] fix(auth): coerce empty-string optional URL fields to None in OAuthClientMetadata by felixweinberger · Pull Request #2405 · modelcontextprotocol/python-sdk

Description: Coerce "" to None for the five OPTIONAL URL fields on OAuthClientMetadata so that DCR responses from servers that echo omitted metadata as empty strings parse successfully. v1.x backport of the same change targeting main (#2404). Motivation and Context RFC 7591 §2 marks client_uri, logo_uri, tos_uri, policy_uri, and jwks_uri as OPTIONAL. Some authorization servers in the wild (observed: Udemy, deepsense.ai, Apify, windsor.ai, firecrawl, and others) echo the client's omitted metadata back as "" instead of dropping the keys: {"client_id": "abc123", "client_uri": "", "logo_uri": "", "tos_uri": "", "policy_uri": "", ...} AnyHttpUrl rejects "", so handle_registration_response raises ValidationError and callers discard an otherwise valid registration — the server returned 201 with a real client_id. The servers are technically non-compliant (an empty string is not a valid URL), but the only reasonable interpretation of "" for an OPTIONAL field is "absent". This applies Postel's law at the deserialization boundary, matching the existing normalize_token_type validator on OAuthToken in the same file. Because OAuthClientInformationFull inherits from OAuthClientMetadata, the coercion applies to parsed DCR responses as well. How Has This Been Tested? New TestOAuthClientMetadataEmptyUrlCoercion covers per-field coercion (parametrized over all five fields), all-fields-together, valid-URL passthrough, inheritance through OAuthClientInformationFull (the DCR-response model), and a negative case confirming non-empty invalid URLs still raise. Breaking Changes None. This only widens accepted input — previously-rejected "" values now succeed as None. Valid URLs, None, and omitted keys are unchanged. Types of changes Bug fix (non-breaking change which fixes an issue) New feature (non-breaking change which adds functionality) Breaking change (fix or feature that would cause existing functionality to change) Documentation update Checklist I have read the MCP Documentation My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed Additional context RFC 7591 §2: https://datatracker.ietf.org/doc/html/rfc7591#section-2

Open Graph Description: Coerce "" to None for the five OPTIONAL URL fields on OAuthClientMetadata so that DCR responses from servers that echo omitted metadata as empty strings parse successfully. v1.x backport ...

X Description: Coerce "" to None for the five OPTIONAL URL fields on OAuthClientMetadata so that DCR responses from servers that echo omitted metadata as empty strings parse successfully. v1.x b...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2405

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:6ae24d22-560b-77ed-2728-79c06dcfcec2
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEB54:4EA58:847982:BCF981:6A5F296D
html-safe-nonce0400b0601e94dd5ca7b4e3b5e5e621b8cc2d4a12f17b950c870a6e637977936f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjU0OjRFQTU4Ojg0Nzk4MjpCQ0Y5ODE6NkE1RjI5NkQiLCJ2aXNpdG9yX2lkIjoiODM3ODQ5NzQ2NDA4NjI0MzY5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc68190955d9fb91f9e42a9b4c0f82e117121766e950fddec46b25b542588803f
hovercard-subject-tagpull_request:3504296149
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/2405/files
twitter:imagehttps://avatars.githubusercontent.com/u/3823880?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3823880?s=400&v=4
og:image:altCoerce "" to None for the five OPTIONAL URL fields on OAuthClientMetadata so that DCR responses from servers that echo omitted metadata as empty strings parse successfully. v1.x backport ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneaf57322612a2efc3d6fee860947245ffbb465e4e3f9eb5dfefc0f770217aa0ca
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release93fabb5edc1b64676979fa226fed14ab56431f54
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2405%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2405%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
modelcontextprotocol https://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Notifications https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Fork 3.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Star 23.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://github.com/modelcontextprotocol/python-sdk
Issues 264 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 310 https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality 6 https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Code https://github.com/modelcontextprotocol/python-sdk
Issues https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
felixweinbergerhttps://github.com/felixweinberger
v1.xhttps://github.com/modelcontextprotocol/python-sdk/tree/v1.x
fweinberger/dcr-empty-url-coerce-v1xhttps://github.com/modelcontextprotocol/python-sdk/tree/fweinberger/dcr-empty-url-coerce-v1x
Conversation 5 https://github.com/modelcontextprotocol/python-sdk/pull/2405
Commits 3 https://github.com/modelcontextprotocol/python-sdk/pull/2405/commits
Checks 22 https://github.com/modelcontextprotocol/python-sdk/pull/2405/checks
Files changed 2 https://github.com/modelcontextprotocol/python-sdk/pull/2405/files
[v1.x] fix(auth): coerce empty-string optional URL fields to None in OAuthClientMetadata https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#top
Show all changes 3 commits https://github.com/modelcontextprotocol/python-sdk/pull/2405/files
658c5b9 fix(auth): coerce empty-string optional URL fields to None in OAuthCl… felixweinberger Apr 8, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2405/commits/658c5b97aafd009c649e96e49e793c72c88da586
aabed62 test: move OAuthClientMetadata empty-URL tests to tests/shared, drop … felixweinberger Apr 13, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2405/commits/aabed623b2106a73d802c8d195626ac14ca472b3
5d8927d Merge branch 'v1.x' into fweinberger/dcr-empty-url-coerce-v1x felixweinberger Apr 13, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2405/commits/5d8927dfcf90a10c20e2be1722ba76726ecc6e17
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/2405/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
auth.py https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-01350058961f3196e3373d707e2178962377dc9a85f481ade94e8f05e4701c8d
test_auth.py https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-5ddab42b5e747af834ca9c9c4523711195c3cba445840bf6d89302b346bf7097
src/mcp/shared/auth.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-01350058961f3196e3373d707e2178962377dc9a85f481ade94e8f05e4701c8d
View file https://github.com/modelcontextprotocol/python-sdk/blob/5d8927dfcf90a10c20e2be1722ba76726ecc6e17/src/mcp/shared/auth.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2405/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-01350058961f3196e3373d707e2178962377dc9a85f481ade94e8f05e4701c8d
claudehttps://github.com/apps/claude
Apr 8, 2026https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#r3052856209
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-01350058961f3196e3373d707e2178962377dc9a85f481ade94e8f05e4701c8d
tests/shared/test_auth.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-5ddab42b5e747af834ca9c9c4523711195c3cba445840bf6d89302b346bf7097
View file https://github.com/modelcontextprotocol/python-sdk/blob/5d8927dfcf90a10c20e2be1722ba76726ecc6e17/tests/shared/test_auth.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2405/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-5ddab42b5e747af834ca9c9c4523711195c3cba445840bf6d89302b346bf7097
https://github.com/modelcontextprotocol/python-sdk/pull/2405/files#diff-5ddab42b5e747af834ca9c9c4523711195c3cba445840bf6d89302b346bf7097
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2405/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.