feat: add OAuth credential support to add identity and outbound auth CLI flags#416
Merged
aidandaly24 merged 4 commits intoaws:feat/gateway-integrationfrom Feb 24, 2026
Conversation
…CLI flags Extend createCredential to support OAuth credentials alongside API keys: - CreateCredentialConfig is now a discriminated union (ApiKey vs OAuth) - OAuth writes CLIENT_ID and CLIENT_SECRET to .env.local - OAuth writes OAuthCredentialProvider config to agentcore.json Add CLI flags for non-interactive workflows: - add identity: --type oauth, --discovery-url, --client-id, --client-secret, --scopes - add gateway-target: --outbound-auth, --credential-name, --oauth-client-id, --oauth-client-secret, --oauth-discovery-url, --oauth-scopes - Inline OAuth credential creation when --oauth-* fields provided without --credential-name Adds 15 new tests covering OAuth credential creation, validation, and edge cases.
87cb33b to
d486ba0
Compare
tejaskash
requested changes
Feb 24, 2026
3382eda
into
aws:feat/gateway-integration
14 of 16 checks passed
aidandaly24
added a commit
to aidandaly24/agentcore-cli
that referenced
this pull request
Feb 24, 2026
Fix ESLint prefer-nullish-coalescing errors from merged aws#416.
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.
Description
Users need to configure outbound authentication when connecting gateway targets to external MCP servers that require credentials. Previously, the only way to create credentials was API keys through
add identity, and there was no way to specify outbound auth when creating gateway targets via CLI flags.This PR adds two things:
OAuth credential support in
add identity.createCredentialnow handles both API keys and OAuth credentials. For OAuth, it writes theOAuthCredentialProviderconfig to agentcore.json and storesCLIENT_ID/CLIENT_SECRETin .env.local. Users can now run:Outbound auth CLI flags on
add gateway-target. Users can reference an existing credential or create one inline:Validation rejects conflicting configurations (e.g.
--outbound-auth api-keywith inline OAuth fields) and ensures all required fields are present for each auth type.This is the operations + CLI layer only. The interactive TUI wizard for outbound auth selection is a follow-up PR.
Related Issue
Part of the MCP Gateway Phase 1 integration (gateway-integration branch). Task 12a.
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshots15 new tests covering:
Checklist