Repository navigation
[TW-7622] MCP-only principal-scoped login, credential isolation and OAuth status - #127
Draft
radenkovic wants to merge 1 commit into
Draft
radenkovic wants to merge 1 commit into
radenkovic wants to merge 1 commit into
Conversation
…ation and OAuth status `nylas oauth login --mcp-only` requests the MCP scopes without dashboard.session, so the consent screen can offer an IAM principal. The result is stored as its own credential beside the default session, keyed by server, audience, org, user and principal: the same key replaces (and revokes) that credential, anything else is stored alongside it. A restricted token is never exchanged for a dashboard session, and the exchange refuses any token carrying a principal claim before calling the server. - oauth status lists the default session and every MCP-only credential with access mode, audience, org and principal; no token is printed - oauth token/logout --credential, logout --all; config reset clears all - mcp serve/install --auth oauth --credential <id>; without it serve uses the default session, else the only MCP-only credential - refresh retries 503 temporarily_unavailable after Retry-After with backoff and keeps the stored sign-in (contract section 7) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Jira: TW-7622 (epic TW-7610). Stacked on #125 (TW-7617 device sign-in); retarget to
mainonce that merges.What
nylas oauth login --mcp-only(browser or--device): the--for mcpscopes withoutdashboard.session, so the consent screen can offer an IAM principal. There is no principal flag; the principal is chosen on the consent page.principalclaim before calling the server. A dashboard-capable login whose consent returned a principal is revoked and refused rather than stored as the default session.oauth_mcp_<id>_*), beside the default session and never in place of it. The id is a hash of server, audience, org, user and principal, and a token-free index lists them. The same key replaces that credential and revokes the one it replaces; any other combination is stored alongside, so two principals or regions never overwrite each other.nylas mcp serve --auth oauthuses the default session when present. Otherwise it uses the only MCP-only credential, and with several it requires--credential <id>.mcp install --credentialpins one and preserves it on re-install.oauth statusshows access mode, audience, org and principal for the default session and every MCP-only credential, never a token. Also addsoauth token --credential,oauth logout --credential/--all;config resetclears every credential.temporarily_unavailableafterRetry-After(capped at 30s) with backoff, up to 3 attempts, with the same refresh token, and keeps the stored sign-in (contract §7).Tests
TestCLI_OAuthMCPOnly_FakeServerLogin(device +--mcp-onlyagainst a fake AS: nodashboard.sessionrequested, no exchange call, status andtoken --credential).make fmt vet lint test-unit test-race security buildpasses.make vulnfails on the Go 1.26.5 stdlib pinned ingo.mod, and fails the same way onmain.TestOAuthAS_*skip without one).Notes for review
mcp serveexits with an error rather than choosing one.🤖 Generated with Claude Code