pREST v2.1.0+ ships a full AI stack for PostgreSQL: a read-only HTTP MCP endpoint at /_mcp, the official prest-mcp stdio adapter for Cursor and other MCP clients, and optional Cursor and OpenClaw plugins that add rules, skills, and security guidance. Use the same server that already exposes your REST API — no separate query service. Full install and client guides live at docs.prestd.com/ai.
pREST v2 series: Architecture (rc6) → v2.0.0 / v2.1.0 GA → MCP tutorial → This post (AI plugins)
Table of Contents
- The pREST AI stack
- prest-mcp — official MCP adapter
- pREST for Cursor plugin
- pREST for OpenClaw plugin
- Adapter vs plugins — when to use what
- Quick start paths
- Security defaults
- FAQ
- Also from Insurgency Labs
The pREST AI stack
pREST connects AI agents and IDEs to PostgreSQL through a layered design. Tools and SQL live in pREST; the adapter is transport only; plugins add agent guidance.
Cursor / VS Code / Claude / OpenClaw / Cline / Continue
↓ stdio (NDJSON JSON-RPC)
prest-mcp
↓ HTTP POST
prestd /_mcp
↓
PostgreSQL
| Piece | Role |
|---|---|
pREST /_mcp |
Read-only MCP tools: list databases/schemas/tables, describe columns, select rows (max 100) |
prest-mcp adapter |
Stdio ↔ HTTP bridge only — does not introspect schemas, generate SQL, or implement tools |
| pREST for Cursor | Optional Cursor plugin (rules and skills) — separate from the MCP binary |
| pREST for OpenClaw | Optional OpenClaw plugin (skills and examples) — separate from the MCP binary |
The HTTP MCP endpoint implements catalog discovery and read queries on the same process that serves your REST API. The prest-mcp binary forwards JSON-RPC between stdin/stdout and POST /_mcp — nothing more.
prest-mcp — official MCP adapter
prest-mcp is the official stdio adapter for pREST’s HTTP MCP endpoint. Use it when your MCP client expects a stdio process instead of calling /_mcp directly.
Homebrew (macOS):
brew install prest/tap/prest-mcp
Go:
go install github.com/prest/prest-mcp-adapter/cmd/prest-mcp@latest
Docker:
docker pull ghcr.io/prest/prest-mcp-adapter:0.1.3
Environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
PREST_MCP_URL |
yes | — | Full MCP URL, e.g. http://localhost:3000/_mcp |
PREST_MCP_TOKEN |
no | — | Bearer token when pREST auth is enabled |
PREST_MCP_TIMEOUT_MS |
no | 30000 |
HTTP timeout in milliseconds |
MCP Registry name: io.github.prest/prest
Canonical Cursor config (project .cursor/mcp.json):
{
"mcpServers": {
"prest": {
"command": "prest-mcp",
"env": {
"PREST_MCP_URL": "http://localhost:3000/_mcp"
}
}
}
}
With auth enabled, add PREST_MCP_TOKEN. If prest-mcp is not on PATH, set "command" to the absolute binary path (Homebrew on Apple Silicon: typically /opt/homebrew/bin/prest-mcp).
Install details: Install pREST MCP Adapter.
pREST for Cursor plugin
pREST for Cursor (prest/prest-cursor) is a Cursor plugin with rules, skills, and examples that help the agent work with pREST. It is not the MCP binary.
What the plugin provides:
- Rules for configuring and using pREST MCP safely
- Skills for common setup steps (including MCP)
- Examples such as a read-only Postgres role for AI access
Install from the Cursor plugin marketplace or follow the prest-cursor README. After install, still configure MCP separately — the plugin does not replace prest-mcp.
| Task | Use |
|---|---|
Agent calls prest.list_databases / select tools |
MCP via prest-mcp → /_mcp |
| Agent follows pREST-specific rules and skills | prest-cursor plugin |
| Least-privilege DB access | Read-only PostgreSQL for AI |
pREST for OpenClaw plugin
pREST for OpenClaw (@prest/prest-openclaw on ClawHub) provides skills, examples, and security guidance for building PostgreSQL-backed APIs with pREST. It does not run pREST or PostgreSQL.
Install:
openclaw plugins install clawhub:@prest/prest-openclaw
openclaw plugins inspect prest
Enable the plugin in your OpenClaw config if needed, then restart the gateway:
openclaw gateway restart
Skills:
| Skill | Purpose |
|---|---|
generate-config |
Generate prest.toml, .env.example, optional Docker Compose |
generate-sql-route |
Parameterized SQL under /_QUERIES/ |
review-security |
Audit configs, SQL, auth, and MCP exposure |
setup-mcp |
Wire prest-mcp and read-only Postgres for agents |
explain-config |
Plain-language prest.toml walkthrough |
prest-core-guidance |
Core pREST development rules |
prest-security-guidance |
Security defaults and warnings |
prest-mcp-guidance |
MCP and prest-mcp connection patterns |
agent-prompts |
Copy-paste prompts for common tasks |
Examples include Docker Compose setups, SQL template routes, multi-database configs, and a read-only MCP workflow (examples/mcp-readonly/).
Example MCP config shape (from the plugin repo):
{
"mcpServers": {
"prest": {
"command": "prest-mcp",
"env": {
"PREST_MCP_URL": "${PREST_MCP_URL}",
"PREST_MCP_TOKEN": "${PREST_MCP_TOKEN}"
}
}
}
}
| Task | Use |
|---|---|
Agent calls prest.list_databases / select tools |
MCP via prest-mcp → /_mcp |
| Agent follows pREST skills (config, SQL routes, security) | prest-openclaw plugin |
| Least-privilege DB access | Read-only PostgreSQL role |
Adapter vs plugins — when to use what
- Need live database queries — install
prest-mcpand run pREST v2.1.0+ with/_mcpavailable. The adapter is required for stdio-only clients (Cursor, Claude Desktop, VS Code Copilot, Cline, Continue). - Need config, SQL route, or security guidance — install the Cursor or OpenClaw plugin. Plugins do not replace MCP; they teach the agent how to work with pREST safely.
- HTTP-capable MCP clients — can call
/_mcpdirectly withoutprest-mcp. See the MCP tutorial curl walkthrough. - Best practice — use
prest-mcpfor live tools and the matching plugin for rules/skills. Both together give agents query access plus pREST-specific workflows.
Quick start paths
Cursor
- Run pREST v2.1.0+ with
/_mcpreachable — verify withcurl -s http://localhost:3000/_mcp | head brew install prest/tap/prest-mcp- Add
.cursor/mcp.jsonwith the stdio config above - Restart Cursor; confirm
prestserver is connected in Settings → MCP - Optional: install prest-cursor for rules and skills
OpenClaw
openclaw plugins install clawhub:@prest/prest-openclaw- Run pREST v2.1.0+ with
/_mcpavailable brew install prest/tap/prest-mcp- Set
PREST_MCP_URL=http://localhost:3000/_mcp(andPREST_MCP_TOKENif auth is on) - Wire MCP in OpenClaw config using
prest-mcp; restart gateway
End-to-end walkthrough: PostgreSQL to AI agent.
Security defaults
- Prefer a read-only PostgreSQL role for agent workflows
- MCP tools in v2.1.0 are read-only (no insert/update/delete/DDL); REST may still allow writes on the same server
- Do not expose unauthenticated
/_mcppublicly - Set
access.restrict = truewith explicit[[access.tables]]in production - Use environment variables for secrets — never commit real credentials or JWTs to git
FAQ
What is the prest-mcp adapter?
prest-mcp is the official stdio adapter for pREST’s HTTP MCP endpoint at /_mcp. It forwards JSON-RPC between stdin/stdout and POST /_mcp. It is a transport bridge only — tools, catalog discovery, and SQL live in pREST, not in the adapter.
What is the difference between prest-mcp and pREST plugins?
prest-mcp enables live MCP tool calls (list tables, describe columns, select rows). Cursor and OpenClaw plugins provide rules, skills, and examples that guide agents on pREST configuration, SQL routes, and security. Plugins do not implement MCP tools or replace the adapter.
How do I connect Cursor to PostgreSQL via pREST?
Run pREST v2.1.0+, install prest-mcp (brew install prest/tap/prest-mcp), and add a stdio entry in .cursor/mcp.json with PREST_MCP_URL pointing to http://localhost:3000/_mcp. Restart Cursor and verify tools appear. Optionally install the prest-cursor plugin for additional guidance.
What skills does the OpenClaw plugin include?
Nine skills: generate-config, generate-sql-route, review-security, setup-mcp, explain-config, prest-core-guidance, prest-security-guidance, prest-mcp-guidance, and agent-prompts. Examples cover Docker Compose, SQL routes, multi-database configs, and read-only MCP workflows.
Do I need prest-mcp if my client supports HTTP MCP?
No. HTTP-capable clients can POST JSON-RPC directly to /_mcp. Use prest-mcp when your client only launches stdio MCP servers — Cursor, Claude Desktop, VS Code Copilot, and most IDE integrations fall in this category.
Where is the official pREST AI documentation?
docs.prestd.com/ai — MCP overview, adapter install, per-client guides (Cursor, VS Code, Claude, other tools), read-only Postgres setup, and plugin docs for Cursor and OpenClaw.
Also from Insurgency Labs
Teams wiring read-only agent access to Postgres via pREST MCP may also want read-only delivery metrics from GitHub — DeliveryCompass surfaces PR cycle time and review patterns for engineering managers without write access to repos. See the DeliveryCompass overview. Free during Early Access; not a Jira replacement and does not measure deploy-based DORA.