What is curral?
curral is a secure SQL gateway for DuckDB. It puts your DuckDB databases and Iceberg lakes behind an HTTP API, and decides for every statement who may run it, which rows they see and which columns arrive masked.
It is also built for AI agents: give an agent your server URL and it can
discover the API and install the skill. Schema discovery, semantic context
and dry runs help it answer questions within your access rules. Follow the
agent integration guide to connect Codex, Claude Code
or another agent that supports SKILL.md.
Curral is Portuguese for “corral”: the place where you keep the herd in and decide who gets through the gate.
New in v0.9.0
Section titled “New in v0.9.0”- Native MCP over Streamable HTTP or a local stdio bridge.
- Multiple OIDC providers with isolated issuer verification and role prefixes.
- Hash, email and prefix masks, plus transparent protection through local DuckDB views.
- Declarative policy tests and SQL validation for semantic documents.
- Parquet exports and gzip, Flight SQL cancellation, and macOS and Windows binaries.
- Database discovery scoped to query permissions, with per-user concurrency enforced before queueing.
The problem
Section titled “The problem”DuckDB is a great engine, but it has no users, no permissions and no network protocol. Sharing a DuckDB file or an Iceberg lake usually means one of two things:
- handing out raw storage credentials, so everyone can read everything;
- building and maintaining a custom API for each use case.
curral is the missing layer between the two: one binary that speaks HTTP and Arrow Flight SQL on one side and DuckDB on the other.
What you get
Section titled “What you get”| One binary | DuckDB is embedded. Databases and catalogs declared in a config file are attached at startup. |
| Policy as code | Access rules are written in Rego and evaluated by an embedded OPA. |
| Real inspection | The policy sees the base tables a statement really reads (views, CTEs and joins included), taken from DuckDB’s own planner, not a regex. |
| Row-level security and masking | Queries are rewritten before they run, so filters and joins cannot be used to guess hidden values. |
| Your lake | Anything DuckDB can ATTACH: DuckDB files, Iceberg REST catalogs (including Cloudflare R2 Data Catalog), Postgres, S3. |
| Production features | TLS, brute-force lockout, per-role limits, a fail-closed audit log, Prometheus metrics, hot reload with SIGHUP. |
| A semantic layer for agents | Documents on what tables mean, with sample SQL, that agents search by question before writing a query, ranked by BM25 and optionally judged by TypeSafe’s Jev model. |
| Agent discovery | The server provides its endpoints and a version-pinned skill install command at GET /. No SDK required. |
| Friendly to tools and agents | /v1/schema lists only what the caller may query, dry_run explains a decision without executing, Arrow streams into pandas, polars or DuckDB. |
| Trusted service delegation | A portal or internal app can query on behalf of its own users: the policy, row filters, masks and audit apply to the identity it names, never to its API key. |
| Database IDEs | With --flight-listen, DataGrip, DBeaver and ADBC clients connect over Arrow Flight SQL, browse only what the user may query and run SQL under the same policy, masks and audit. |
Where to go next
Section titled “Where to go next”- Connect an AI agent: install the skill and query with your permissions.
- Quickstart: run curral locally in two minutes.
- How a request flows: the six stages every query goes through.
- Writing a policy: decide who can read and write what.