Skip to content

Support Custom scopes in Authentication - #200

Merged
AayushTyagi1 merged 7 commits into
mainfrom
support-cognito-for-oauth
Jul 22, 2026
Merged

Support Custom scopes in Authentication#200
AayushTyagi1 merged 7 commits into
mainfrom
support-cognito-for-oauth

Conversation

@AayushTyagi1

Copy link
Copy Markdown
Member

No description provided.

Comment thread src/cb_mcp/auth.py Dismissed
Comment thread src/cb_mcp/auth.py Fixed
Comment thread src/cb_mcp/utils/cli.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CouchbaseJWTVerifier to 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-label with a Click validator that trims values and warns/falls back on invalid input.
  • Expands unit tests to cover verifier subclassing, PRM scopes_supported behavior 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.

Comment thread src/mcp_server.py Outdated
Comment thread src/mcp_server.py Outdated
Comment thread src/mcp_server.py
Comment thread src/cb_mcp/auth.py Outdated
Comment thread src/mcp_server.py Outdated
Comment thread src/cb_mcp/auth.py Dismissed
Comment thread src/cb_mcp/auth.py Dismissed
@AayushTyagi1
AayushTyagi1 requested review from Copilot and nithishr July 20, 2026 10:41
@AayushTyagi1 AayushTyagi1 changed the title Support cognito for oauth Support Custom scopes in Authentication Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread src/cb_mcp/auth.py
Comment thread src/cb_mcp/auth.py
@AayushTyagi1
AayushTyagi1 merged commit f568ce0 into main Jul 22, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants