pREST v2.1.0+ gives agents in Cursor, Claude Desktop and OpenClaw live, read-only PostgreSQL tools, capped at 100 rows per select. They run on the same server that already exposes your REST API, with no separate query service.
The stack is the /_mcp endpoint plus the official prest-mcp stdio adapter. Optional Cursor and OpenClaw plugins add rules, skills and security guidance. 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
- What the pREST AI stack gives agents
- Which piece you need
- Step 1: install the prest-mcp adapter
- Step 2: point your MCP client at
/_mcp - Step 3: add a plugin for rules and skills
- Step 4: lock down the defaults
- Quick start for Cursor and OpenClaw
- FAQ
- Also from Insurgency Labs
- Links
What the pREST AI stack gives agents
pREST connects AI agents and IDEs to PostgreSQL through a layered design. Tools and SQL live in pREST. The adapter is transport only, and 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 runs catalog discovery and read queries in the same process that serves your REST API. The prest-mcp binary only forwards JSON-RPC between stdin/stdout and POST /_mcp.
Which piece you need
- For live database queries, install
prest-mcpand run pREST v2.1.0+ with/_mcpavailable. Stdio-only clients need the adapter: Cursor, Claude Desktop, VS Code Copilot, Cline and Continue. - For config, SQL route or security guidance, install the Cursor or OpenClaw plugin. Plugins don’t replace MCP. They teach the agent how to work with pREST safely.
- HTTP-capable MCP clients can call
/_mcpdirectly withoutprest-mcp. See the curl walkthrough in the MCP tutorial.
The best practice is both: prest-mcp for live tools and the matching plugin for rules and skills. Together they give agents query access plus pREST-specific workflows.
Step 1: install the prest-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.
With Homebrew (macOS):
brew install prest/tap/prest-mcp
With Go:
go install github.com/prest/prest-mcp-adapter/cmd/prest-mcp@latest
With Docker:
docker pull ghcr.io/prest/prest-mcp-adapter:0.1.3
Install details are in Install pREST MCP Adapter.
Step 2: point your MCP client at /_mcp
The adapter reads three 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 |
Its MCP Registry name is io.github.prest/prest.
This is the canonical Cursor config, in the project’s .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 isn’t on PATH, set "command" to the absolute binary path. With Homebrew on Apple Silicon, that’s typically /opt/homebrew/bin/prest-mcp.
Step 3: add a plugin for rules and skills
The plugins teach the agent how to use pREST. Neither one runs queries, so you still need Steps 1 and 2.
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. It 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 it from the Cursor plugin marketplace or follow the prest-cursor README. After install, still configure MCP separately. The plugin doesn’t 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 doesn’t run pREST or PostgreSQL.
Install it:
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
It ships these 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/).
Here’s the 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 |
Step 4: lock down the defaults
- Prefer a read-only PostgreSQL role for agent workflows.
- MCP tools in v2.1.0 are read-only, with no insert, update, delete or DDL. REST may still allow writes on the same server.
- Don’t expose an unauthenticated
/_mcppublicly. - Set
access.restrict = truewith explicit[[access.tables]]in production. - Use environment variables for secrets. Never commit real credentials or JWTs to git.
The read-only and auth trade-offs across Postgres MCP servers are in Postgres MCP servers compared.
Quick start for Cursor and OpenClaw
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 and confirm the
prestserver is connected in Settings → MCP. - Optionally, 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, plusPREST_MCP_TOKENif auth is on. - Wire MCP in the OpenClaw config using
prest-mcp, then restart the gateway.
For an end-to-end walkthrough, see PostgreSQL to AI agent.
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’s a transport bridge only: tools, catalog discovery and SQL live in pREST.
What is the difference between prest-mcp and pREST plugins?
prest-mcp enables live MCP tool calls: list tables, describe columns, select rows. The Cursor and OpenClaw plugins provide rules, skills and examples on pREST configuration, SQL routes and security. Plugins don’t implement MCP tools or replace the adapter.
How do I connect Cursor to PostgreSQL via pREST?
Run pREST v2.1.0+ and install prest-mcp (brew install prest/tap/prest-mcp). Add a stdio entry in .cursor/mcp.json with PREST_MCP_URL pointing to http://localhost:3000/_mcp. Restart Cursor and check that the tools appear. Optionally, install the prest-cursor plugin for more 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 group.
Where is the official pREST AI documentation?
It’s at docs.prestd.com/ai. It has an MCP overview, adapter install, and per-client guides for Cursor, VS Code, Claude and other tools. It also covers read-only Postgres setup and the 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 shows engineering managers PR cycle time and review patterns without write access to repos. See the DeliveryCompass overview. It’s free during Early Access. It isn’t a Jira replacement and doesn’t measure deploy-based DORA.