postgres-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PGPASSWORD | No | PostgreSQL password, read by the pg client; can be used to keep the password out of PG_MCP_URL. | |
| PG_MCP_URL | No | PostgreSQL connection string, e.g. postgres://user[:password]@host:port/db. Required (or DATABASE_URL). | |
| PG_MCP_MODE | No | Either readonly or readwrite. Write tools exist only when set to readwrite. | readonly |
| DATABASE_URL | No | Alternative to PG_MCP_URL for the PostgreSQL connection string, e.g. postgres://user[:password]@host:port/db. | |
| PG_MCP_MAX_ROWS | No | Maximum rows returned by query before truncation. | 500 |
| PG_MCP_MAX_CELL_CHARS | No | Maximum characters kept per cell. | 2000 |
| PG_MCP_STATEMENT_TIMEOUT_MS | No | Per-call statement timeout in milliseconds. | 30000 |
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
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| queryA | Run ONE read-only SQL statement (SELECT, WITH, VALUES, TABLE, SHOW, EXPLAIN) in a READ ONLY transaction that is always rolled back. Returns at most 500 rows; long cells are cut. Multiple statements and transaction control are rejected. |
| list_tablesA | List tables, views and materialized views with estimated row counts and size. Omit schema to list every user schema. |
| describe_tableB | Columns (type, nullability, default, comment), constraints and indexes of one table or view. |
| connection_infoA | Who this server connects as, its mode and limits, and whether the database role itself could write. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 4 tools
Each tool targets a clearly different need: arbitrary reads (query), object inventory (list_tables), single-object structure (describe_table), and server/session context (connection_info). The only overlap is that query can reach pg_catalog and duplicate the metadata tools, but the descriptions make the intended split clear enough to avoid misselection.
Three of four names follow a recognizable verb/verb_noun style (query, list_tables, describe_table) with snake_case throughout. connection_info is the one break in pattern as a noun phrase, but it still reads naturally as a distinct informational tool.
Four tools is lean and each one earns its place in a deliberately read-only server; nothing feels redundant. It sits at the low end of the comfortable range, so a slightly broader surface (e.g. schema/extension listing) could have been added without bloat.
For a read-only inspection domain, the set covers the main path: discover objects, inspect structure, run ad-hoc queries, and confirm what the role can do. Gaps are minor — no schema/database listing tool, no column-name search, and no dedicated index or function introspection — all workable via query on pg_catalog.