CLI

Ship code with AI agents right from your terminal.

How do I install the CLI?

On Windows PowerShell:

What can the CLI do?

The CLI brings Cursor's AI capabilities to your terminal. It supports Agent, Plan, and Ask modes, so you can do almost everything you'd do in the editor without opening an IDE.

Learn more at cursor.com/cli.

Can I use the CLI for automation?

Yes. Use headless mode for scripts, CI pipelines, and GitHub Actions. Automate doc updates, trigger security reviews, or build custom coding workflows. See the Headless CLI docs for setup.

Does the CLI work with other editors?

Yes. Cursor CLI works with any IDE or editor, not just Cursor. Plug it into your existing workflow anywhere you have a terminal.

How do I authenticate the CLI?

Run agent auth or set the CURSOR_API_KEY environment variable. See the CLI authentication docs for details.

What if the CLI reports "invalid API key" on a network error?

If DNS resolution fails or the CLI can't reach Cursor's servers, the error message may say "invalid API key" instead of a network error. Check your network connection first. If you're behind a VPN or firewall, verify that *.cursor.sh and *.cursorapi.com are accessible.

How do I update the CLI?

Run:

To switch release channels (e.g., from stable to lab), run:

Related

  • CLI overview
  • CLI installation
  • CLI authentication
  • GitHub Actions
  • cursor.com/cli
Was this page helpful?