Skip to main content
Glama
NightTrek

Supabase MCP Server

by NightTrek

Servidor MCP de Supabase

Un servidor de Protocolo de Contexto de Modelo (MCP) para interactuar con bases de datos de Supabase. Este servidor proporciona herramientas para consultar tablas y generar tipos de TypeScript mediante la interfaz MCP.

Características

  • Tablas de consulta : ejecute consultas en cualquier tabla con soporte para:

    • Selección de esquema

    • Filtrado de columnas

    • Cláusulas where con múltiples operadores

    • Paginación

    • Manejo de errores

  • Generación de tipos : genere tipos TypeScript para su base de datos:

    • Soporte para cualquier esquema (público, auth, api, etc.)

    • Funciona con proyectos Supabase tanto locales como remotos

    • Salida directa a consola

    • Detección automática de referencias de proyectos

Related MCP server: SchemaFlow MCP Server

Prerrequisitos

  1. Node.js (v16 o superior)

  2. Un proyecto de Supabase (ya sea local o alojado)

  3. Supabase CLI (para generación de tipos)

Instalación

  1. Clonar el repositorio:

git clone https://github.com/yourusername/supabase-mcp-server.git
cd supabase-mcp-server
  1. Instalar dependencias:

npm install
  1. Instale la CLI de Supabase (necesaria para la generación de tipos):

# Using npm
npm install -g supabase

# Or using Homebrew on macOS
brew install supabase/tap/supabase

Configuración

  1. Obtenga sus credenciales de Supabase:

    • Para proyectos alojados:

      1. Vaya al panel de control de su proyecto Supabase

      2. Vaya a Configuración del proyecto > API

      3. Copia la URL del proyecto y la clave service_role (NO la clave anónima)

    • Para proyectos locales:

      1. Inicie su instancia local de Supabase

      2. Utilice la URL local (normalmente http://localhost:54321 )

      3. Utilice su clave de servicio local

  2. Configurar variables de entorno:

# Create a .env file (this will be ignored by git)
echo "SUPABASE_URL=your_project_url
SUPABASE_KEY=your_service_role_key" > .env
  1. Construir el servidor:

npm run build

Integración con Claude Desktop

  1. Abra la configuración de Claude Desktop:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Ventanas: %APPDATA%\Claude\claude_desktop_config.json

    • Linux: ~/.config/Claude/claude_desktop_config.json

  2. Agregue la configuración del servidor:

{
  "mcpServers": {
    "supabase": {
      "command": "node",
      "args": ["/absolute/path/to/supabase-mcp-server/build/index.js"],
      "env": {
        "SUPABASE_URL": "your_project_url",
        "SUPABASE_KEY": "your_service_role_key"
      }
    }
  }
}

Integración con la extensión VSCode

  1. Abrir la configuración de VSCode:

    • macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

    • Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json

    • Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

  2. Agregue la configuración del servidor (mismo formato que Claude Desktop).

Ejemplos de uso

Consulta de tablas

// Query with schema selection and where clause
<use_mcp_tool>
<server_name>supabase</server_name>
<tool_name>query_table</tool_name>
<arguments>
{
  "schema": "public",
  "table": "users",
  "select": "id,name,email",
  "where": [
    {
      "column": "is_active",
      "operator": "eq",
      "value": true
    }
  ]
}
</arguments>
</use_mcp_tool>

Generando tipos

// Generate types for public schema
<use_mcp_tool>
<server_name>supabase</server_name>
<tool_name>generate_types</tool_name>
<arguments>
{
  "schema": "public"
}
</arguments>
</use_mcp_tool>

Herramientas disponibles

tabla de consulta

Consultar una tabla específica con selección de esquema y soporte de cláusula where.

Parámetros:

  • schema (opcional): esquema de base de datos (predeterminado a público)

  • table (obligatorio): Nombre de la tabla a consultar

  • select (opcional): lista de columnas separadas por comas

  • where (opcional): Matriz de condiciones con:

    • column : Nombre de la columna

    • operator : Uno de: eq, neq, gt, gte, lt, lte, like, ilike, is

    • value : Valor con el que comparar

generar_tipos

Genere tipos TypeScript para su esquema de base de datos Supabase.

Parámetros:

  • schema (opcional): esquema de base de datos (predeterminado a público)

Solución de problemas

Problemas de generación de tipos

  1. Asegúrese de que Supabase CLI esté instalado:

supabase --version
  1. Para proyectos locales:

    • Asegúrese de que su instancia local de Supabase se esté ejecutando

    • Verifique que su clave service_role sea correcta

  2. Para proyectos alojados:

    • Confirme que la referencia de su proyecto sea correcta (extraída de la URL)

    • Verifique que esté utilizando la clave service_role, no la clave anon

Problemas de consulta

  1. Comprueba tu esquema y los nombres de las tablas

  2. Verificar los nombres de las columnas en las cláusulas select y where

  3. Asegúrese de que su clave service_role tenga los permisos necesarios

Contribuyendo

  1. Bifurcar el repositorio

  2. Crea tu rama de funciones: git checkout -b feature/my-feature

  3. Confirme sus cambios: git commit -am 'Add my feature'

  4. Empujar a la rama: git push origin feature/my-feature

  5. Enviar una solicitud de extracción

Licencia

Licencia MIT: consulte el archivo de LICENCIA para obtener más detalles

Available Tools

2 tools
generate_typesB

Generate TypeScript types for your Supabase database schema

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoDatabase schema (optional, defaults to public)

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it works - whether it connects to a live database, reads from configuration files, requires authentication, has rate limits, or what format the output takes. The description is functional but lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core functionality without any wasted words. It's appropriately sized for a tool with one simple parameter and gets straight to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that presumably generates code/types from a database schema, the description is minimal. With no annotations and no output schema, it doesn't explain what the output looks like (TypeScript files? Inline code?), how errors are handled, or any dependencies or requirements. The description is functional but lacks important context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the input schema already documents the single optional 'schema' parameter with its default value. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline expectation but doesn't provide additional value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Generate TypeScript types') and target resource ('your Supabase database schema'), providing a complete purpose statement. It distinguishes from the sibling tool 'query_table' which appears to be for data querying rather than schema type generation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, nor any context about prerequisites or constraints. While it's clear what the tool does, there's no information about appropriate use cases or limitations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_tableC

