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 |
Capabilities
Features and capabilities supported by this server
| 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 | |
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/gabriel-herencia/postgres-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server