Skip to main content
Glama
antonorlov

MCP PostgreSQL Server

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PG_HOSTNoDatabase host (fallback when DATABASE_URL is not set)
PG_PORTNoDatabase port. Defaults to 54325432
PG_USERNoDatabase user
PG_SSL_CANoPath to a CA certificate file. Setting it by itself implies verify-full
PG_SSLMODENoSSL mode: disable | allow | prefer | require | verify-ca | verify-full
PG_DATABASENoDatabase name
PG_PASSWORDNoDatabase password
PG_SSH_HOSTNoSSH bastion host. Setting it enables tunneling.
PG_SSH_PORTNoSSH bastion port22
PG_SSH_USERNoSSH username
DATABASE_URLNoFull PostgreSQL connection string (preferred). Supports SSL mode via query parameter, e.g. postgres://user:password@localhost:5432/mydb?sslmode=require
PG_SSH_AGENTNotrue to use the ambient SSH agent, or an explicit socket path / Windows named pipe
PG_ALLOW_WRITENoWhen true, execute performs writes and reads are sent directly. Off (default) is read-only: execute refuses writes and each read runs in a READ ONLY transactionfalse
PG_SSH_PASSWORDNoSSH login password. Opt-in; a key or agent takes precedence
PG_SSH_PASSPHRASENoPassphrase for the private key, if encrypted
PG_CONNECT_TIMEOUTNoTimeout in milliseconds for a single connect attempt10000
PG_SSH_FINGERPRINTNoPinned host-key fingerprint (SHA256:...). Required when PG_SSH_HOST is set.
PG_SSH_PRIVATE_KEYNoPath to a private key file
PG_MAX_RESULT_BYTESNoByte budget for a query result sent to the model32768
PG_STATEMENT_TIMEOUTNoStatement timeout in milliseconds, applied to every session30000
PG_ENABLE_RUNTIME_CONNECTNoRegister the connect_db tool for runtime credential switchingfalse
PG_SSH_KEEPALIVE_INTERVALNoSSH keepalive interval in ms; the tunnel drops after 3 unanswered keepalives15000

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

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
queryA

Run one read-only SQL statement against the connected PostgreSQL database and get rows back as JSON. Send exactly one statement per call (SELECT, WITH, EXPLAIN, or SHOW). It runs inside an engine-enforced read-only transaction, so any write is refused by the database. Use this tool for all data reading, aggregation, and query planning. Returns {rows, rowCount, returnedRows, truncated}, plus hint when truncated is true. Prefer $1, $2 placeholders with the params array over interpolating values. Results are capped at ~32768 bytes; truncated:true means rows were dropped - add LIMIT/WHERE or select fewer columns.

executeA

Run a data-modifying SQL statement (INSERT/UPDATE/DELETE or DDL). Currently DISABLED: the server is read-only, so this returns an error and changes nothing. To enable writes, the operator must start the server with PG_ALLOW_WRITE=true.

list_schemasA

List every schema in the connected database. Start here when exploring an unfamiliar database, then call list_tables for the schema you care about. Returns {schemas: [name, ...]}.

list_tablesA

List all tables in a schema (default: 'public'). Use this before querying tables you have not seen yet, then call describe_table for column details. Returns {tables: [name, ...]}.

describe_tableA

Show the structure of one table: column names, data types, nullability, defaults, and primary-key membership. Call this before writing non-trivial queries against a table. Returns {columns: [{column, type, nullable, default, is_primary_key}, ...]}.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.5/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a clearly separate concern: read queries, write execution, schema discovery, table discovery, and column metadata. There is no meaningful overlap, and the descriptions reinforce the boundaries.

Naming Consistency5/5

All tool names follow a clean verb_object pattern in snake_case: query, execute, list_schemas, list_tables, describe_table. The naming convention is consistent and predictable.

Tool Count5/5

Five tools is well-scoped for a PostgreSQL server: one read path, one write path, and three introspection tools for exploring the database structure. No tool feels redundant or missing.

Completeness4/5

The tool surface covers the core database workflow well: discover schemas, inspect tables, describe columns, run read queries, and execute writes. The only caveat is that execute is disabled by default, so write workflows are not available unless the operator explicitly enables them.

Maintenance

ActivityMaintained
ResponsivenessUnresponsive