Stay Updated
Subscribe to our newsletter for the latest news and updates about MCP servers
Subscribe to our newsletter for the latest news and updates about MCP servers
MCP server to enable database operations on PostgreSQL through PostgREST's RESTful API interface
Supabase Postgrest MCP Server is a specialized Model Context Protocol (MCP) server developed by the Supabase community. It bridges large language models (LLMs) with PostgreSQL databases through PostgREST, a web server that automatically converts PostgreSQL database schemas into RESTful APIs. The server enables seamless interaction with both Supabase-hosted PostgreSQL instances and standalone PostgREST implementations.
This MCP server translates natural language instructions from LLMs into structured queries and operations that can be executed against PostgreSQL databases. By leveraging PostgREST's RESTful interface, it eliminates the need for direct database connections while maintaining robust data access capabilities.
PostgREST Integration
SQL Translation
Flexible Configuration
Transport Options
The Supabase Postgrest MCP server excels in scenarios where AI assistants need to interact with PostgreSQL databases directly:
postgrestRequest
Performs HTTP requests to a configured PostgREST server with the following parameters:
method
: HTTP method (GET, POST, PATCH, DELETE)path
: Resource path with query parametersbody
: Request body for POST/PATCH requestsReturns JSON responses containing queried or modified data.
sqlToRest
Converts SQL statements to equivalent PostgREST syntax with parameters:
sql
: The SQL query to convertReturns an object with method
and path
properties that can be used with the postgrestRequest
tool.
Rating: 3/5
The integration requires moderate technical knowledge including:
However, comprehensive documentation and examples significantly reduce complexity.
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
mcpServers
object:{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-postgrest",
"--apiUrl",
"https://your-project-ref.supabase.co/rest/v1",
"--apiKey",
"your-anon-key",
"--schema",
"public"
]
}
}
}
your-project-ref
with your Supabase project referenceyour-anon-key
with your Supabase anon keyschema
if using a non-public schema.cursor/mcp.json
file in your project directory{
"mcpServers": {
"supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-postgrest",
"--apiUrl",
"https://your-project-ref.supabase.co/rest/v1",
"--apiKey",
"your-anon-key",
"--schema",
"public"
]
}
}
}
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamTransport } from '@supabase/mcp-utils';
import { PostgrestMcpServer } from '@supabase/mcp-server-postgrest';
// Create transports
const clientTransport = new StreamTransport();
const serverTransport = new StreamTransport();
// Connect streams
clientTransport.readable.pipeTo(serverTransport.writable);
serverTransport.readable.pipeTo(clientTransport.writable);
// Initialize client
const client = new Client(
{ name: 'MyClient', version: '0.1.0' },
{ capabilities: {} }
);
// Configure server
const server = new PostgrestMcpServer({
apiUrl: 'https://your-project-ref.supabase.co/rest/v1',
apiKey: 'your-anon-key',
schema: 'public',
});
// Connect client and server
await server.connect(serverTransport);
await client.connect(clientTransport);
// Example tool call
const output = await client.callTool({
name: 'postgrestRequest',
arguments: {
method: 'GET',
path: '/todos',
},
});