What
mcp-observatory cloud login uses device authorization flow (RFC 8628) which requires the user to open a URL and type a code. For desktop users, a direct browser redirect is faster.
Add --browser flag that:
- Starts a local HTTP server on a random port (e.g.
http://localhost:18923/callback)
- Opens the browser to the OIDC authorize URL with
redirect_uri=http://localhost:18923/callback
- Listens for the callback, extracts the authorization code
- Exchanges it for tokens at the token endpoint
Fall back to device flow when --browser isn't used.
Files
src/auth.ts — add performBrowserFlow() function
src/cli.ts — add --browser flag to cloud login
Reference
cloud login already exists in src/cli.ts with device flow
- OIDC discovery + token exchange logic is in
src/auth.ts
- Need a temporary HTTP listener (Node built-in
http module), no new deps
Acceptance
What
mcp-observatory cloud loginuses device authorization flow (RFC 8628) which requires the user to open a URL and type a code. For desktop users, a direct browser redirect is faster.Add
--browserflag that:http://localhost:18923/callback)redirect_uri=http://localhost:18923/callbackFall back to device flow when
--browserisn't used.Files
src/auth.ts— addperformBrowserFlow()functionsrc/cli.ts— add--browserflag tocloud loginReference
cloud loginalready exists insrc/cli.tswith device flowsrc/auth.tshttpmodule), no new depsAcceptance
cloud login --browseropens browser, completes OAuth, saves tokencloud login(no flag) uses device flow as before