pREST v2 Guide: Versions, Upgrade Path and Where to Start

pREST is an open-source Go server that turns an existing PostgreSQL or MySQL database into a REST API. Since v2.1.0 it also serves a read-only MCP endpoint, without writing backend code. I maintain it and have written a post for every v2 release since July.

Run it safely in three rungs: patch to v2.5.2, bind your templates, fix the defaults. Below: each rung, every release and advisory, and which post to read first.

Table of Contents

Good: patch to v2.5.2

The three rungs are condensed from the upgrade sections of the v2.3.0, v2.4.0, v2.4.1 / v2.4.2 and v2.5.2 posts.

Run v2.5.2. Every earlier v2 release has at least one open advisory, and v2.4.1 has a correctness regression on top. Patch first, especially if prestd is reachable from clients you do not control. The v2.3.0 and v2.4.1 injections are unauthenticated on a default config. The v2.5.2 stored-query chain needs no token when auth is off. Skip v2.4.1 entirely.

The table maps each advisory to the versions it affects, taken from the release posts.

Advisory Severity What it hits Affected Fixed in
GHSA-qvx3-q8vx-9q3c CVSS 9.8 Unauthenticated SQL injection through _select v2.0.0 to v2.2.0 v2.3.0
GHSA-v9v2-98xq-627c CVSS 8.1 Same class of gap in _groupby releases before v2.4.0 (see advisory) v2.4.0
GHSA-r3hj-2fxx-7f3h CVSS 8.1 Request headers interpolated into _QUERIES templates without screening releases before v2.4.0 (see advisory) v2.4.0
GHSA-rf54-gp27-88rv multiple fixes /batch skipped table ACL, _QUERIES skipped database validation, credential leaks in logs releases before v2.4.0 (see advisory) v2.4.0
GHSA-5rwc-2hg5-2hmc CVSS 8.6 Read-only SQL injection through unquoted {{.param}} in _QUERIES templates v2.0.0 to v2.4.0 v2.4.1
GHSA-x62p-38px-pp73 CVSS 5.3 /_mcp returned the full catalog regardless of [expose] releases before v2.4.1 v2.4.1
Issue #1030 regression Keyword screen silently blanked parameter values containing words like do or as, returning wrong rows with HTTP 200 v2.4.1 only v2.4.2
GHSA-2x9q-r7j9-g85f CVSS 9.0 prest_queries writable over REST, then executed through /_QUERIES; OS commands when connected as superuser up to v2.5.1 v2.5.2
GHSA-fmr6-9j48-xrqp CVSS 8.1 /_PLUGIN path traversal loaded any .so on disk, with no auth up to v2.5.1 v2.5.2
GHSA-fhf5-m388-4w4p CVSS 7.5 Catalog routes and /show answered without a token when auth was on up to v2.5.1 v2.5.2

What this rung costs is one check before restarting: jwt.key length. From v2.4.2, HS256 needs at least 32 bytes, HS384 48 and HS512 64. An undersized key is treated as unusable at startup instead of failing at request time. So you can end up with auth disabled and a log line telling you why. The auth docs list the minimums.

Coming from v2.5.1 or earlier, check four things. If you ran queries.storage = "database" without auth, audit prest_queries for rows you did not create; the patch blocks new writes but keeps planted ones. Rename any application table called prest_users or prest_queries, since those names are reserved. With auth on, give catalog clients a token: /databases, /schemas, /tables, /show/... and /_PLUGIN now return 401 without one. Replace pg.single with a [[databases]] registry or pg.allowed_databases.

One proxy rule may go away. If you used to block /_mcp at a reverse proxy because it ignored [expose], that rule is redundant from v2.4.1.

Coming from v1.x, expect breaking changes. The Go module path is github.com/prest/prest/v2, bcrypt replaced MD5 as the default password encryption, and the config shape changed. Test in staging (v2.0.0 post). Coming from rc6, the upgrade is incremental and there is no second rewrite.

Better: bind every _QUERIES value

Audit your _QUERIES templates. Move every free-form value from '{{.x}}' or {{.x}} to {{sqlVal "x"}}, and repeated parameters to {{sqlList "x"}}.

