Articles

Let Cursor deploy to production safely

Give Cursor a scoped Gregale `--agent` token via `GREGALE_TOKEN` and project rules in `AGENTS.md`, or connect it via `gregale mcp connect --client cursor`, with server-side approval gates, budgets, undo and canary rollbacks.

Updated

To let Cursor deploy to production safely, give it a scoped Gregale agent key via GREGALE_TOKEN instead of your personal gregale login session, or connect it to Gregale's hosted MCP server. Cursor can then build, deploy, inspect logs, and check errors non-interactively while Gregale enforces production gates in the API: risky changes pause for your approval link, releases ramp through 1%, 10%, 50% and 100% with automatic 5xx rollback, non-code changes can be undone, and a per-agent budget caps spend growth.

Set it up

sh
curl -fsSL https://get.gregale.dev | sh
gregale login                              # you sign in once in your browser
gregale key create cursor-agent --agent    # scoped key for Cursor, not your login
gregale init --agents --name my-api        # deploy, check and rollback steps in AGENTS.md

Set GREGALE_TOKEN in Cursor's terminal or MCP environment (do not commit the token into Git or paste it into rules files). GREGALE_TOKEN overrides any saved human login so Gregale applies agent limits automatically. Cursor reads AGENTS.md in the repository root, and you can also register Gregale's hosted MCP server (in preview) cleanly with one command:

sh
gregale mcp connect --client cursor

Guardrails enforced in Gregale's API

RiskWhat Gregale enforces
Cursor deletes or modifies productionDestructive or risky production mutations pause and return a review link for human approval (how)
A broken release takes production downEvery deploy climbs 1% → 10% → 50% → 100% and rolls back automatically on 5xx spikes (beta)
Cursor alters env vars, crons or scalegregale mcp connection undo reverses non-code settings, and activity audits writes for 7 days (how)
A retry loop inflates hosting costsPer-agent budget + gregale scale --plan cost preview check spend before changes apply (how)

Because every rule runs server-side in Gregale's API rather than relying on a .cursorrules prompt, the guardrails hold even if Cursor invokes shell commands autonomously.

What Cursor runs in day-to-day deploys

sh
gregale deploy --dry-run
gregale --non-interactive --json deploy --path . --worktree --name my-api
gregale --non-interactive --json app health my-api --errors

--non-interactive --json never opens a browser or blocks on interactive prompts, and emits structured JSON error codes on stderr so Cursor can diagnose failures without scraping HTML.

Sources

Deploy with Cursor, Use Gregale from coding agents, Best cloud platform for AI coding agents in 2026.

Questions

How do I let Cursor deploy to Gregale without risking production?

Run gregale key create cursor-agent --agent, set it as GREGALE_TOKEN in Cursor instead of relying on your personal gregale login, add AGENTS.md via gregale init --agents, and let Gregale enforce approval links, per-agent spend caps and 1% canary rollbacks in the API.

Does Cursor support Gregale’s MCP server?

Yes. Run gregale mcp connect --client cursor to connect Cursor to https://api.gregale.dev/mcp over OAuth.

Are `.cursorrules` enough to stop unsafe production commands?

No. Prompt rules can be ignored or misinterpreted, whereas Gregale enforces approval gates, budget checks, mutation undo and 5xx canary rollbacks server-side whenever GREGALE_TOKEN is an --agent key.