Skip to content

fix: normalize oauth redirect uri url types#2701

Open
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/oauth-redirect-uri-url-subtypes
Open

fix: normalize oauth redirect uri url types#2701
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/oauth-redirect-uri-url-subtypes

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • normalize OAuth redirect URI URL objects at the client metadata model boundary
  • keep validation and serialization unchanged while allowing AnyUrl/AnyHttpUrl subtype round-trips to compare correctly
  • add a shared auth regression test for an AnyHttpUrl registration URI checked against an incoming AnyUrl

Fixes #2687

To verify

  • uv run pytest tests/shared/test_auth.py -q
  • uv run ruff check src/mcp/shared/auth.py tests/shared/test_auth.py
  • uv run ruff format --check src/mcp/shared/auth.py tests/shared/test_auth.py
  • uv run pyright src/mcp/shared/auth.py tests/shared/test_auth.py
  • git diff --check

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.

OAuthClientInformationFull.redirect_uris: pydantic strict-type-equality breaks AnyUrl(x) != AnyHttpUrl(x) round-trip

1 participant