Command reference ยท Cursor CLI
agent login
Authenticates the CLI with your Cursor account through the browser login flow.
agent login opens the browser login flow and links the CLI to your Cursor account. Authentication without a browser is also possible via --api-key (or the CURSOR_API_KEY environment variable) or --auth-token (CURSOR_AUTH_TOKEN). Setting NO_OPEN_BROWSER=1 makes it print the login URL instead of opening a browser automatically, useful on remote servers without a GUI.
โ WHEN TO USE IT?
First-time CLI setup on a new machine
agent login
โ WHEN NOT TO?
The CLI runs headless on a server with no browser access
agent login normally requires an interactive browser flow.
Better: Set auth via --api-key/CURSOR_API_KEY, or export NO_OPEN_BROWSER=1 so only the login URL is printed
SOURCES
- Cursor Docs โ CLI Reference: Parameters โ cursor.com
- Cursor Docs โ Authentication โ cursor.com
- Cursor Docs โ ACP โ cursor.com