PostgreSQL MCP Server
Provides read-only access to PostgreSQL databases with tools for listing tables, viewing table structures and statistics, and executing SELECT queries with security protections against write operations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PostgreSQL MCP Servershow me the structure of the customers table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PostgreSQL MCP Server
Servidor MCP (Model Context Protocol) para acceso de solo lectura a bases de datos PostgreSQL.
Características
Este servidor MCP proporciona herramientas para:
📋 Listar tablas disponibles en la base de datos
🔍 Ver estructura completa de tablas (columnas, tipos, constraints, índices)
📊 Obtener estadísticas de tablas (filas, tamaño, última actualización)
🔎 Ejecutar queries SELECT de solo lectura (protegido contra operaciones de escritura)
Related MCP server: PostgreSQL MCP Server
Instalación
# Instalar dependencias
npm install
# Compilar el proyecto
npm run buildConfiguración en Claude Desktop
Agrega la configuración del servidor MCP en tu archivo de configuración de Claude Desktop:
macOS
Edita: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows
Edita: %APPDATA%\Claude\claude_desktop_config.json
Configuración:
{
"mcpServers": {
"postgres-mcp": {
"command": "node",
"args": [
"/ruta/absoluta/a/postgres-mcp/build/index.js"
],
"env": {
"PGHOST": "localhost",
"PGPORT": "5432",
"PGDATABASE": "tu_base_de_datos",
"PGUSER": "tu_usuario",
"PGPASSWORD": "tu_password"
}
}
}
}Importante: Reemplaza /ruta/absoluta/a/postgres-mcp con la ruta real donde clonaste el proyecto.
Herramientas Disponibles
1. list_tables
Lista todas las tablas en un schema.
Parámetros:
schema(opcional): Nombre del schema (por defecto: 'public')
Ejemplo de uso:
Lista todas las tablas de la base de datos2. describe_table
Muestra la estructura completa de una tabla.
Parámetros:
table_name(requerido): Nombre de la tablaschema(opcional): Nombre del schema (por defecto: 'public')
Ejemplo de uso:
Muéstrame la estructura de la tabla users3. query
Ejecuta una consulta SELECT de solo lectura.
Parámetros:
sql(requerido): Consulta SQL SELECTlimit(opcional): Límite de filas a retornar (por defecto: 100)
Ejemplo de uso:
Ejecuta esta query: SELECT * FROM users WHERE active = true4. table_stats
Obtiene estadísticas de una tabla.
Parámetros:
table_name(requerido): Nombre de la tablaschema(opcional): Nombre del schema (por defecto: 'public')
Ejemplo de uso:
Muéstrame las estadísticas de la tabla productsSeguridad
🔒 Este servidor está diseñado para ser de solo lectura:
Solo permite consultas
SELECTBloquea operaciones:
INSERT,UPDATE,DELETE,DROP,CREATE,ALTER,TRUNCATE, etc.Aplica límites automáticos a las consultas que no especifican
LIMIT
Desarrollo
# Compilar en modo watch
npm run watch
# Ejecutar en desarrollo
npm startTroubleshooting
Error de conexión a PostgreSQL
Verifica que PostgreSQL esté corriendo
Confirma las credenciales en el archivo
.envVerifica que el usuario tenga permisos de lectura en la base de datos
El servidor no aparece en Claude Desktop
Asegúrate de haber reiniciado Claude Desktop después de editar la configuración
Verifica que la ruta al archivo
build/index.jssea absoluta y correctaRevisa los logs de Claude Desktop para ver errores
"Query no permitida"
Solo se permiten consultas
SELECTAsegúrate de no usar operaciones de escritura en tus queries
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -license-quality-maintenanceEnables secure read-only interactions with PostgreSQL databases through natural language. Provides database inspection, table listing, and SQL query execution with built-in security validation.Last updated
- Alicense-qualityDmaintenanceEnables AI assistants to safely interact with PostgreSQL databases through read-only operations, providing schema discovery, table inspection, and query execution capabilities with structured context awareness.Last updatedMIT
- Alicense-qualityDmaintenanceEnables exploration and querying of PostgreSQL databases through natural language. Supports listing tables, viewing schemas, executing SELECT queries, filtering records, and retrieving database statistics.Last updated2MIT
- Alicense-qualityAmaintenanceEnables secure read-only access to PostgreSQL databases, allowing users to list tables, query schemas, execute SELECT statements, and inspect table structures through natural language interactions.Last updated6684MIT
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Comprehensive PostgreSQL documentation and best practices, including ecosystem tools
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/larturi/postgres-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server