For the complete documentation index, see llms.txt. This page is also available as Markdown.

MCP Overview

pREST exposes a PostgreSQL MCP server over HTTP so AI agents can discover schemas and read data through the same process that serves your REST API.

Requires pREST v2.1.0+.


Two layers

Layer
What it is
What it does

HTTP MCP endpoint

/_mcp on prestd

Implements MCP tools, catalog discovery, and read queries

Stdio adapter

prest-mcp binary

Forwards JSON-RPC between stdin/stdout and POST /_mcp

The adapter is a transport bridge only. It does not introspect schemas, generate SQL, or implement tools β€” those live in pREST.

MCP client / AI IDE
        ↓ stdio (NDJSON JSON-RPC)
prest-mcp
        ↓ HTTP POST
http://localhost:3000/_mcp
        ↓
pREST β†’ PostgreSQL

Concern

Native /_mcp

prest-mcp adapter

Transport

HTTP on the pREST server

Stdio process that proxies to HTTP

Tools / SQL

Implemented in pREST

None β€” forwards JSON-RPC as-is

When to use

HTTP-capable MCP clients

Clients that only launch stdio servers

Extra process

No

Yes β€” one lightweight binary


Security defaults for AI

  • Prefer a read-only PostgreSQL role for agent workflows β€” see Read-only PostgreSQL for AI.

  • 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 /_mcp publicly.

  • Prefer local or private-network pREST for development.

  • When auth is enabled, pass a JWT via PREST_MCP_TOKEN (adapter) or Authorization (HTTP).


Environment variables (adapter)

Variable
Required
Default
Description

PREST_MCP_URL

yes

β€”

URL of the HTTP MCP endpoint, 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


Next steps

Last updated