@@ -737,7 +737,6 @@ def sse_app(self, mount_path: str | None = None) -> Starlette:
737
737
738
738
async def handle_sse (request : Request ) -> Response :
739
739
"""Handle SSE connection using Starlette's EventSourceResponse."""
740
- # Create a custom Response class that wraps the SSE connection
741
740
class SSEConnectionResponse (Response ):
742
741
def __init__ (self , sse_transport : SseServerTransport , server : MCPServer ) -> None :
743
742
super ().__init__ ()
@@ -791,7 +790,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
791
790
)
792
791
)
793
792
794
- # Create auth wrapper if needed
793
+ # When auth is configured, require authentication
795
794
if self ._token_verifier :
796
795
# Determine resource metadata URL
797
796
resource_metadata_url = None
@@ -802,7 +801,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
802
801
str (self .settings .auth .resource_server_url ).rstrip ("/" ) + "/.well-known/oauth-protected-resource"
803
802
)
804
803
805
- # # Auth is enabled, wrap the endpoints with RequireAuthMiddleware
804
+ # Auth is enabled, wrap the endpoints with RequireAuthMiddleware
806
805
async def handle_sse_auth (scope : Scope , receive : Receive , send : Send ) -> None :
807
806
request = Request (scope , receive )
808
807
response = await handle_sse (request )
0 commit comments