From 1e138f73db695d5a1f897d2bb3ae1b9ee43afb47 Mon Sep 17 00:00:00 2001 From: David Basoko Date: Thu, 12 Jun 2025 16:00:07 +0200 Subject: [PATCH] Fix simple-auth server example AuthorizationCode.redirect_uri type The AuthorizationCode.redirect_uri field type is AnyUrl, but the example used AnyHttpUrl type. This mismatch causes the redirect URI check in TokenHandler to fail, since it compares against AuthorizationCodeRequest.redirect_uri, which also expects AnyUrl. --- examples/servers/simple-auth/mcp_simple_auth/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/servers/simple-auth/mcp_simple_auth/server.py b/examples/servers/simple-auth/mcp_simple_auth/server.py index 6e16f8b9d3..68f5a90e86 100644 --- a/examples/servers/simple-auth/mcp_simple_auth/server.py +++ b/examples/servers/simple-auth/mcp_simple_auth/server.py @@ -6,7 +6,7 @@ from typing import Any, Literal import click -from pydantic import AnyHttpUrl +from pydantic import AnyHttpUrl, AnyUrl from pydantic_settings import BaseSettings, SettingsConfigDict from starlette.exceptions import HTTPException from starlette.requests import Request @@ -144,7 +144,7 @@ async def handle_github_callback(self, code: str, state: str) -> str: auth_code = AuthorizationCode( code=new_code, client_id=client_id, - redirect_uri=AnyHttpUrl(redirect_uri), + redirect_uri=AnyUrl(redirect_uri), redirect_uri_provided_explicitly=redirect_uri_provided_explicitly, expires_at=time.time() + 300, scopes=[self.settings.mcp_scope],