promptgarten ๐ŸŒฑ

Command reference ยท Cursor CLI

agent login

Authenticates the CLI with your Cursor account through the browser login flow.

agent login starts the browser-based OAuth login flow and links the CLI to the Cursor account; the credentials are then stored securely locally. For automated environments like CI/CD or servers without a browser, there are alternatives: an API key generated via the Cursor dashboard can be set as the CURSOR_API_KEY environment variable or passed directly with the global flag --api-key <key>, which skips the login flow entirely. If a browser can't be opened automatically, NO_OPEN_BROWSER=1 agent login instead just prints the login URL, which can be opened manually. Since early July 2026, during login (or on first start) pressing q additionally displays a QR code for the same URL, to conveniently complete the login from a smartphone, e.g. over an SSH session. Login status can be checked anytime with agent status.

โœ… WHEN TO USE IT?

Initial CLI setup on a new machine

agent login

Logging in over SSH on a remote server without its own browser window

Press q during agent login and scan the displayed QR code with a smartphone

โ›” WHEN NOT TO?

CLI runs headless in CI/CD without an interactive session

agent login requires an interactive browser or QR code flow and blocks without user input.

Better: set CURSOR_API_KEY or pass --api-key <key> to skip the login step

Browser can't be opened automatically on the machine

agent login tries to launch the default browser directly by default.

Better: set NO_OPEN_BROWSER=1 agent login and open the printed URL manually

SOURCES

MORE COMMANDS ยท Cursor CLI

agent logoutagent status | agent whoamiagent aboutagent modelsagent mcpagent sandboxagent workeragent acpagent updateagent lsagent resumeagent create-chat

All commands ยท Cursor CLI โ†’

Share:๐•in๐Ÿ’ฌ