Query a specific table with schema selection and where clause support

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoDatabase schema (optional, defaults to public)
tableYesName of the table to query
selectNoComma-separated list of columns to select (optional, defaults to *)
whereNoArray of where conditions (optional)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool queries a table but doesn't mention whether this is read-only (likely but not confirmed), what permissions are required, whether it supports pagination/limits, error handling, or what the output format looks like. The description adds minimal behavioral context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core functionality without unnecessary words. It's appropriately sized for the tool's complexity and front-loads the main purpose immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a database query tool with 4 parameters and no annotations or output schema, the description is insufficient. It doesn't address key contextual elements like: whether this is a safe read operation, what authentication/permissions are needed, how results are returned (format, size limits), error conditions, or relationship to the sibling tool. The 100% schema coverage helps with parameters but doesn't compensate for missing behavioral context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 4 parameters thoroughly. The description mentions 'schema selection and where clause support' which aligns with parameters in the schema but doesn't add meaningful semantic context beyond what's already in the parameter descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Query') and resource ('a specific table'), with additional functionality mentioned ('schema selection and where clause support'). It distinguishes from the sibling 'generate_types' by focusing on data retrieval rather than type generation. However, it doesn't specify if this is a read-only query or might modify data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description mentions functionality but doesn't indicate scenarios where this tool is appropriate, prerequisites for use, or limitations compared to other query methods. The sibling tool 'generate_types' serves a completely different purpose, so no comparative guidance is needed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.0.0
    • First observedgenerate_types
    • First observedquery_table

TDQS

B3.1/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: generate_types focuses on TypeScript type generation from the database schema, while query_table handles data retrieval from specific tables with filtering. There is no overlap or ambiguity between these functions.

Naming Consistency5/5

Both tools follow a consistent verb_noun naming pattern (generate_types and query_table), using snake_case throughout. The naming is predictable and readable without any deviations.

Tool Count2/5

With only 2 tools, the server feels under-scoped for a Supabase integration, which typically involves operations like create, update, delete, and schema management beyond just querying and type generation. This limited set may hinder agent workflows.

Completeness2/5

The server lacks essential CRUD operations (e.g., insert, update, delete) and other Supabase features like authentication or real-time subscriptions, making it severely incomplete for typical database interactions. Agents will face significant gaps in functionality.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Implements the Model Context Protocol to provide LLMs with tools for interacting with Supabase databases, supporting operations like reading, creating, updating, and deleting records with filtering and pagination capabilities.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides AI-IDEs with real-time access to PostgreSQL and Supabase database schemas through the Model Context Protocol, enabling smarter code generation in tools like Cursor, Windsurf, and VS Code + Cline.
    10
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol server that enables interaction with self-hosted Supabase instances, allowing developers to query database schemas, manage migrations, inspect statistics, and interact with Supabase features directly from MCP-compatible development environments.
    21
    1
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Connects AI assistants to Supabase projects to manage databases, execute SQL queries, and handle project configurations. It enables tasks like table management, edge function deployment, and log retrieval through the Model Context Protocol.
    Apache 2.0