Neon CLI
$ neonctl Official Med RiskNeon CLI manages Neon serverless Postgres projects, copy-on-write branches, compute endpoints, and roles. Supports --output json across commands, non-interactive NEON_API_KEY auth, and ephemeral branch workflows ideal for AI coding agents.
brew install neonctl Use neonctl for deterministic branch lifecycle, CI scripting, and connection string retrieval; Neon's MCP server complements it for natural-language SQL exploration.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
First-class --output json / yaml / table support, non-interactive NEON_API_KEY auth, and predictable subcommand taxonomy.
- Supports
--output jsonacross resource commands andNEON_API_KEYenv auth
Copy-on-write branching enables safe isolated testing, though branches delete and projects delete require explicit guardrails.
- Isolated branch creation protects production
main; delete commands have remote impact
Available via brew, npm, npx, and standalone binaries across macOS, Linux, and Windows.
- Multi-channel distribution via Homebrew and npm
Lets agents spin up disposable Postgres branches and obtain URIs in seconds.
- Instant copy-on-write Postgres branching in a single command
Official neondatabase/neonctl repository maintained by Neon under Apache-2.0.
- Official
neondatabase/neonctlrepo
Well-documented CLI reference with per-command flag tables and examples.
- Official reference at neon.tech/docs/reference/neon-cli
Security, Auth & Guardrails
OAuth credentials stored under ~/.config/neonctl/credentials.json or supplied via NEON_API_KEY / --api-key.
CLI is Apache-2.0 open-source; Neon offers a free tier with usage-based compute/storage billing on paid plans.
# Neon CLI Agent Rules - Always pass `--output json` and set `NEON_API_KEY` for headless runs. - Create an isolated branch with `neonctl branches create` before running schema migrations. - NEVER run `neonctl projects delete` or `neonctl branches delete main` autonomously.
Agent-Ready Command Recipes
Safe Read-Only Queries
neonctl projects list --output json
Retrieves project IDs, regions, and Postgres versions in structured JSON.
neonctl connection-string main --project-id <project-id> --output json
Returns the PostgreSQL URI for a specific branch for downstream tooling.
Controlled Writes & Previews
neonctl branches create --name agent-test --project-id <project-id> --output json
Spins up a copy-on-write Postgres branch so agents never mutate main directly.
Strengths for Agents
- + Consistent
--output jsonoutput makes project and branch automation trivial. - + Copy-on-write
branches createlets agents test migrations safely away from production. - +
NEON_API_KEYenables clean headless CI and agent execution.
Caveats & Pitfalls
- !
connection-stringprints database credentials to stdout; mask output in shared logs. - ! Lacks a native
--dry-runflag on destructive delete operations.