Skip to content

Fixes #123: allow usage of default_scope to be passed #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fastapi_mcp/auth/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@
if not scope:
logger.warning("Client didn't provide any scopes! Using default scopes.")
scope = default_scope
logger.debug(f"Default scope: {scope}")

Check warning on line 202 in fastapi_mcp/auth/proxy.py

View check run for this annotation

Codecov / codecov/patch

fastapi_mcp/auth/proxy.py#L202

Added line #L202 was not covered by tests

scopes = scope.split()
logger.debug(f"Scopes passed: {scopes}")

Check warning on line 205 in fastapi_mcp/auth/proxy.py

View check run for this annotation

Codecov / codecov/patch

fastapi_mcp/auth/proxy.py#L205

Added line #L205 was not covered by tests
for required_scope in default_scope.split():
if required_scope not in scopes:
scopes.append(required_scope)
Expand Down
1 change: 1 addition & 0 deletions fastapi_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def _setup_auth_2025_03_26(self):
client_id=self._auth_config.client_id,
authorize_url=self._auth_config.authorize_url,
audience=self._auth_config.audience,
default_scope=self._auth_config.default_scope,
)
if self._auth_config.setup_fake_dynamic_registration:
assert self._auth_config.client_secret is not None
Expand Down