diff --git a/src/fastmcp/client/auth/oauth.py b/src/fastmcp/client/auth/oauth.py index b858cc17d..7984a4299 100644 --- a/src/fastmcp/client/auth/oauth.py +++ b/src/fastmcp/client/auth/oauth.py @@ -80,7 +80,7 @@ class OAuthClientProvider(_MCPOAuthClientProvider): ServerOAuthMetadata instead of the restrictive MCP OAuthMetadata. """ # Extract base URL per MCP spec - auth_base_url = self._get_authorization_base_url(server_url) + auth_base_url = self.context.get_authorization_base_url(server_url) url = urljoin(auth_base_url, "/.well-known/oauth-authorization-server") from mcp.types import LATEST_PROTOCOL_VERSION diff --git a/src/fastmcp/server/auth/auth.py b/src/fastmcp/server/auth/auth.py index 42d2919b8..fcb85c1af 100644 --- a/src/fastmcp/server/auth/auth.py +++ b/src/fastmcp/server/auth/auth.py @@ -43,3 +43,18 @@ class OAuthProvider( self.client_registration_options = client_registration_options self.revocation_options = revocation_options self.required_scopes = required_scopes + + async def verify_token(self, token: str) -> AccessToken | None: + """ + Verify a bearer token and return access info if valid. + + This method implements the TokenVerifier protocol by delegating + to our existing load_access_token method. + + Args: + token: The token string to validate + + Returns: + AccessToken object if valid, None if invalid or expired + """ + return await self.load_access_token(token)