postgres-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| POSTGRES_CONNECTION_STRING | Yes | PostgreSQL connection string in libpq URI format, e.g. postgresql://user:password@host:5432/dbname |
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 |
|---|---|
| list_schemasA | List all schemas in the connected PostgreSQL database. |
| list_tablesA | List all tables (and views) in schema. Args: schema: PostgreSQL schema name (default: "public"). |
| describe_tableA | Show columns, data types, nullability, defaults, and constraints for a table. Args: table: Table name. schema: Schema that owns the table (default: "public"). |
| execute_queryA | Execute a read-only SQL query and return results as JSON. The query must be a SELECT (or WITH … SELECT / EXPLAIN / SHOW / TABLE / VALUES). Mutating statements are rejected before they reach the database. Args: sql: The SQL query to execute. limit: Maximum number of rows to return (default: 500, max: 5000). |
| get_table_sampleA | Return the first n rows of a table (ORDER BY primary key if available). Args: table: Table name. schema: Schema name (default: "public"). n: Number of rows to return (default: 20, max: 500). |
| explain_queryA | Run EXPLAIN (or EXPLAIN ANALYZE) on a query and return the plan. Args: sql: The SELECT query to explain. analyze: If True, actually executes the query to get runtime stats (EXPLAIN ANALYZE). Default: False (plan only, no execution). |
| list_functionsB | List user-defined functions and stored procedures in schema. Args: schema: Schema name (default: "public"). |
| get_database_infoA | Return general information about the connected PostgreSQL database: version, current database, current user, encoding, timezone, and top-level statistics. |
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 8 tools
Each tool targets a distinct aspect of database interaction: metadata discovery (schemas, tables, columns, functions), row retrieval (sample, query), and query analysis (explain, database info). The overlap between get_table_sample and execute_query is minimal because one is a convenience for a specific table while the other accepts arbitrary read-only SQL.
All tools follow a consistent verb_noun snake_case convention, with list_* for metadata enumeration, get_* for specific retrievals, and execute_query/explain_query/describe_table for actions. There are no mixed casing styles or vague verbs.
Eight tools is well-scoped for a PostgreSQL introspection and read-only query server. Each tool covers a meaningful capability without redundancy or bloat.
The tool surface covers the full read-only lifecycle: discovering schemas, tables, columns, functions, database info, sampling data, running arbitrary SELECTs, and explaining query plans. Since execute_query permits arbitrary read-only SQL, any remaining introspection gaps can be queried directly, so there are no dead ends.