postgrest-mcp
MCP server for PostgREST that turns PostgreSQL databases into RESTful APIs, providing 10 tools for schema discovery, CRUD operations, filtering, resource embedding, and RPC.
README
@node2flow/postgrest-mcp
MCP server for PostgREST — a standalone web server that turns PostgreSQL databases into RESTful APIs. 10 tools for schema discovery, CRUD operations, filtering, resource embedding, and RPC via the Model Context Protocol.
Quick Start
Claude Desktop / Cursor
Add to your MCP config:
{
"mcpServers": {
"postgrest": {
"command": "npx",
"args": ["-y", "@node2flow/postgrest-mcp"],
"env": {
"POSTGREST_URL": "http://localhost:3000",
"POSTGREST_TOKEN": "your-jwt-token"
}
}
}
}
Note: JWT token is optional. If PostgREST has an anonymous role configured (
db-anon-role), schema and read operations work without authentication.
HTTP Mode
POSTGREST_URL=http://localhost:3000 POSTGREST_TOKEN=your-jwt npx @node2flow/postgrest-mcp --http
MCP endpoint: http://localhost:3000/mcp
Cloudflare Worker
Available at: https://postgrest-mcp-community.node2flow.net/mcp
POST https://postgrest-mcp-community.node2flow.net/mcp?POSTGREST_URL=http://your-server:3000&POSTGREST_TOKEN=your-jwt
Tools (10)
Schema (2) — No Auth Required (with anonymous role)
| Tool | Description |
|---|---|
pg_get_schema |
Get OpenAPI schema — lists all tables, views, functions |
pg_describe_table |
Get column details, types, constraints for a table/view |
Read (3) — Read-Only
| Tool | Description |
|---|---|
pg_list_records |
Query records with filters, select, order, pagination |
pg_count_records |
Count records (exact, planned, or estimated) |
pg_call_function |
Call PostgreSQL functions/procedures via RPC |
Write (5) — Requires Auth
| Tool | Description | Risk |
|---|---|---|
pg_insert_records |
Insert one or more records | Safe |
pg_update_records |
Update records matching a filter | Safe (filter required) |
pg_upsert_records |
Insert or update on conflict | Safe |
pg_delete_records |
Delete records matching a filter | Destructive |
pg_replace_record |
Full replace (PUT) a single record | Safe |
Filter Syntax
PostgREST uses a powerful filter syntax on query parameters:
# Comparison
age=gt.18 # greater than
status=eq.active # equals
price=lte.100 # less than or equal
# Pattern matching
name=ilike.*john* # case-insensitive LIKE
email=like.*@gmail.com # case-sensitive LIKE
# Lists and NULL
id=in.(1,2,3) # IN list
deleted_at=is.null # NULL check
# Logic
or=(age.lt.18,age.gt.65) # OR conditions
not.status=eq.inactive # NOT
# Full-text search
content=fts.postgresql # full-text search
# Array/JSONB
tags=cs.{tech,api} # array contains
Resource Embedding (JOINs)
Query related tables using the select parameter:
*,orders(*) — embed all columns from related table
id,name,orders(id,total,status) — specific columns from embed
id,author:user_id(name,email) — renamed embed
Filter on embedded resources:
select: id,name,orders(*)
filter: orders.status=eq.completed
Configuration
| Parameter | Required | Description |
|---|---|---|
POSTGREST_URL |
Yes | PostgREST server URL (e.g. http://localhost:3000) |
POSTGREST_TOKEN |
No | JWT token for authenticated requests |
JWT Authentication
PostgREST uses JSON Web Tokens (JWT) for stateless authentication.
- Configure
jwt-secretin your PostgREST config - Generate a JWT with the appropriate
roleclaim - Pass the token via
POSTGREST_TOKENenvironment variable
JWT Claims:
role— Database role name (required for RLS)exp— Token expiration (Unix timestamp)- Custom claims accessible in SQL via
current_setting()
Tip: Use
db-anon-rolein PostgREST config for public read-only access without tokens.
Safety
- Update and Delete require a filter — prevents accidental full-table operations
- Use
pg_count_recordsto verify filter matches before delete - Use
return="representation"to see what was changed - Use
pg_describe_tableto check required columns before insert
What is PostgREST?
PostgREST is a standalone web server that:
- Turns PostgreSQL tables into CRUD endpoints (GET, POST, PATCH, PUT, DELETE)
- Turns views into read-only endpoints
- Turns functions into RPC endpoints (
/rpc/function_name) - Uses PostgreSQL Row Level Security (RLS) for authorization
- Auto-generates an OpenAPI specification
License
MIT License - see LICENSE
Copyright (c) 2026 Node2Flow
Links
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。