Skip to content

Commit 011fd07

Browse files
committed
require consent in example
1 parent 2a8e67b commit 011fd07

File tree

1 file changed

+5
-2
lines changed
  • examples/servers/simple-auth/mcp_simple_auth

1 file changed

+5
-2
lines changed

examples/servers/simple-auth/mcp_simple_auth/server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ async def get_client(self, client_id: str) -> OAuthClientInformationFull | None:
8383
async def register_client(self, client_info: OAuthClientInformationFull):
8484
"""Register a new OAuth client."""
8585
self.clients[client_info.client_id] = client_info
86-
86+
8787
async def has_client_consent(self, client: OAuthClientInformationFull) -> bool:
8888
"""Check if a client has already provided consent."""
8989
return self.client_consent.get(client.client_id, False)
90-
90+
9191
async def grant_client_consent(self, client: OAuthClientInformationFull) -> None:
9292
"""Grant consent for a client."""
9393
self.client_consent[client.client_id] = True
@@ -275,6 +275,9 @@ def create_simple_mcp_server(settings: ServerSettings) -> FastMCP:
275275
enabled=True,
276276
valid_scopes=[settings.mcp_scope],
277277
default_scopes=[settings.mcp_scope],
278+
# Because we're redirecting to a different AS during our
279+
# main auth flow.
280+
client_consent_required=True
278281
),
279282
required_scopes=[settings.mcp_scope],
280283
)

0 commit comments

Comments
 (0)