> For the complete documentation index, see [llms.txt](https://docs.prestd.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prestd.com/ai/mcp-overview.md).

# 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](/ai/read-only-postgres.md).
* 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](/api-reference/auth.md) 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

* [Install pREST MCP Adapter](/ai/install-prest-mcp.md)
* [Use with Cursor](/ai/cursor.md) · [VS Code and Copilot](/ai/vscode-copilot.md) · [Claude Desktop](/ai/claude-desktop.md) · [Other AI tools](/ai/other-clients.md)
* Protocol and tools reference: [MCP over HTTP](/get-started/mcp-over-http.md)

## Related documentation

* [AI and MCP landing](/ai.md)
* [pREST for Cursor plugin](/ai/prest-cursor.md)
* [pREST for OpenClaw plugin](/ai/prest-openclaw.md)
* [v2.1.0 release notes](/releases/v2.1.0.md)
