Skip to main content
Glama
gabriel-herencia

postgres-mcp

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
DATABASE_URIYesPostgreSQL connection URI, e.g. postgresql://user:pass@host:5432/db (also accepts DATABASE_URL)
PG_MCP_MAX_ROWSNoHard cap on returned rows1000
PG_MCP_POOL_MAXNoMax pooled connections4
PG_MCP_ACCESS_MODENoAccess mode: readonly, readwrite, or adminreadonly
PG_MCP_STATEMENT_TIMEOUT_MSNoPer-statement timeout in milliseconds15000

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
server_infoA

Report the server's current access mode and safety configuration so you know which write operations (if any) are permitted before attempting them.

list_schemasA

List user schemas (excludes pg_catalog / information_schema / temp).

list_tablesB

List tables, partitioned tables, views and materialized views in a schema, with comment, estimated row count and on-disk size.

describe_tableB

Full description of a table/view: columns (type, nullable, default, identity/generated, comment) plus its primary key.

list_constraintsB

All constraints on a table (primary key, unique, foreign key, check, exclusion) with their full definitions.

get_relationsA

Foreign-key relationships for a table: outgoing (FKs this table declares) and incoming (other tables referencing this one). Use this to understand the data-flow impact before any write.

list_indexesB

Indexes on a table, with full CREATE INDEX definitions and flags.

list_triggersA

List triggers in a schema (optionally filtered to one table), with their full CREATE TRIGGER definitions. Excludes internal/constraint triggers. Important to review before writes: triggers may cascade side effects.

list_functionsA

List functions and procedures in a schema (signature, return type, language, kind). Use get_function_definition for the full source.

get_function_definitionA

Full source (CREATE OR REPLACE ...) of a function or procedure. If the name is overloaded, pass arguments (e.g. "integer, text") to disambiguate.

list_viewsA

List views and materialized views in a schema, with their SQL definitions.

list_enumsC

List enum types in a schema with their ordered labels.

table_statsA

Size and activity statistics for a table (live/dead rows, sizes, last vacuum/analyze, sequential vs index scans).

run_selectA

Run a single read-only SELECT/WITH/EXPLAIN/SHOW statement and return rows.

This tool rejects non-read and multi-statement SQL and caps returned rows. (In readonly access mode the DB session is also read-only at the engine.)

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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

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