@@ -593,16 +593,20 @@ async def test_auth_flow_with_valid_tokens(self, oauth_provider, mock_storage, v
593593 "revocation_endpoint" ,
594594 ),
595595 (
596- # TODO(Marcelo): Since we are using `AnyUrl`, the trailing slash is always added.
597- # pytest.param(
598- # "https://auth.example.com",
599- # "https://auth.example.com/docs",
600- # "https://auth.example.com/authorize",
601- # "https://auth.example.com/token",
602- # "https://auth.example.com/register",
603- # "https://auth.example.com/revoke",
604- # id="simple-url",
605- # ),
596+ # Pydantic's AnyUrl incorrectly adds trailing slash to base URLs
597+ # This is being fixed in https://github.com/pydantic/pydantic-core/pull/1719 (Pydantic 2.12+)
598+ pytest .param (
599+ "https://auth.example.com" ,
600+ "https://auth.example.com/docs" ,
601+ "https://auth.example.com/authorize" ,
602+ "https://auth.example.com/token" ,
603+ "https://auth.example.com/register" ,
604+ "https://auth.example.com/revoke" ,
605+ id = "simple-url" ,
606+ marks = pytest .mark .xfail (
607+ reason = "Pydantic AnyUrl adds trailing slash to base URLs - fixed in Pydantic 2.12+"
608+ ),
609+ ),
606610 pytest .param (
607611 "https://auth.example.com/" ,
608612 "https://auth.example.com/docs" ,
@@ -631,7 +635,8 @@ def test_build_metadata(
631635 registration_endpoint : str ,
632636 revocation_endpoint : str ,
633637):
634- from mcp .server .auth import ClientRegistrationOptions , RevocationOptions , build_metadata
638+ from mcp .server .auth .routes import build_metadata
639+ from mcp .server .auth .settings import ClientRegistrationOptions , RevocationOptions
635640
636641 metadata = build_metadata (
637642 issuer_url = AnyHttpUrl (issuer_url ),
0 commit comments