CockroachDBHow to serve CockroachDB as a REST API and MCP server

Open CockroachDB to apps and agents, permissioned per table.

Register it once as type cockroachdb. Every table and view is served as a REST API and as MCP tools, over the Postgres protocol CockroachDB speaks.

Every role, decided on the table. Every call, on the record. The rows stay in your cluster; nothing is copied out of it.

Free licence: 50,000 requests a month, for any use, commercial included, no card. Need more? See pricing.

acme / people / cockroachdb / acme / employee

Request

GET /minimal/api/rest/auto/v1/acme/people/cockroachdb/acme/employee?fc=id,full_name&oy=id.as&ps=5&pg=0
Host: api.acme.example
LB-Access-Token: <your-access-token>

The path

acme        organisation
people      project
cockroachdb  database engine
acme        database
employee    table

Four things that are specific to CockroachDB.

The name is cockroachdb

cockroachdb is the path segment and the db_type you register with. It has no short code: pg reaches plain Postgres only. MCP tools take the full name too.

Registered as itself

Minimal connects and reads the server’s version, which begins “CockroachDB”. A cluster registered as postgres is refused with “the server is cockroachdb, not postgres”.

Its own schema stays out

crdb_internal, the schema CockroachDB keeps for itself, is never served. Your tables, views and materialized views are.

Set ssl_mode for Cockroach Cloud

Name ssl_mode in the database’s connection settings when the cluster is on Cockroach Cloud. Detection is tested against CockroachDB v26.3.5.

Shared with every Postgres-protocol database: a multi-row insert lands in one transaction, all rows or none. A not-null column with a database default is sent as null to let the default run; leaving the key out is refused as a missing required field.

One table per call.

The Auto API reads and writes one table per call: no joins, no subqueries, no aggregate functions. A join belongs in a view, read through the same route, or in a Custom API definition. Sign-in comes from Zitadel in the Docker Compose setup, which can sign in your customers too, or from the gateway you already run; third-party services stay where they already are.

Also: Postgres · TimescaleDB · All 15 databases · Pricing

Put it in front of a CockroachDB cluster.