SurrealDB CLI
$ surreal Official Med Risksurreal is the single-binary Rust CLI for SurrealDB's multi-model (document, graph, relational, vector) database. It runs piped SurrealQL queries with --json, manages schema/data export and import, and starts embedded local instances via surreal start.
brew install surrealdb/tap/surreal surreal pipes SurrealQL queries (--json), imports/exports .surql dumps, and runs ephemeral local dev databases directly without MCP.
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
Supports --json on surreal sql, stdin piping for headless execution, and SURREAL_* env vars, though surreal sql enters a REPL if stdin is a TTY.
- Supports
--jsonand stdin-piped queries onsurreal sql
Namespace/database scoping and env-var credentials help isolate targets, though surreal import and destructive SurrealQL lack a --dry-run flag.
- Supports
SURREAL_USER/SURREAL_PASSenv vars; no--dry-runonimport
Single fast Rust binary distributed via Homebrew tap and official install script for macOS, Linux, and Windows.
- Single static Rust binary via
brew install surrealdb/tap/surreal
Combines local server startup, SurrealQL execution, .surql export/import, and benchmarking in one binary.
- Covers
start,sql,export,import, andvalidate
Official surrealdb/surrealdb CLI with rapid releases, though governed by BSL-1.1 rather than an OSI-approved license.
- Official SurrealDB repo under BSL-1.1
Well-structured CLI documentation at surrealdb.com/docs/surrealdb/cli and built-in --help.
- Official CLI docs at surrealdb.com
Security, Auth & Guardrails
Reads SURREAL_USER, SURREAL_PASS, SURREAL_ENDPOINT, SURREAL_NAMESPACE, and SURREAL_DATABASE environment variables.
CLI and core binary are BSL-1.1 (free for non-DBaaS production/dev); SurrealDB Cloud incurs usage fees.
# SurrealDB CLI (surreal) Agent Rules - Pipe queries via stdin with `--json` (`echo "..." | surreal sql ... --json`) so `surreal` exits cleanly. - Set `SURREAL_USER` / `SURREAL_PASS` via env vars rather than CLI flags. - Verify `--ns` and `--db` flags before running `surreal import` or `REMOVE TABLE`.
Agent-Ready Command Recipes
Safe Read-Only Queries
echo "INFO FOR DB;" | surreal sql --endpoint http://localhost:8000 --ns test --db test --json
Pipes INFO FOR DB; into surreal sql and returns structured JSON schema definitions.
surreal export --endpoint http://localhost:8000 --ns test --db test backup.surql
Dumps tables, records, and definitions to a portable .surql file.
Controlled Writes & Previews
surreal import --endpoint http://localhost:8000 --ns test --db test schema.surql
Executes statements from schema.surql against the target namespace and database.
Strengths for Agents
- + Single fast Rust binary supporting
--jsonoutput and piped SurrealQL. - + Explicit
--nsand--dbtargeting plusSURREAL_*environment variables.
Caveats & Pitfalls
- ! Source-available BSL-1.1 license (restricts offering managed DBaaS) rather than Apache-2.0/MIT.
- ! CLI subcommand layout evolved between v1/v2 (
surreal sqlvssurreal db sql).