Skip to main content
Glama
eric-patton

postgres-schema-mcp

by eric-patton

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
DATABASE_URLYesConnection string. Point it at the read-only role.
PGSM_MAX_POOLNoConnection pool size4
PGSM_MAX_ROWSNoRow cap on every result200
PGSM_HTTP_HOSTNoHost to bind for HTTP mode. Defaults to 127.0.0.1127.0.0.1
PGSM_HTTP_PORTNoPort for authenticated HTTP mode
PGSM_MAX_BYTESNoSize cap on every result, which is the one that protects the agent's context100000
PGSM_TOKENS_FILENoPath to JSON file containing tokens for HTTP mode
PGSM_REDACT_PATTERNNoRegular expression matched against column names to redact values in results. Default covers common sensitive column names.password|secret|token|ssn|credit_card|api_key|private_key
PGSM_ALLOWED_SCHEMASNoComma-separated allowlist of schemas. Everything else becomes invisible.all
PGSM_IDLE_TX_TIMEOUT_MSNoIdle-in-transaction timeout15000
PGSM_STATEMENT_TIMEOUT_MSNoPer-statement timeout10000

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
list_schemasA

List the schemas in the database with how many tables and views each holds. Start here when you do not know the shape of the database yet.

list_tablesA

List the tables and views in one schema, largest first, with an estimated row count and total on-disk size. Use this to find out what is expensive before you query it. Row counts are planner estimates, not exact counts.

describe_tableA

Full description of one table: every column with its type, nullability and default, plus primary keys, foreign keys, unique and check constraints, indexes and any comments. This is the core tool once you know which table you want.

find_columnsA

Search for columns by name across every schema, optionally filtered by type. Use this instead of listing tables when the database is large: searching for "customer_id" finds every table that carries it in one call.

table_relationshipsA

Follow foreign keys from one table, in both directions, up to a given depth. Outbound keys tell you what a row points at; inbound keys tell you what points at it. Use this to work out how to join instead of guessing from column names.

sample_rowsA

Return the first few rows of a table so you can see the shape of the data. Columns whose names look like secrets are masked. Results are capped by row count and by size, and the response says when it truncated.

run_selectA

Run one SELECT or WITH statement. Anything else is refused, including stacked statements, DDL, DML and SELECT INTO. The query runs in a read-only transaction with a statement timeout, results are capped and secret-looking columns masked. There is no write mode.

explain_queryA

Show the query plan for a SELECT without running it. Pass analyze: true to execute it and get measured timings instead of estimates. Use this to tune a query before running it against a large table.

export_data_dictionaryA

Write a Markdown data dictionary for one schema to a file: every table, every column with type and nullability, and every key and constraint. Once written, you can read the schema from disk with no database connection. This is the only tool here that writes anything, and it writes only to the path you give it.

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/eric-patton/postgres-schema-mcp'

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