postgres-mcp-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PGHOST | No | Database host (used if not using DATABASE_URL) | |
| PGPORT | No | Database port (used if not using DATABASE_URL) | |
| PGUSER | No | Database user (used if not using DATABASE_URL) | |
| PGDATABASE | No | Database name (used if not using DATABASE_URL) | |
| PGPASSWORD | No | Database password (used if not using DATABASE_URL) | |
| DATABASE_URL | No | PostgreSQL connection string, e.g. postgresql://postgres:password@localhost:5432/mydb | |
| ALLOW_WRITE_QUERIES | No | Set to 'true' to enable write queries via execute_query. Defaults to false. | false |
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 |
|---|---|
| list_tablesA | List all tables, views, and schemas in the PostgreSQL database along with estimated row counts and table sizes. |
| describe_tableA | Get detailed schema breakdown for a specific table or view, including column names, data types, constraints, primary keys, foreign keys, and indexes. |
| read_queryA | Execute a read-only SQL query (SELECT, WITH, etc.). Strictly executed inside a DB-level READ ONLY transaction for safety. |
| explain_queryA | Execute EXPLAIN on a SQL query to inspect query planner cost estimates, join strategies, and index usage. |
| get_db_statsA | Retrieve database health & performance metrics: database size, top tables by disk usage, active connections, and cache hit ratio. |
| execute_queryA | Execute data modification statements (INSERT, UPDATE, DELETE, DDL). Requires ALLOW_WRITE_QUERIES=true in environment. |
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 6 tools
Each tool targets a distinct function: listing tables, describing schema, executing read-only queries, explaining query plans, retrieving database stats, and executing write operations. There is no overlap or ambiguity between tool purposes.
All tool names follow a consistent verb_noun pattern in snake_case (list_, describe_, read_, explain_, get_, execute_). The naming is uniform and predictable.
With 6 tools, the set is concise and well-scoped for a PostgreSQL server, covering the essential operations without unnecessary bloat or sparse coverage.
The tool surface covers the full lifecycle of database interaction: discovery, schema inspection, read queries, write queries, query planning, and server statistics. No critical gaps are apparent for the intended purpose.