Skip to main content
Glama

PostgreSQL MCP Server

by cesarvarela

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
DEBUGNoDebug settings
NODE_ENVNoEnvironment setting (development/production)
POSTGRES_DBNoPostgreSQL database name
DATABASE_URLNoPostgreSQL connection string
POSTGRES_HOSTNoPostgreSQL host
POSTGRES_PORTNoPostgreSQL port
POSTGRES_USERNoPostgreSQL username
QUERY_TIMEOUTNoTimeout for database queries in milliseconds
MAX_CONNECTIONSNoMaximum number of database connections
POSTGRES_PASSWORDNoPostgreSQL password

Schema

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
query-table

Query data from a specific table with filtering, pagination, and sorting. Supports WHERE conditions with exact matches, arrays (IN), and LIKE patterns.

get-schema

Get database schema information including tables, columns, data types, and optionally constraints. Useful for understanding database structure.

execute-query

Execute a parameterized SQL query with safety checks. Supports SELECT, INSERT, UPDATE, DELETE operations with parameter binding to prevent SQL injection.

insert-data

Insert new records into a table. Supports single or multiple records, conflict resolution (ignore/update), and returning inserted data.

update-data

Update existing records in a table. Requires WHERE conditions for safety. Supports complex WHERE clauses and returns updated records.

delete-data

Delete records from a table. Requires WHERE conditions for safety. Includes confirmation prompt for large deletions.

get-table-info

Get detailed information about a specific table including columns, constraints, indexes, and optionally statistics like row count and size.

connection-status

Check database connection status, view error details, and retry connection. Use retry: true to attempt reconnection when database is unavailable.

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/cesarvarela/postgres-mcp'

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