π The fast, Pythonic way to build MCP servers and clients.
Protected resource advertises valid scopes, if available (#1742)
Daniel Mikusa7fbe3ee39bce
diff --git a/src/fastmcp/server/auth/auth.py b/src/fastmcp/server/auth/auth.pyindex 4a254721d..760c94d69 100644--- a/src/fastmcp/server/auth/auth.py+++ b/src/fastmcp/server/auth/auth.py@@ -353,10 +353,16 @@ class OAuthProvider(# Add protected resource routes if this server is also acting as a resource serverif resource_url:+ supported_scopes = (+ self.client_registration_options.valid_scopes+ if self.client_registration_options+ and self.client_registration_options.valid_scopes+ else self.required_scopes+ )protected_routes = create_protected_resource_routes(resource_url=resource_url,authorization_servers=[self.issuer_url],- scopes_supported=self.required_scopes,+ scopes_supported=supported_scopes,)oauth_routes.extend(protected_routes)