postgres-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DATABASE_URI | Yes | PostgreSQL connection URI, e.g. postgresql://user:pass@host:5432/db (also accepts DATABASE_URL) | |
| PG_MCP_MAX_ROWS | No | Hard cap on returned rows | 1000 |
| PG_MCP_POOL_MAX | No | Max pooled connections | 4 |
| PG_MCP_ACCESS_MODE | No | Access mode: readonly, readwrite, or admin | readonly |
| PG_MCP_STATEMENT_TIMEOUT_MS | No | Per-statement timeout in milliseconds | 15000 |
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": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| 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: |
| 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 |
| 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
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 14 tools
Each tool has a unique purpose—describing tables, functions, relationships, constraints, enums, indexes, schemas, tables, triggers, views, executing read-only queries, getting server info, and table statistics. No two tools overlap in functionality.
All tools follow a consistent verb_noun pattern in snake_case (e.g., describe_table, list_constraints, run_select). This makes the API predictable and easy for an agent to guess tool names.
14 tools cover the essential operations for PostgreSQL schema introspection (metadata, relationships, statistics, safe queries) without being overwhelming or sparse. The count is well-scoped for the server's purpose.
The toolset provides comprehensive coverage: describing objects, listing all schema elements, constraints, indexes, triggers, functions, enums, relationships, table statistics, and a safe read-only query runner. No obvious gaps for typical database exploration tasks.