Support Custom scopes in Authentication - #200
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Cognito-friendly OAuth scope handling by letting the server (a) normalize common IdP scope variants to the canonical SCOPE_READ/SCOPE_WRITE and (b) let operators override the exact scope strings their IdP issues, while keeping downstream per-tool enforcement based on the canonical scopes.
Changes:
- Introduces
CouchbaseJWTVerifierto normalize IdP-specific scope strings (slash/dash forms + operator-provided aliases) to canonical scopes. - Adds CLI/env options
--oauth-scope-read-label/--oauth-scope-write-labelwith a Click validator that trims values and warns/falls back on invalid input. - Expands unit tests to cover verifier subclassing, PRM
scopes_supportedbehavior under overrides, and scope-label validation/warnings.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_log_cli_validators.py | Adds tests for the new validate_scope_label Click callback (trim, warn+fallback behavior). |
| tests/unit/test_auth.py | Adds tests for CouchbaseJWTVerifier normalization and for custom scope label advertisement/normalization behavior. |
| src/mcp_server.py | Adds new CLI options for custom scope labels and threads them into OAuth resolution/building. |
| src/cb_mcp/utils/cli.py | Implements validate_scope_label with warning + fallback semantics. |
| src/cb_mcp/utils/init.py | Exposes validate_scope_label via package imports/__all__. |
| src/cb_mcp/auth.py | Adds CouchbaseJWTVerifier and extends build_oauth to support operator-defined scope labels + PRM scope advertisement. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nithishr
reviewed
Jul 16, 2026
nithishr
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.