What it buys: binding is the only fix that is both safe and lossless. Quoted interpolation was never exploitable by the v2.4.1 advisory. But from v2.4.2, an interpolated value that trips the screen fails the request with a 400. Binding is also what keeps your endpoints working for values like compra-do-mes.

What it costs: a pass over every template you run.

Best: turn on auth and restrict tables

Patching closes the injections. It does not change your config. So fix the defaults the v2.3.0 advisory called out:

  • Set auth.enabled = true.
  • Set access.restrict = true with explicit [[access.tables]].
  • Stop connecting as the Postgres superuser.

What it buys: a safe config on top of a patched binary. Out of the box, auth.enabled and access.restrict are both off, and the official Docker images connect as the Postgres superuser.

What it costs: with restrict = true, unlisted tables become inaccessible. Every table you want reachable needs its own [[access.tables]] entry.

Every v2 release so far

Dates are from the GitHub releases page. Each row links to the post I wrote about it and to the release itself.

Version Released What changed Post Release
v2.0.0-rc6 Jul 1, 2026 Hexagonal refactor: the monolithic Adapter split into port interfaces, dependency-injected controllers, JWT bypass fix, OR filters, slog Architecture post v2.0.0-rc6
v2.0.0 Jul 8, 2026 First stable v2: multi-database registry with alias routing, connection pooling, config resilience, /_ready v2.0.0 / v2.1.0 post v2.0.0
v2.1.0 Jul 9, 2026 Read-only MCP endpoint at /_mcp on the same HTTP server, inheriting auth and ACL same post, MCP tutorial v2.1.0
v2.2.0 Jul 18, 2026 Embedded Studio UI at /_studio/, custom queries stored in a prest_queries table, TimescaleDB integration tests v2.2.0 post v2.2.0
v2.3.0 Jul 22, 2026 Fix for an unauthenticated SQL injection in _select (CVSS 9.8), JWKS on jwx v3, adapter registry v2.3.0 post v2.3.0
v2.4.0 Jul 27, 2026 pgvector ordering and distance filters, opt-in OpenTelemetry, six more injection-adjacent fixes v2.4.0 post v2.4.0
v2.4.1 Jul 29, 2026 Fix for _QUERIES template injection (CVSS 8.6) and /_mcp ignoring [expose]; introduced a keyword screen that blanked real data v2.4.1 / v2.4.2 post v2.4.1
v2.4.2 Aug 11, 2026 Parameter binding with sqlVal and sqlList, script path containment, SQL out of logs, RFC 7518 minimum JWT key sizes same post v2.4.2
v2.5.0 Oct 7, 2026 MySQL 8.0.19+ as a second engine (engine = "mysql"), _join under access.restrict returns joined columns, middleware plugins load v2.5 MySQL post v2.5.0
v2.5.1 Oct 8, 2026 Patch release, recommended for MySQL: MySQL adapter fixes (auth, JSON writes, MCP), arm64 images, 503 on database outage same post v2.5.1
v2.5.2 Oct 18, 2026 Security release: stored-query RCE (CVSS 9.0), catalog routes that skipped auth, plugin path traversal; pg.allowed_databases replaces pg.single v2.5.2 post v2.5.2

If you only read one of those posts, read the v2.4.1 / v2.4.2 one. It explains why a SQL keyword blacklist cannot be made safe. It also shows why binding is the only fix that is both safe and lossless. That’s the lesson I most want people to take from this series.

Where to start

Pick by what you want to do.

You want a REST API over a Postgres database you already have. Start with pREST in 10 minutes. It goes from a Docker Compose file to list, filter, insert, update and delete requests. Then it turns on JWT auth and restricts a table. It ends with a custom SQL route using a bound parameter and an MCP call with curl.

You have a MySQL database. Start with the MySQL walkthrough. It covers setup, auth and MCP.

You want an AI agent to read your database without handing it a connection string. The MCP server tutorial walks through /_mcp with curl and wires it into Cursor and Claude Desktop. The AI tooling post covers the prest-mcp stdio adapter and the Cursor and OpenClaw plugins.

