Skip to main content
Glama
Apache 2.0
356
1,505
  • Apple

@subabase/servidor-mcp-postgrest

Este es un servidor MCP para PostgREST . Permite a los LLM realizar operaciones CRUD en su aplicación mediante la API REST.

Este servidor funciona con proyectos Supabase (que ejecutan PostgREST) y cualquier servidor PostgREST independiente.

Herramientas

Las siguientes herramientas están disponibles:

postgrestRequest

Realiza una solicitud HTTP a un servidor PostgREST configurado . Acepta los siguientes argumentos:

  • method : el método HTTP a utilizar (por ejemplo, GET , POST , PATCH , DELETE )
  • path : La ruta a la que se realizará la consulta (por ejemplo, /todos?id=eq.1 )
  • body : el cuerpo de la solicitud (para solicitudes POST y PATCH )

Devuelve la respuesta JSON del servidor PostgREST, incluidas las filas seleccionadas para las solicitudes GET y las filas actualizadas para las solicitudes POST y PATCH .

sqlToRest

Convierte una consulta SQL a la sintaxis PostgREST equivalente (como método y ruta). Útil para consultas complejas que, de otro modo, los LLM tendrían dificultades para convertir a la sintaxis PostgREST válida.

Tenga en cuenta que PostgREST solo admite un subconjunto de SQL, por lo que no todas las consultas se convertirán. Consulte sql-to-rest para obtener más información.

Acepta los siguientes argumentos:

  • sql : La consulta SQL a convertir.

Devuelve un objeto que contiene las propiedades method y path de la solicitud. Los LLM pueden usar la herramienta postgrestRequest para ejecutar la solicitud.

Uso

Con Claude Desktop

Claude Desktop es un popular cliente LLM compatible con el Protocolo de Contexto de Modelo. Puede conectar su servidor PostgREST a Claude Desktop para consultar su base de datos mediante comandos de lenguaje natural.

Puede agregar servidores MCP a Claude Desktop a través de su archivo de configuración en:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Ventanas: %APPDATA%\Claude\claude_desktop_config.json

Para agregar su proyecto Supabase (o cualquier servidor PostgREST) a Claude Desktop, agregue la siguiente configuración al objeto mcpServers en el archivo de configuración:

{ "mcpServers": { "todos": { "command": "npx", "args": [ "-y", "@supabase/mcp-server-postgrest@latest", "--apiUrl", "https://your-project-ref.supabase.co/rest/v1", "--apiKey", "your-anon-key", "--schema", "public" ] } } }
Configuración
  • apiUrl : La URL base de su punto final PostgREST
  • apiKey : Su clave API para autenticación (opcional)
  • schema : El esquema de Postgres desde el que se servirá la API (p. ej., public ). Tenga en cuenta que cualquier esquema no público debe exponerse manualmente desde PostgREST.

Programáticamente (cliente MCP personalizado)

Si está creando su propio cliente MCP, puede conectarse a un servidor PostgREST mediante programación usando su transporte preferido. El SDK de MCP ofrece transportes stdio y SSE integrados. También ofrecemos un StreamTransport si desea conectarse directamente a servidores MCP en memoria o mediante su propio transporte basado en flujos.

Instalación
npm i @supabase/mcp-server-postgrest
yarn add @supabase/mcp-server-postgrest
pnpm add @supabase/mcp-server-postgrest
Ejemplo

El siguiente ejemplo utiliza StreamTransport para conectar directamente un cliente y un servidor MCP.

import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamTransport } from '@supabase/mcp-utils'; import { createPostgrestMcpServer } from '@supabase/mcp-server-postgrest'; // Create a stream transport for both client and server const clientTransport = new StreamTransport(); const serverTransport = new StreamTransport(); // Connect the streams together clientTransport.readable.pipeTo(serverTransport.writable); serverTransport.readable.pipeTo(clientTransport.writable); const client = new Client( { name: 'MyClient', version: '0.1.0', }, { capabilities: {}, } ); const supabaseUrl = 'https://your-project-ref.supabase.co'; // http://127.0.0.1:54321 for local const apiKey = 'your-anon-key'; // or service role, or user JWT const schema = 'public'; // or any other exposed schema const server = createPostgrestMcpServer({ apiUrl: `${supabaseUrl}/rest/v1`, apiKey, schema, }); // Connect the client and server to their respective transports await server.connect(serverTransport); await client.connect(clientTransport); // Call tools, etc const output = await client.callTool({ name: 'postgrestRequest', arguments: { method: 'GET', path: '/todos', }, });
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Este es un servidor MCP para PostgREST. Permite a los LLM realizar consultas y operaciones en bases de datos Postgres mediante PostgREST. Este servidor funciona tanto con proyectos Supabase (que usan PostgREST) como con servidores PostgREST independientes.

  1. Herramientas
    1. postgrestRequest
    2. sqlToRest
  2. Uso
    1. Con Claude Desktop
    2. Programáticamente (cliente MCP personalizado)

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    This server enables interaction with Supabase PostgreSQL databases through the MCP protocol, allowing seamless integration with Cursor and Windsurf IDEs for secure and validated database management.
    Last updated -
    11
    699
    Python
    Apache 2.0
    • Apple
    • Linux
  • -
    security
    A
    license
    -
    quality
    An MCP server that connects to Supabase PostgreSQL databases, exposing table schemas as resources and providing tools for data analysis through SQL queries.
    Last updated -
    JavaScript
    MIT License
  • -
    security
    A
    license
    -
    quality
    An MCP server that enables natural language querying of Supabase PostgreSQL databases using Claude 3.7, allowing users to inspect schemas, execute SQL, manage migrations, and convert natural language to SQL queries.
    Last updated -
    Python
    MIT License
    • Linux
    • Apple
  • -
    security
    F
    license
    -
    quality
    PG-MCP is an HTTP server implementation that enables AI systems to interact with PostgreSQL databases via MCP, providing tools for querying, connecting to multiple databases, and exploring schema resources. The system enriches context by extracting table/column description from database catalogs.
    Last updated -
    8
    • Linux
    • Apple

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/supabase-community/mcp-supabase'

If you have feedback or need assistance with the MCP directory API, please join our Discord server