Skip to main content
Glama
postgres-explorer

postgres-explorer

by mathewsls

🐘 Postgres-Explorer MCP Server

Servidor MCP que permite a Claude Code explorar y consultar una base de datos PostgreSQL de forma segura (solo lectura).

✅ Requisitos

  • 🐍 Python >= 3.12

  • 🗄️ PostgreSQL accesible

  • 🐳 Docker (opcional)

Related MCP server: PostgreSQL MCP Server

🔐 Variables de entorno

DB_HOST=localhost
DB_NAME=name_example
DB_USER=user_example
DB_PASSWORD=password_example
DB_PORT=5432

⚙️ Configuración para Claude Code

Agrega esto a tu .mcp.json en la raíz del proyecto:

🐳 Opción 1 — Docker (recomendado)

Primero construye la imagen desde la raíz del proyecto:

docker build -t mi-mcp-postgres .

Luego agrega esto a tu .mcp.json:

{
  "mcpServers": {
    "postgres-explorer": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--network",
        "host",
        "--env-file",
        "/ruta/absoluta/hacia/tu/proyecto/.env",
        "mi-mcp-postgres"
      ]
    }
  }
}

o a tu opencode.json:

{
  "mcp": {
    "postgres-explorer": {
      "type": "local",
      "command": [
        "docker",
        "run",
        "-i",
        "--rm",
        "--network",
        "host",
        "--env-file",
        "/ruta/absoluta/hacia/tu/proyecto/.env",
        "mi-mcp-postgres"
      ]
    }
  }
}

⚡ Opción 2 — Python directo

{
  "mcpServers": {
    "postgres-explorer": {
      "command": "uv",
      "args": ["run", "python", "main.py"]
    }
  }
}

🛠️ Herramientas disponibles

Herramienta

Descripción

get_schema

📋 Lista todas las tablas y sus columnas del esquema public

execute_query

🔍 Ejecuta una consulta SELECT y devuelve resultados

🔒 Seguridad: solo permite SELECT. Conexiones en modo read-only.

Available Tools

2 tools
execute_queryB

Ejecuta una consulta SQL SELECT en PostgreSQL y devuelve los resultados. Úsala solo para consultas de lectura.

Inputs: sql (required). Returns: result

get_schemaA

Obtiene la lista de tablas y sus columnas en el esquema público de PostgreSQL.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: execute_query handles arbitrary SELECT queries, while get_schema retrieves metadata about tables and columns. No overlap or ambiguity exists.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun pattern (execute_query, get_schema) using snake_case, making the naming predictable and clear.

    Tool Count2/5

    With only 2 tools, the server feels minimal for a 'PostgreSQL explorer'. Typical exploration would benefit from additional tools like describe_table, list_schemas, or view_details, making 2 tools insufficient for a well-scoped exploration surface.

    Completeness3/5

    The server covers basic schema browsing and arbitrary read queries, but lacks more granular tools (e.g., specific table details, constraint info, index listing). Users cannot easily explore beyond the public schema or get metadata about individual objects without writing SQL.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      Enables secure read-only access to PostgreSQL databases through SELECT queries only, with tools for exploring schemas, listing tables, and executing common queries while preventing any data modification operations.
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides secure, read-only access to PostgreSQL databases for schema inspection and data querying. It enables users to list tables, describe structures, and execute SELECT statements while strictly blocking destructive operations.
      1
      MIT