You are deciding between tools. pREST vs PostgREST is the comparison most people ask me for. Choosing an MCP server to put in front of Postgres? Postgres MCP servers compared covers the options, pREST included.

You care how it is built. The rc6 architecture post explains the port interfaces and dependency injection. The v2.3.0 post explains how the adapter registry sits on top of that.

What’s in the box

One short entry per feature, from the docs.

REST routes. GET, POST, PATCH/PUT and DELETE on /{database}/{schema}/{table} map to SELECT, INSERT, UPDATE and DELETE. The query string takes _page, _page_size, _order, _select, _count, _groupby and filter operators such as $gt, $in, $ilike and $null (parameters).

Auth. POST /auth with a username and password from a configured users table returns a JWT. jwt.default = true enforces it on every route except the whitelist, and since v2.5.2 that includes the catalog routes. HMAC keys have minimum sizes since v2.4.2 (auth).

ACL. [access] restrict = true makes unlisted tables inaccessible. [[access.tables]] grants read, write and delete per table with an optional fields list, and [[access.users]] overrides per identity (permissions).

Custom queries. SQL files under queries.location become /_QUERIES/{folder}/{script} routes. The .read.sql, .write.sql, .update.sql and .delete.sql suffixes pick the HTTP verb, and sqlVal, sqlList and ident bind request values (custom queries).

Multi-database. Add [[databases]] entries or DATABASE_ALIAS_N / DATABASE_URL_N pairs. The first path segment then selects a registered alias, and /_ready checks every alias. Without a registry, pg.allowed_databases lists extra databases on the same host; pg.single was removed in v2.5.2 (multi-database).

MCP. GET /_mcp returns the discovery payload, and POST /_mcp takes JSON-RPC initialize, tools/list and tools/call. Tools are read-only and capped at 100 rows. They honor the same auth, permissions and [expose] settings as REST (MCP over HTTP).

pgvector. _korder=embedding:l2:[...] orders by vector distance, and embedding:vecdist=l2:lt:[...]:0.5 filters by a distance threshold. Both arrived in v2.4.0 (parameters).

OpenTelemetry. An [otel] section, off by default, pushes traces, metrics and logs over OTLP/gRPC. You get one span per HTTP request, SQL round trip and MCP tool call (v2.4.0 post).

Studio. A read-only explorer embedded in the binary at /_studio/, on by default and disabled with PREST_STUDIO_ENABLED=false. It browses the catalog, builds REST requests and invokes MCP tools as a same-origin client (Studio).

FAQ

What is pREST?

pREST is an open-source Go server that exposes a PostgreSQL database as a REST API. Since v2.1.0 it is also a read-only MCP endpoint for AI agents. The README describes CRUD, custom SQL routes, auth, ACL and MCP on top of Postgres, with no hand-written backend. The database can be existing or new, version 9.5 or higher. It runs as a single prestd binary or the prest/prest Docker image.

Is pREST production-ready?

The README calls it production-ready, and it ships as a single binary with auth, ACL and multi-database routing built in. The caveats are the defaults: auth.enabled and access.restrict are both off out of the box. The v2.3.0 advisory also notes the official Docker images connect as the Postgres superuser. A production deployment should turn auth on, restrict tables explicitly, use a non-superuser role and run v2.5.2 or later.

Which pREST version should I run?

v2.5.2, the latest release as of this page. Every earlier v2 release is affected by at least one of the advisories in the table above. v2.4.1 also has a regression that silently blanked parameter values. Pull prest/prest:v2.5.2 or download a binary from the release page.

Is pREST free?

Yes. pREST is open source under the MIT License, and the binaries, Docker images and Homebrew formula are all free to use. The docs do not describe a paid tier.

Does pREST support MySQL or SQLite, or only Postgres?

Both PostgreSQL and MySQL. MySQL 8.0.19+ is supported since v2.5, with REST and MCP; set engine = "mysql" (v2.5 post). Postgres-compatible engines like CockroachDB, YugabyteDB and TimescaleDB run on the Postgres adapter (databases page). SQLite and SQL Server are on the roadmap.

Sources

Release dates and notes: GitHub releases page. Docs: docs.prestd.com. Code: github.com/prest/prest.