Skip to main content
Glama
JaviMaligno

postgres-mcp

by JaviMaligno

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
MAX_ROWSNoMaximum rows returned1000
POSTGRES_DBYesDatabase namepostgres
POSTGRES_HOSTYesDatabase hostlocalhost
POSTGRES_PORTNoDatabase port5432
POSTGRES_USERYesDatabase userpostgres
QUERY_TIMEOUTNoQuery timeout (seconds)30
POSTGRES_SSLMODENoSSL modeprefer
POSTGRES_PASSWORDYesDatabase password
ALLOW_WRITE_OPERATIONSNoEnable write operationsfalse

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Server capabilities have not been inspected yet.

Tools

Functions exposed to the LLM to take actions

NameDescription
queryA

Execute a SQL query against the PostgreSQL database.

This tool is READ-ONLY by default. Use the 'execute' tool for write operations.

Args:
    sql: SQL query to execute (SELECT statements only)
    
Returns:
    Query results with rows, columns, and metadata
executeA

Execute a write SQL statement (INSERT, UPDATE, DELETE).

WARNING: This tool modifies data. Use with caution.
Only available if ALLOW_WRITE_OPERATIONS=true is set.

Args:
    sql: SQL statement to execute
    
Returns:
    Execution result with affected row count
explain_queryA

Get the execution plan for a SQL query (EXPLAIN).

Args:
    sql: SQL query to explain
    analyze: If true, actually runs the query to get real execution stats
             (EXPLAIN ANALYZE). Use with caution on slow queries.
    
Returns:
    Execution plan in JSON format with cost estimates
list_schemasA

List all schemas in the PostgreSQL database.

Returns:
    List of schemas with name and owner
list_tablesA

List all tables in a specific schema.

Args:
    schema: Schema name to list tables from (default: public)
    
Returns:
    List of tables with name and type
describe_tableA

Describe the structure of a table including columns, types, and constraints.

Args:
    table_name: Name of the table to describe
    schema: Schema name (default: public)
    
Returns:
    Table structure with columns, primary keys, and foreign keys
table_statsB

Get statistics for a table (row count, size, bloat).

Args:
    table_name: Name of the table
    schema: Schema name (default: public)
    
Returns:
    Table statistics including row count, sizes, and vacuum info
list_indexesB

List all indexes for a table.

Args:
    table_name: Name of the table
    schema: Schema name (default: public)
    
Returns:
    List of indexes with name, columns, type, and size
list_constraintsA

List all constraints for a table (PK, FK, UNIQUE, CHECK).

Args:
    table_name: Name of the table
    schema: Schema name (default: public)
    
Returns:
    List of constraints with type, columns, and references
list_viewsB

List all views in a schema.

Args:
    schema: Schema name (default: public)
    
Returns:
    List of views with name
describe_viewA

Get the definition and columns of a view.

Args:
    view_name: Name of the view
    schema: Schema name (default: public)
    
Returns:
    View definition SQL and column list
list_functionsB

List all functions and procedures in a schema.

Args:
    schema: Schema name (default: public)
    
Returns:
    List of functions with name, arguments, and return type
get_database_infoB

Get database and connection information.

Returns:
    Database version, connection info, and settings
search_columnsB

Search for columns by name across all tables.

Args:
    search_term: Column name pattern to search (case-insensitive)
    schema: Optional schema to limit search (default: all user schemas)
    
Returns:
    List of matching columns with table information

Prompts

Interactive templates invoked by user choice

NameDescription
explore_databaseExplore the database structure and understand the schema. Returns: Prompt for exploring the database
query_builderHelp build SQL queries for a specific table. Args: table_name: Table to query Returns: Prompt for building queries
performance_analysisAnalyze table performance and suggest optimizations. Args: table_name: Table to analyze Returns: Prompt for performance analysis
data_dictionaryGenerate a data dictionary for a schema. Args: schema: Schema to document Returns: Prompt for generating data dictionary

Resources

Contextual data attached and managed by the client

NameDescription
resource_schemasList all schemas in the database. Returns a summary of schemas for browsing.
resource_databaseGet database information.

Latest Blog Posts

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/JaviMaligno/postgres_mcp'

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